cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 F0 Reset Handler code question

Charles Miller
Associate III
Posted on January 25, 2016 at 17:53

In the startup_stm32f0xx.s files, at the start of the Reset_Handler procedure, the following code occurs:


;;Check if boot space corresponds to test memory 


LDR R0,=0x00000004

LDR R1, [R0]

LSRS R1, R1, #24

LDR R2,=0x1F

CMP R1, R2


BNE ApplicationStart 

If the reset vector (address at 0x08000004) lives in the 0x08xxxxxx (flash) or 0x20xxxxxx (RAM), then the CMP R1,R2/BNE ApplicationStart jumps over the clock setup and CFGR1 register setup. From here, I'm confused. Why would someone build an image with the reset vector in 0x1Fxxxxxxxx memory space? I'm not sure what the comment,

Check if boot space corresponds to test memory

is saying. Does this have to do with the internal bootloader living at 0x1FFFF004? One would not put a reset vector there, would one? Thanks for any clarification as to what the code is doing!
1 REPLY 1
Posted on January 25, 2016 at 18:13

Depending on the state of the BOOTx pins either the ROM, FLASH, or RAM is mapped at ZERO.

This code would tell you if you EXEC'd into the Application from the ROM System Loader, or if the debugger got you to this point despite the BOOTx settings.

The Application would want to map itself at ZERO, or map the RAM there and copy the vector table if the Application isn't at the base of FLASH.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..