2014-03-13 08:18 AM
Hi guys,
I've been working on a bootloader program which is loosely based around the FW_Upgrade demo for the STM32F4 discovery board. My Bootloader so far correctly finds a file on a USB stick and downloads it to flash in the right location(0x0800C000), but I'm having issues jumping to that location to run my downloaded program once I'm done putting it in flash. The demo from ST has the MCU reset after it has downloaded to flash and then jumps to the program. Is the reset necessary or can I just jump straight to the location in flash? Also, how do I actually do the jump. I'm using the code from st which looks like this, but it doesn't seem to work:/* Check Vector Table: Test if user code is programmed starting from address
''APPLICATION_ADDRESS'' */
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
Jump_To_Application();
}
2014-05-15 07:50 AM
2014-05-15 07:53 AM
Actually the address is 0x08004000
2014-05-15 08:06 AM
Ok, but the origin of this app code you're quoting isn't 0x08004000 or 0x08008000, so either you are looking at the wrong code (ie the boot loader, not the app) or Atollic is bollixing up the build. You should look at the .MAP and confirm what the linker thinks it's doing, and then verify that you are looking at the right .HEX/.BIN
2014-05-15 08:09 AM
Please observe that editing your posts will break the time line of the thread, questions/answers might appear out of sequence for the preceding posts.
2014-05-15 08:11 AM
2014-05-15 08:19 AM
Thank you for your help until now.
I found that the tool uses a different script. I modified the good one and now I can see the correct addresses on the .map files. Memory Configuration Name Origin Length Attributes flash 0x08004000 0x000fc000 xr sram 0x20000000 0x0001c000 xrw *default* 0x00000000 0xffffffff Linker script and memory map Also, when I write the data in little-endian, the verification is ok. if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)'' I'll test again.