This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
stm32 hal_reset_vsr function tweak
- From: Max Salov <amx at me dot by>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 03 Jun 2009 13:05:24 +0300
- Subject: [ECOS] stm32 hal_reset_vsr function tweak
Hi
I have a suggestion to define hal_reset_vsr function as noreturn. This
tweak will save at least 4 bytes on stack, because LR register is pushed
to stack and never poped back (function ends with infinite loop).
Without "no return" listing:
void hal_reset_vsr( void )
{
8000de4: b500 push {lr}
8000de6: b081 sub sp, #4
// up GPIO, the SRAM, power management etc. This routine is
// usually supplied by the platform HAL. Calls to
// hal_variant_init() and hal_platform_init() later will perform
// the main initialization.
hal_system_init();
With "no return" listing:
08000de4 <hal_reset_vsr>:
// up GPIO, the SRAM, power management etc. This routine is
// usually supplied by the platform HAL. Calls to
// hal_variant_init() and hal_platform_init() later will perform
// the main initialization.
hal_system_init();
Both variants were build with -O2 flag.
So the difference is in two words in stack and two instructions.
Presence of "sub sp, #4" is mysterious for me.
P.S. I understand that such tweaks are miserable when minimum ecos
configuration occupy 5-6k of rom and uses about 1k of ram.
Best regards,
Max.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss