FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2013 Threads]
Hi! Looking at the GCC/ARM_CM4F target port.c xPortPendSVHandler, I believe a word of stack space is wasted pushing r14 (the link register) on the main stack, this being done on line 449 in the 7.5.3 release. It looks like this code was copied from the CM3 target, where the push of r14 in that instruction made sense, as the exception return value was the same for all tasks and so could simply be saved on the main stack between call and return of vTaskSwitchContext. In the CM4F, on the other hand, different tasks have different exception return values depending on whether or not the task uses the FPU; as such, the push on line 445 saving the callee-save integer registers onto the process stack was extended to include the link register, r14, and the corresponding load on line 460 updated to match. However, because r14 is saved on the process stack, I believe there is no longer any reason to save it on the main stack on line 449 and restore it on line 455; certainly the LR is never used between line 455 when restored the first time and line 460 when restored the second time! This is just wasting a word of main stack space, and a little bit of CPU time, for on benefit, as far as I can tell.
Looks like you could be right. I will test it with the additional push/pop removed.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.