[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 1,338 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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