Dave 4 - XMC4500 debug from program with offset

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
pear_4623441
Level 1
Level 1
Dear All,

I want to debug a Dave project to be downloaded with offset to the FLASH start. I.e., in XCM4500 the start address is 0x0C000000 and I want the application to be downloaded (and debugged) at 0x0C020000.

On the project settings -> C/C++ Build -> Memory Settings, I have changed FLASH 1 (cached) to 0x08020000 and FLASH 1 (uncached) to 0x0C020000.

linker_script.ld file updates to this values:

MEMORY
{
FLASH_1_cached(RX) : ORIGIN = 0x08020000, LENGTH = 0xe0000
FLASH_1_uncached(RX) : ORIGIN = 0x0C020000, LENGTH = 0xe0000
PSRAM_1(!RX) : ORIGIN = 0x10000000, LENGTH = 0x10000
DSRAM_1_system(!RX) : ORIGIN = 0x20000000, LENGTH = 0x10000
DSRAM_2_comm(!RX) : ORIGIN = 0x30000000, LENGTH = 0x8000
}

After download of the program, the debugger doesn't stop at beggining of main as usual, and starts running right away. If I pause the program, the pc is at 0x8000696... Shouldn't it be at a value bigger than 0x8020000?

Doing the same procedure in DAVE3 works perfectly fine. Where am I going wrong?

Best Regards,
0 Likes
2 Replies
User10538
Level 3
Level 3
Just changing this in the linker is not enough because the program execution starts always at 0x8000000 (which is the cached adress of 0x0C000000 )
Read up on the Bootloader topics here in the forum and use something like the ABM0 Mode.

How to debug such a relocated coded would be interessting for me too. I develop and debug it at 0x8000000 and just link it later to 0x08020000.
0 Likes
pear_4623441
Level 1
Level 1
Hello andyl,

Exactly. This user code at 0x0C020000 is used with a bootloader at 0x0C000000. I found I can debug the application at 0x0C020000 if I make the bootloader jump to 0x0C020000.

I.e.,
- I click debug with the project at 0x0C020000.
- The processor automatically starts running the bootloader.
- The bootloader jumps to 0x0C020000 app.
- The "main" breakpoint is reached. I can debug the usual way.

Like you said, the execution starts at 0x8000000 which explains this behaviour.
However, in Dave3, it was possible to debug directly an application at 0x0C020000, so there must be some kind of configuration / flag to set it that way, right?

I tried the "Set program counter at (hex)" option in the Debug configurations -> GDB Segger -> Startup tab, but wasn't successful.

I'll post it if I find out.
0 Likes