Reply
Posts: 13
Registered: ‎03-20-2013

[Simplicity studio] Force start PC in Debug Mode

Hello,

 

I'm using Eclipse from a while to develop and debug ARM applications.

I try to export my EFM32 projects from Eclipse/Codesoucery/GDB environment to Simplicity Studio IDE.

 

It seems working quite well for compiling but I don't find how to force the start PC register at Debug startup.

Indeed, my "firmware" is splitted into a bootloader and an application and I need to execute bootloader initializations before running main function of my application.

 

My application binary is compiled and linked to start at 0x10000 and to debug it, I need to tell to the SWD Debugger to first execute from 0x0 and then break in main function (after bootloader has jumped to application).

 

Is there a way to doing some actions before debugging (something like .gdbinit) ?

 

Thanks,

 

Martin

Highlighted
Posts: 22
Registered: ‎01-21-2015

Re: [Simplicity studio] Force start PC in Debug Mode

Hey Martin:

 

For debugging purposes it's not necessary to run the bootloader before starting application code. To be honest, I don't know what would even happen if you tried to launch a debug session on your application code but first ran through a bootloader. The app code doesn't "know" what's going on in the memory space before it's start location (0x10000 in your case), so I imagine the MCU would hard-fault, as the bootloader exists outside the memory region allocated to the application... Like I said, I don't actually know what would happen I've never tried this before.

 

However, as long as the default flash address in your application code is set appropriately, you can debug this code in the memory location where it will ultimately be programmed into on the chip. The bootloader code will be skipped, and the app code will launch in the debugging session.

 

Also, please note that overwriting the flash origin and offset in the .ld file (in your application code project) does not change the starting flash address. This is overwritten by the project settings every time the project is re-compiled. Changing the project settings is the correct way to set the flash origin, and this can be done in the "project properties" window through C/C++ Build->settings->memory layout (see attached capture for the location of this setting).