SD-Card update wir STM32H747-EVAL jumping to Application Problem
Hello all,
this is my first post in this forum.
I am in the process of developing my own bootloader for a firmware upgrade via SD card with the Eval board STMH757I.
So far so good, with the help of the FirmwareUpgradeStandalone example, I was able to get the whole thing working so far that I can flash a bin file and also find it at the appropriate
place in the flash (0x08020000) checked with CubeProgrammer.
If I run through the whole process with the bin file from the supplied FirmwareUpgradeStandalone example, everything works perfectly.
It can be flashed with my bootloader and after flashing is done i perform a reset and the flashed application (firmware upgrade sample) runs as expected.
However, if I now write my own Application and build a bin-File, which does not do much more than make 3 LEDs flash one after the other, the procedure no longer works.
I create the bin file as post build output in CubdeIDE.
With my own bin-File i can see that the bin file has been installed in the memory via SD-Card. But when i press the Resetbutton after flashing is done, the flashed programme doesn't start.
But if I do a relaunch in debug mode, the Application runs as desired. When I press the reset button (while in debug mode), it also starts the application (3 LEDS blinky) again.
So I would say that jumping into the app and flashing it works in some way.
The whole thing is very confusing because the procedure works fine with the bin file from STM and not with my bin file. A main difference in the bin-Files is the value at the start
stm bin-File starts with 0x2000000
my bin-File starts with 0x24080000
for this reason i also had to adjust the if-query so that my bootloader jumps to the desired address at all.
if ((((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000) == 0x24080000) || ((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000) == 0x20000000)
I have set the vector table offset (0x20000) and the FLASH origin (0x08020000) in the linker file and in the system file. I tried to switch off the interrupts before the jump without success.
This is the jump code (taken form FirmwareUpgradeStandalone-Example)
if(HAL_GPIO_ReadPin(BUTTON_TAMPER_GPIO_Port, BUTTON_TAMPER_Pin) == GPIO_PIN_SET)
{
/* Check Vector Table: Test if user code is programmed starting from address
"APPLICATION_ADDRESS" */
if ((((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000) == 0x24080000) || ((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
// Tried to set Vecortable here, no effect
//SCB->VTOR = APPLICATION_ADDRESS;
Jump_To_Application();
}
}
My question is: what else can I do? What is the difference between a reset (RSTN button on the EVAL board) and a relaunch in debug mode?
What else do I have to consider in my application so that the programme runs after flashing? Do the problems occur because it is a dual-core? Do I have to change anything in the startup file?
I have spent 2 days trying to find a solution to this problem, unfortunately I have not found a similar problem in this forum or anywhere else.
Thanks a lot
