Unable to debug application with offset

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to debug application with offset

Jump to solution
485 Views
bp1979
Contributor IV

Hi,

using imx rt 1024, for my position independent code experiment I am trying to debug my "offsetted" application, but gdb isn't loading the symbols.

What am I doing wrong?

bp1979_0-1651569283441.png

For background:

- my bootloader sits at 0x60000000

- app1 (not uploaded) normally sits at 0x60020000

- app2 is uploaded with above offsets of 0x10000

When I debug the app with above configuration, when I press suspend debugger I can analyze the memory. I can see that my app is properly uploaded to 0x6003000. But the debugger (gdb) is not able to locate the symbols

bp1979_1-1651569461045.png

 

(memory shows my app is in memory on desired offset location)

bp1979_2-1651569510969.png

PS: vector table and .got are both in sram. in my startup code I properly patch the ISR vector addresses, so that's not the problem. When I put a breakpoint in the first line of my ResetHandler, it doesn't hit. When I pause my application once started, it can't find symbols. 

Many thanks!

 

 

0 Kudos
1 Solution
412 Views
bp1979
Contributor IV

@kerryzhou 

Managed to get it working after all. Using gdb command `add-symbol-file <path-to-elf> <address-to-text-section> just before I jump from my bootloader to the relocated app fixed it.

Well, to be fair, I didn't test it in MCUxresso, I migrated my projects to VScode instead (compiling with CMake). But I am sure it works all the same in MCUxpresso

View solution in original post

3 Replies
431 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

   Which APP you want to debug now?

  Talk about my experience with the secondary bootloader+application debug.

  As you know, the application debug have the offset, and the code running normally determined by the boot entry point, and that is normally from ROM BOOT+secondary boot+ app.

  So, if I need to debug the application, I will download the secondary bootloader which can jump to the application at first, then the application will works.

  Another way, test the application without the offset at first, after the code function totally works, then I do the offset, and download to the related offset area, test the function directly when + bootloader.

  So, to your situation, I suggest you can try to test the application without offset and debug it, it will make things easy.

Best Regrads,

Kerry

0 Kudos
413 Views
bp1979
Contributor IV

@kerryzhou 

Managed to get it working after all. Using gdb command `add-symbol-file <path-to-elf> <address-to-text-section> just before I jump from my bootloader to the relocated app fixed it.

Well, to be fair, I didn't test it in MCUxresso, I migrated my projects to VScode instead (compiling with CMake). But I am sure it works all the same in MCUxpresso

463 Views
bp1979
Contributor IV

Dear nxp,

 

any solution for this? using an incredible cumbersome way to debug my position independent app this way.

0 Kudos