HOWTO: Debug multiple elf files in S32 Design Studio with GDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HOWTO: Debug multiple elf files in S32 Design Studio with GDB

No ratings

HOWTO: Debug multiple elf files in S32 Design Studio with GDB

There are situations that require debugging multiple executable files within one debug session.

Typical example is debugging the bootloader + application together where each one is a separate executable elf file or S32DS eclipse project.

S32DS project loads the debug information of the generated executable file by default. Anyway GDB supports command to add additional elf files debug information into same debug session. If the executable source files are present on the same machine then the source level debugging of all the elf files is possible.

Let's assume there are two elf files (bootloader and application) and both are built with debug information enabled - build configuration is named "Debug".

Generation of the debug information for GCC compiler could be set in the Project Properties -> C/C++ Build -> Settings -> Standard  S32DS C Compiler -> Debug Level 

pastedImage_2.png

Each debug configuration in S32 Design Studio supports loading or ignoring debug information.

"Load symbols" loads just the debug information whereas "Load executable" basically loads program/code/data sections into MCU memory without debug information. Both options are enabled by default.

pastedImage_4.png

Before starting the debugger it's necessary to load both executable files into your MCU memory. This could be easily achieved in S32DS (GDB) debug configuration where you specify to add the additional object files.

In this specific case we need just 1 additional file - bootloader elf. The bootloader project in this example is actually another project in the same workspace (workspace relative path to elf file entered).

pastedImage_2.png

After starting debugger the Debugger Console view now shows the details about programming of two elf files instead of one including load address of each section.

pastedImage_4.png

When loading is finished the debug information for bootloader is not yet available ("No source available..." message displayed in the source level debug view)

pastedImage_7.png

In order to display source and symbols for the bootloader elf please enter "add-symbol-file"  GDB command into Debugger Console View:

add-symbol-file "C:/Users/NXA21306/workspaceS32DS.ARM.2018.R1/s32K144_Bootloader/Debug/s32K144_Bootloader.elf" 0x0000000‍‍‍‍

The GDB client command could be executed automatically when launching a debug session:

pastedImage_2.png

The first argument is path to the elf file and the second argument (0x00000000) is the load address of the elf file (see the first bootloader load address ).

pastedImage_17.png

pastedImage_15.png

Finally the debug session needs to be refreshed in order to display changes from just added symbol file. The refresh can be forced by performing a single step or issuing the target reset from the debugger.

pastedImage_16.png

Labels (1)
Comments

Hello Stanislav,

I really like your manual. Unfortunately I have to use a SEGGER J-link.

Can you provide a tutorial how to achieve the same result with a J-link debugger? I don't get the point where I can load the second .elf file...

Best regards,

Markus

In the step where you type GDB run commands, is possible that you have to type double bar (//) instead one /.

Version history
Last update:
‎09-10-2020 02:50 AM
Updated by: