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

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [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 ???





    Images
    • ozone-question.png

      394.24 kB, 1,706×1,061, viewed 459 times
  • Hi,


    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
  • 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.

  • 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
  • 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