Stack pointer value at boot time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-31 3:30 AM
I was not involved in ST MCUs (STM32F769 specifically) until now. I understood that CPU gets stack pointer at start, from address 0, but what there exists is RAM - which is undefined after power up. Then, how can I force some "reasonable" SP value in custom bootloader (eg. from ITCM RAM) ?
- Labels:
-
Documentation
-
STM32F7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-31 3:41 AM
The initial value for SP in vector table goes hand-in-hand with the first address which is executed, so by ensuring there's sane code to be executed from start, you also ensure that there's a sane value for SP.
> I understood that CPU gets stack pointer at start, from address 0,
This is not the case with the 'F76x, read Boot configuration chapter in RM0410.
> but what there exists is RAM - which is undefined after power up
The default setting of BOOT_ADDx point to either FLASH or the system memory (ROM with the factory bootloader). While you can change to point it to RAM, it's anticipated you'll do it only if *you* make sure the RAM's content is always well-defined, eg. in an always-powered (by battery) system.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-31 4:08 AM
I've already red chapter you've mentioned, few times, but noticed nothing of stack pointer start value (in RM0410). Unless it's implied that is expected to be at the beginning of boot region. Or am I missed something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-31 5:19 AM
Well, it's not explicitly said there, that's true, but I'd expect the boot address to point at the vector table, which contains the stack pointer start value.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-31 9:06 AM
Seems so, although for newbies in ST world (like myself) it would be beneficial to emphasize such conclusion/statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-31 10:49 AM
The documentation leaves a lot to be desired.
You are supposed to click in CubeMX instead of asking questions on technical details.
Welcome to 21th century ;)
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-01 9:26 AM
The stack is usuallly defined in the linker description (.ld) file. The STM generated startup code overwrites the hardware fetched SP at the very beginning of the ResetHandler.
