My application has an offset due to a bootloader and some configuration data that are located before the application address. When I debug the application without the bootloader I only have the offset of the configuration data which occupies one flash page (0x800) therefore the application is located at 0x08000800.
My linker script as well as my vector tab offset has been configured accordingly.
LD_DEVICE_SIZE = 512K;
LD_DEVICE_START = 0x08000000;
LD_BOOTLOADER_START = LD_DEVICE_START;
LD_BOOTLOADER_SIZE = 0x8000;
LD_MFG_DATA_START = LD_DEVICE_START;
LD_MFG_DATA_SIZE = 0x800;
LD_APP_START = LD_DEVICE_START + LD_MFG_DATA_SIZE;
LD_APP_SIZE = LD_DEVICE_SIZE - LD_MFG_DATA_SIZE;
LD_FLASH_START = LD_APP_START;
LD_FLASH_SIZE = LD_APP_SIZE;
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 160K
RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 32K
MFGDATA (rx) : ORIGIN = LD_MFG_DATA_START, LENGTH = LD_MFG_DATA_SIZE
FLASH (rx) : ORIGIN = LD_FLASH_START, LENGTH = LD_FLASH_SIZE
}
and
#ifdef DEBUG
#define VECT_TAB_BASE_ADDRESS FLASH_BASE
#define VECT_TAB_OFFSET LD_MFG_DATA_SIZE
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BASE
#define VECT_TAB_OFFSET LD_BOOTLOADER_SIZE + LD_MFG_DATA_SIZE
#endif
I'm unable to debug my application with this offset. I can enter debug mode but when I resume, the debugger terminates.
I was looking at "Startup" in the Debug Configuration and tried to change the "Set program counter" as well as the "Set vector table". But this also does not work. I'm also not certain if these values should be from 0x00000000 or 0x08000000.
How would I go about debugging an application at an offset?