STM32G0 Crash when changing bootloader and application adress
I am trying to jump from bootloader to application at address 0x08004800 i STM32G070 but it crashes.
The same code worked fine jumping to address 0x08007000
Bootloader jump looks like this:
#define BL_FLASH_START 0x08000000
#define BL_FLASH_SIZE 0x4800 // 18 kB reserverade för BL, OBS! Startadress måste vara alignad mot 32 byte, dvs jämnt delbar med 32..
#define BL_FLASH_END (BL_FLASH_START + BL_FLASH_SIZE-4) // 4 byte checksumma
#define APP_FLASH_BANK_SIZE 0xDC00 // 55 kB / appl bank
// Defines för applikationen
#define FLASH_START (BL_FLASH_START + BL_FLASH_SIZE)
.
.
.
.
HW_WD_Trig();
JumpAddress = *(uint32_t*) (FLASH_START + 4);
Jump_To_Application = (pFunction) JumpAddress;
// disable global interrupt
__disable_irq();
JumpAddress = *(uint32_t*) (FLASH_START + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(uint32_t*) (FLASH_START));
Jump_To_Application();
.ld for bor bootloader looks like:
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = 0x20004000; /* end of 16K RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0x800; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 18K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K /* Reservera 16 kB for data after reset 32K 36K*/
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
}
and .ld for application looks like
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = 0x20004000; /* end of 16 K RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0xBB8; /*0x900; /*required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08004800, LENGTH = 55K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K /*32K Rensas vid uppstart 36K*/
RAM2 (xrw) : ORIGIN = 0x20004000, LENGTH = 16K /* Rensas inte vid uppstart */
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
}
Is there are another restriction than startadress must be dividable by 32 for jump to work?
