Error in thumb_crt0.s ?
Hello,
I experienced problem with stack variables, that were overlaying with bss segment: anyway, in Symbol Browser, everything was ok (segments were not overlayed). So I was debugging from startup and found this:
_start:
#ifdef __RAM_BUILD
ldr r0, =__stack_end__
mov sp, r0
#endif
So the SP register was set only in RAM build. When I uncomented it, everything was ok (variables in stack were allocated really to the stack segment). Is that an error?
CrossStudio for ARM 1.7, build 22.
-
This isn't an error, in the FLASH build the stack is set up when the processor resets by loading the contents at address 0 into the SP.
Where you may have a problem is if you've re-located the start of FLASH away from address 0 in which case the stack won't be set up.
Having said that, I believe the latest version of thumb_crt0.s always sets up SP to avoid users falling over this very problem.
Regards,
Jon Elliott
-
Looking at the release notes, the thumb_crt0.s file was modified to allow SP to be setup correctly when a FLASH application is located away from 0x00000000 at version 2.0.2 of CrossWorks so make sure you're using this version or later.
The memory map and section placement files are used to place sections in memory, however using the latest version of thumb_crt0.s is the correct fix for this problem, not moving sections around in memory.
Please sign in to leave a comment.
Comments
4 comments