-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Enabled LTO (and whitespace fixes) #867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Does this PR close or obsolete #495 ? |
|
I don't think so. |
|
I see a lot of potential to further improve the set of optimization flags and the CMakefile (as done in #495). However, I don't want to do it with this PR, it is already large as it is and pr-rot will soon get it unless merged. |
ba05271 to
abc8bfb
Compare
|
@geekbozu If you could take a look if everything seems fine, that'd be nice. |
Squashed commit of the following: commit 68ad34d Author: Avamander <[email protected]> Date: Sun Dec 12 14:55:18 2021 +0200 Improved COMMON_FLAGS commit f002bce Author: Avamander <[email protected]> Date: Sun Dec 5 22:13:15 2021 +0200 Enabled LTO and various whitespace fixes
|
@FintasticMan on Discord reported they're getting freezes. Investigating. |
|
It appears that FreeRTOS heap and the stack of the main task (systemtask) are probably overflown. Patch : Test_LTO.txt I'm running it right now on my sealed device, no issue to report right now. When trying this branch, I also noticed a few issue, mainly with the Docker build : The cmake version embedded in the container is too old and cannot build the project and this URL ( Line 42 in cb5fefc
|
I have also installed version 1.7.98 on my Pinetime. |
|
i installed 1.7.98 and the hr data no longer work (i need it for fitotrack) do you plan to put back , the Heart rate task, before merging this pr for 1.8.0 release @JF002 ? if anything , and if it's truly needed to remove a task , it might be better to remove something else than a core functionality of the pinetime i see that the 1.7.98 is far bigger than usual .... do that mean that enabling lto will forbid to add new functionality (like the near completed calculator of @Raupinger )? for al i see , and if this the case this pr should not been merged until it doesn't need to remove functionality and doesn't take more space for no visible /perceptible improvement . if the pr were to be merge as is by removing functionality and making impossible to add new one with removing existing app by the way , i need to go in recovery in order to flash dfu because , in secured bluetooth , i can't no longer do a dfu update .... |
i do understand this , but he removed it becaause otherwise the dfu would not work ..... |
|
@trman As written above, HR task was disabled. If you need HR, don't flash random test builds meant to demonstrate something wholly different. It is not meant for regular usage and wasn't labeled as such. Any qualms about a random test build are really not relevant here and such test builds shouldn't be taken as something that is going to be instantly released. Changes made are not all also immediately perceptible to the user, or really should be, there are other things that matter here as well. Any issues you have with DFU are not relevant to this PR. You should really be expecting rough corners on something unreleased, it is unreleased for a reason. If you actually discover a bug that hasn't been reported, neither under that feature's PR or in an issue, then open a new one for that single bug. |
|
@trman You've probably noticed : I didn't create a Pull-Request with those changes, because I don't want them to be merged. But, as I had to free a bit of RAM to increase the heap/stack, I had to disable the HR task so I can use the RAM memory allocated to this task for other purposes. Again, I did this only for the purpose of this test and I won't merge that in develop/master
The FLASH and RAM memories are already almost full, and that's why I cannot merge as many PR as I would like : I want to keep the memory usage under control, and some of these PRs have a lot of impact on the memory usage. The goal of LTO is to reduce the binary size (FLASH usage) so we can include some more functionalities. But, for some reason, using LTO seems to increase the RAM usage, and we still have to understand why and see what we can do about this.
This is not related to this PR, please see this |
|
Here's a TODO list so we know what must still be done in this PR:
|
|
@Avamander The test build ran for more than 6 days on my sealed unit (until I need to reboot to test other features). So I think it's quite stable once the stacks/heaps are correctly set 👍 |
|
any news on the remaining task? |
| */ | ||
| static __attribute__((used)) void TaskSwitchDummy() { | ||
| vTaskSwitchContext(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution looks like a dirty hack, I would suggest to do the following more clear hack instead:
port.c:
void xPortPendSVHandler( void )
{
...
- " bl vTaskSwitchContext \n"
+ " bl _vTaskSwitchContext \n"
...
}
+void __attribute__((used)) _vTaskSwitchContext(void)
+{
+ vTaskSwitchContext();
+}Note: I found that this solution shouldn't add any overhead as vTaskSwitchContext will be inlined into _vTaskSwitchContext.
|
|
||
| for (;;) { | ||
| // Yes, this should never be called, never is here, but it MUST be kept. | ||
| TaskSwitchDummy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, this function will be called as it is placed before infinity loop!
| ::"i"(configKERNEL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) | ||
| #endif | ||
| ); | ||
| " .ltorg \n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line be added before #ifdef SOFTDEVICE_PRESENT?
Basically, the compiler we're using has a bug that makes LTO not work properly with weak symbols.
It's more reasonable to simply upgrade.
Before:
After:
Note: Recovery build has not been tested,
pinetime-app,pinetime-mcuboot-appseem to work.