Monday, December 11th 2017, 5:53pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Date of registration: Jul 11th 2016

Posts: 4

1

Monday, July 11th 2016, 9:06pm

[SOLVED] How to use Ozone with J-Link LITE?

Hi,
I have a code that is written for nrf51422 (Nordic Bluetooth SoC - Cortex M0) and built it using GCC. I've just downloaded the latest Ozone (x64) v2.16d on Mac OSX and i have already installed J-Link tools (SEGGER J-Link Commander V5.12i) to use the debugger (J-Link LITE CortexM debugger). Program also uses RTT to write debug messages and viewed using RTT viewer.

I wanted to use Ozone debugger tool to debug. Using ozone tool, i can set breakpoint or step through assembler instructions not in my c source files.

1. Ozone project wizard asks to select a target device/speed and Program to be debugged. I have selected HEX of my program.
2. I clicked download and reset the program and the program starts to run.
3. Added a breakpoint in my code __asm("BKPT #01") when button is clicked.

I can only add a breakpoint in disassembly window on assembler instruction using ozone tool and breakpoint that i added using (__asm("BKPT #01") is reached by button press and Ozone tool doesn't show that in the line of source file. I opened the main.c and i selected a variable above the breakpoint by right clicking and added to watch window. It doesn't show the value when it reaches the breakpoint.

How to add all my c source files the ozone debugger and show the line in the source file when breakpoint is reached ???





AravinthPanch has attached the following image:
  • ozone-question.png

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

2

Tuesday, July 12th 2016, 9:11am

Hi,


Quoted

Ozone project wizard asks to select a target device/speed and Program to be debugged. I have selected HEX of my program.

You loaded a .hex file, which does not contain enough information to do this.
If you let gcc build an .elf file and load it with Ozone, it will load all source files automatically and you will be able to set breakpoints in your source files.

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Date of registration: Jul 11th 2016

Posts: 4

3

Wednesday, July 13th 2016, 4:28pm

Hi Niklas,
Thank you very much for your quick answer. I have loaded the *.elf / *.out file generated by arm-none-eabi-gcc and still it doesn't locate the source files. I have loaded *.axf file generated by Keil and Ozone loads all the source files and works pretty fine.

Using reading arm-none-eabi-readelf i have found out that *.elf / *.out files generated by arm-none-eabi-gcc do not contain the source file locations. I have tried to compile the code with zero level optimisation and -g3 flags to have all the information in the file and still no success.

.axf file generated by KEIL -> 00000000 0 FILE LOCAL DEFAULT ABS src\driver\button.c

.elf file generated by GCC -> 00000000 0 FILE LOCAL DEFAULT ABS

Please let me know if there is any specific flag that should be added to arm-none-eabi-gcc compiler to have the source file location in ELF. Thanks once again for your support.


SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

4

Wednesday, July 13th 2016, 4:41pm

Hi,

could you post your command line for gcc?

EDIT: Without knowing your commandline: It should contain sth. like -Og -g or -O0 -g .
It should not contain any option that removes information from the binary, like strip-symbols.

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Date of registration: Jul 11th 2016

Posts: 4

5

Friday, July 15th 2016, 3:55pm

Hello Niklas,

Thanks for your hints. I removed these flags CFLAGS += -flto -fno-builtin from nrf51 Makefile from Nordic and source file locations are added to the ELF file. I have tested it with Ozone and very much impressed with the tool.


I sincerely thank Segger for making many cross-compatible debugging tools such as RTT, System View, Ozone, so that Embedded System Engineers and Companies can definitely choose Segger hardware over other debugging hardwares in the market. :thumbup:


Thank you Niklas very much for your quick support and clear solutions. :thumbsup:


Best regards,
Aravinth