cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while jumping from internal ST bootloader to User bootloader at

Harshavardhan
Associate II

So here is what I am doing, I am using IAR Systems to build my code and generate .s19 file and using an in-house tool to load the .s19 to device (STM32F469IG), after the download is complete the tool sends Jump command or “Go command” (0x21 0xDE) to which the device is sending ACK 0x79 and the tool sends the address 0x08000000  where the vector table is located, to which the device is also sending an ACK 0x79 but the Jump from internal bootloader to user bootloader is not happening. I have verified it multiple times using J-Mem if the memory is written properly and the address locations are correct, I do not see any issue there. I also tried downloading the same .s19 file using “ST Flash Loader Demonstrator” and it works properly, only difference is the ST Flash Loader does not send the “Go command” after download, we had to turn off the BOOT switch and power cycle the device after which the user bootloader worked without any issue. I tried debugging using IAR when the jump doesn’t work and found out none of the System registers are getting initialized to any value despite having a vector table in the correct location and receiving the “Go command” after download. Later when I turn off the BOOT switch and power cycle it gives me an exception, but the memory where the vector table is located is still showing the right values(same values when it is working). I am wondering how the internal bootloader is not jumping to the vector table address location despite getting proper address, what can cause this scenario? Is there anything I am missing which needs to be taken care of before download? or in the user code? I believe there is no issue with the user code because the same .s19 works fine when I use J-Flash Lite, or ST Flash Loader, or convert it to .dfu and use USB communication to download, I am seeing the issue only with UART download. Anybody has any idea on what might be happening?

2 REPLIES 2
tjaekel
Lead

Hard to understand what you try to describe... (without any code examples.

Just my five cents to throw in here:

  • yes, the vector table starts, for instance, at 0x0800000 (but can be anywhere else, esp. if using a bootloader)
  • the first entry is the SP value (the address where the SP register should start at)
  • the second entry (4 bytes later) is the ADDRESS of the Reset_Handler:

So, in order to jump to the "original" Reset_Handler function (!) you have to do this:

  • go to the Vector Table, e.g. address 0x08000000
  • read the SECOND word in this table, as a 32bit word
  • use this read value as an address and jump to it

It means: you cannot jump to address 0x08000004 - it is NOT code! It stores an address as a value, and when you have read this value - now you can jump to this "value".

The vector table on Cortex-M processors does not contain code - just values (addresses). And just the second word is an entry address (but also not executable code).

Hello,

I haven't attached any code examples because the same .s19 file when loaded using ST Flash Loader or J-Flash worked, Only when i use a UART communication with our in-house tool to download the code it is unable to jump to the vector table location, so I thought it has nothing to do with the code but the jump from internal bootloader to user code. 

I have attached 2 images below:

1] Working condition where i have loaded the user code using ST Flash Loader tool and UART communication 

Harshavardhan_1-1711175763678.png

And after loading i do a "Debug without downloading" on my IAR tool, which helps debug the code which is already present in the flash

2] Non-working condition where i have loaded the user code using an in-house tool using UART communication

Harshavardhan_0-1711174653964.png

I do the same steps here after downloading the .s19 file and as we can see here the address location 0x08000000 has SP value (same as first image, where it is working fine), and the reset handler after 4 bytes. But the control is not jumping to main. Also if you see on the right side none of the Registers are getting initialized to any value.

Additional to the ST Flash Loader commands I am sending a "Go command" and the address location as 0x08000000 from the in-house tool after download is complete, but it is not able to jump to the specified location.