Compile and Debug my application starting from a specific address with MCUXpresso IDE

cancel
Showing results for 
Search instead for 
Did you mean: 

Compile and Debug my application starting from a specific address with MCUXpresso IDE

258 Views
giovannicastro
Contributor II

I'd like to compile my application (to flash onto my board) starting from a specific address, for example 0xFF00 of my flash memory.

Then, I'd like debug my application, so, I should start my debug session from address 0xFF00 of my flash memory. How is it possible to do this two things in MCUXpresso IDE v11.2.1? All the others memory zones are automatically mapped based on my "offset"?

After the build, when the code is on the board, is possible to say the start and the final address of the application?

7 Replies

246 Views
ErichS
Senior Contributor II

Hi @giovannicastro ,

there are two parts:

a) basically you need to do this in the linker file and tell the linker to map the application to a specific address, e.g. Linking Bootloader Applications with Eclipse and FreeMarker Scripts | MCU on Eclipse

The other option would be to use relocatable offsets which is more flexible but more complex.

b) to debug it it you can tell the debugger where the application is loaded and provide access to the symbols: https://mcuoneclipse.com/2020/11/03/debugging-bootloader-and-application-with-one-debug-session/

I hope this helps,

Erich

230 Views
giovannicastro
Contributor II

Hi @ErichS,
thanks for your time!

"you can tell the debugger where the application is loaded". To do this i have to go on my "Debug configurations", select the correct "Debugging Interface" and on the "Startup" menu in "Executable offset (hex):" write, for example, 0xFF00?

0 Kudos

226 Views
ErichS
Senior Contributor II

Hi @giovannicastro ,

typically you want the linker tell in which address space things are allocated. It means that that the addresses are absolute. So it is the linker which defines where the application is.

When you load the application with a bootloader, you have to tell the debugger which symbols he has to use. You only have to tell the debugger where it has to load the binary if you are using a .bin file. ELF/Dwarf, S19, Intel hex all have the address information already in it.

I hope this helps,

Erich

222 Views
giovannicastro
Contributor II

Hi @ErichS,

but when my bootloader starts (and I set "Attach to Running Target" in my Debug Configurations) is possible to detect the start address of my application automatically in run time? Because, otherwise, I have to give the address of the application to the bootloader to get it started or not?

0 Kudos

219 Views
ErichS
Senior Contributor II

Hi @giovannicastro ,

The bootloader knows about the start address of your application.

The S19 and ELF/Dwarf contain an ENTRY address, but this is only use by the debugger to show the corresponding source file and has otherwise no purpose.

 

Erich

0 Kudos

248 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello giovannicastro,

" compile my application (to flash onto my board) starting from a specific address, for example 0xFF00 of my flash memory."

->> Please see my attachment, I take a video for you.

 

Regards,

Alice

236 Views
giovannicastro
Contributor II

Hi @Alice_Yang,
thanks for your time!

I tried to do what you show me in the video and yes, my application builds without any problems.

But, when I debug it onto my board i received a SIGTRAP and the debug session failed. This (I think) because I haven't configure my "Debug Configurations" in a way that they started form my specific address. Is correct? If yes, how I can do this?

0 Kudos