cancel
Showing results for 
Search instead for 
Did you mean: 

Flash to RAM -reg

umamahesh
Associate II
Posted on October 21, 2014 at 08:49

Hi,

I have couple binaries packed as one Intel hex format and flashed using KEIL. Bootrom and application are placed at 0x08000000 and 0x081C00000 respectively in STM32F427. My bootrom will copy the application code from flash to RAM and verifies CRC. If CRC fails it jumps to bootrom main(). I have verified that it is copying to RAM from flash and CRC is also correct. how will I jump to application start address so that application main() executes and bypassing bootrom's main(). Both bootrom and application uses same start_xxx.s file. Can anyone give me pointers how to jump to application main(). I tried modifying SCB->VCTR to jump to application but it failed.

#st #keil
3 REPLIES 3
Posted on October 21, 2014 at 10:01

I think you need to understand that you can't just jump to main(), the C runtime environment (stack, statics, etc) need to be initialized first, and this is what __main does in Keil and _cstartup (sic) in IAR

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Help%20with%20application%20jump%20to%20system%20memory%20boot&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD0...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
umamahesh
Associate II
Posted on October 21, 2014 at 16:43

Hi Clive,

Thanks for the reply. I referred to your link, trying to understand whether that part of assembly code just points to RAM location or copies the flash contents to RAM too. Since I have part of code copying flash to RAM done in 'C' and validating with CRC. Trying to link these two modules. Another thing to understand what are trying to invalidate in these two following lines

 LDR R2, [R0, #0]

STR R0, [R0, #0] ; Invalidate

Posted on October 21, 2014 at 17:55

The SRAM based magic number constant I'm using to direct/control the boot execution path.

The value is first loaded into the R2 register, then the value in the SRAM is destroyed.

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