Application does not start - Flash changed to 0x8020000 and VECT_TAB_OFFSET changed to 0x20000
Hello,
I created a bootloader and the two applications according to the YouTube tutorial (https://www.youtube.com/watch?v=OkUQ3iMmiYQ&list=PLnMKNibPkDnEb1sphpdFJ3bR9dNy7S6mO&index=1). This works so far.
The application is started by the bootloader using the go2APP() function.
void go2APP(void)
{
uint32_t JumpAddress;
pFunction Jump_To_Application;
//check if there is something "installed" in the app FLASH region
if (((*(uint32_t*) FLASH_APP2_ADDR) & 0x2FFE0000) == 0x20000000)
{
HAL_Delay(100);
//jump to the application
JumpAddress = *(uint32_t *) (FLASH_APP2_ADDR + 4); // Original
Jump_To_Application = (pFunction) JumpAddress;
//initialize application's stack pointer
__set_MSP(*(uint32_t *) FLASH_APP2_ADDR);
Jump_To_Application();
}
else if (((*(uint32_t*) FLASH_APP1_ADDR) & 0x2FFE0000) == 0x20000000)
{
HAL_Delay(100);
//jump to the application
JumpAddress = *(uint32_t *) (FLASH_APP1_ADDR + 4);
Jump_To_Application = (pFunction) JumpAddress;
//initialize application's stack pointer
__set_MSP(*(uint32_t *) FLASH_APP1_ADDR);
Jump_To_Application();
}
else
{
..
}
}
The linker script of the application:
/* Specify the memory areas */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x8020000, LENGTH = 96K
}
/* Define output sections */
SECTIONS
{
.myBufBlockRAM 0x20000100 :
{
KEEP(*(.myBufSectionRAM))
} > RAM
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
I don't need the section in RAM and remove the block myBufBlockRAM.
In main.c I also remove the variable that was mapped to this area in RAM.
uint8_t __attribute__((section(".myBufSectionRAM"))) buf_ram[128] = {42};
Now the application no longer starts via the bootloader.
What could be the reason?
What I also don't understand is why +4 is added to the application on the jump?
JumpAddress = *(uint32_t *) (FLASH_APP1_ADDR + 4);
Thanks in advance.
- Martin
