How to debug source code with S32DS

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

How to debug source code with S32DS

3,707 Views
christianing
Contributor I

Hi,

I want to debug my source code with S32 Design Studio. I already setup a project with my own build configuration using DIAB compiler for MPC5604P. I'm also able to start a debug session with the eval board TRK-MPC5604P and the board does, what I expected. But breakpoints are not reached and when I stop execution I can only see the disassembly and not the C code. I guess it is a missing compiler option or path setting, but I did not find anything what could help. Can you give me some ideas what I could check to be able to debug source code?

Regards, Christian

0 Kudos
10 Replies

3,207 Views
christianing
Contributor I

Hi,

I'm back from vacation, but problem is the same. I checked the out file - it is ELF format. But even after renaming debugging is not possible with this file. When I choose it and halt the debugger, I see multiple messages "Error : Error in ONCE status register during instruction execution." No disassembly is shown in that case and even the board seems not to be working. With HEX binary the code is executed and on halt the disassembly is shown. So it seems to be a problem with ELF file.

Christian

0 Kudos

3,207 Views
acosmith
Contributor I

I know this is an old question, but I was looking for something else and came across this thread....

>Error : Error in ONCE status register during instruction execution."

This implies the MCU reset prior to when you halted. That's probably not what you intended. Most common cause of that in my experience on a dev board when you're trying to hack something together is attempting to access a peripheral that has not had a clock provided for it.

Good luck.

0 Kudos

3,208 Views
christianing
Contributor I

The -g option is already set. Is there any further option which has to be set? Does -o define the elf output file?

0 Kudos

3,208 Views
jiri_kral
NXP Employee
NXP Employee

the -o option just specify the output name. Please check your .dld file. More details about diab linker file is here: 

The dld Command - 

Your .out file is probably .elf file. Just check the file header in some text editor. Should start with .ELF like this one:

pastedImage_3.png

You can also try to rename the .out file to .elf file - if it is elf file format. 

Jiri 

0 Kudos

3,208 Views
christianing
Contributor I

Ok, I checked my debug settings and recognized that I had chosen the hex output file for debugging. With this file functionality is there, suspend and resume works, but debugging is not possible. But if I'm chosing the out file (two times bigger, with -Xelf option) for debugging, even functionality is not there and resume does not work. I guess it's a format problem. I'm even wondering, that there is no .elf file as I know this from older projects with another tool chain.

I set the -Xelf linker option, so I would expect that output should be in the right format. Is there somebody who is able to successfully debug with GDB and DIAB?

0 Kudos

3,208 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

well, for debugging you need to use output with symbols and so on. The .elf with debug info is the right source for debugging. For diab use -g option ( the same as for gcc).

Here is more info about diab compiler/lilnker options: 

https://www.embedded-tools.de/sites/default/files/pdf/wr_diab_compiler_options_reference_5.9.3-R2.pd... 

Jiri

0 Kudos

3,208 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can specify path to sources in debug session configuration (normally are paths to sources stored in elf file (when compiled with debug flag): 

pastedImage_1.png

There also may be incompatibility between DIAB elf output and GNU gdb server used in S32DS. So, better place for  question related to DIAB and GNU gdb compatibility is Windriver support. 

Jiri 

0 Kudos

3,208 Views
christianing
Contributor I

The breakpoint is definitly passed, since a LED is enabled and I set the breakpoint at this position.

I guess the problem is, that the source code is not assigned to the execution address. Maybe any compiler flag is missing to add debug information to binary. Or I'm using the wrong binary fromat. But everything I tried to change had no effect.

0 Kudos

3,208 Views
MPC8313ERDB_h
Contributor III

one possible solution is to use h/w breakpoint (assuming the interested module runs from RAM).

Are you sure the break point should be hit (that is placed in the execution path). Try to set breakpoint right after main to verify.

David

0 Kudos

2,643 Views
bingwang312
Contributor III

Error : Error in ONCE status register during instruction execution.",  i am also suffering on this issue. somebody said it might be the shift freqency problem, it is the communication speed between debugger and software, by default it is 5000khz which might be too high for some chips. 

I checked debug configuration, the communication speed is 5000khz, it is gray color , how to change this speed lower ?

0 Kudos