2021-02-24 06:33 AM
I'm using a STM32F401RE and developing on STM32CubeIDE.
Since I have a Bootloader on address 0x08000000 and I had to move the Application to 0x0800C000 by changer the linker file:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
/* FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 208K */
FLASH (rx) : ORIGIN = 0x0800C000, LENGTH = 208K
}
Now when I try to run the Application under STM32CubeIDE it crashes which seems obvious since the Debugger needs the VTOR properly initialised.
I have commented the line in SystemInit() that initialises the VTOR.
void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
/* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
// SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
}
I hoped that in Debug Configurations | Startup | Specify Vector Table (hex) I could just write 0x0800C000 and the VTOR would be initialised by the Debugger...
But doesn't seem to be the case! After download and with a breakpoint in the Reset_Handler I can see the VTOR as 0.
Does anyone know how to change the address of the Application to a different than 0x08000000 and still being able to Debug.
thanks