Ozone can not debug a multiple ELF project

Hi,

I develop firmware for nRF5340 in VS Code with Nordic toolchain (1.9.1) and NRF connect addon.

Project generates multiple elf files and it seems like only zephyr\zephyr.elf can be loaded trough Ozone. 

This problem occurs when using "Download and reset program". Ozone does not display any critical errors - it just cant run to a breakpoint set in the code.

Important note: 

When using Flash option from within VS Code  NRF connect addon (based on west flash command) and later attaching Ozone to a running program, everything works fine. 

How to resolve problem?  How to be able to flash trough Ozone and maintain debugging capabilities? 

  • Hi,

    I have contacted experts regarding this and will get back to you soon.

    Best Regards,

    Priyanka

  • Hi,

    I have heard back form them. They said that the extension communicates with Ozone through the ozone project file "ozone.jdebug" in the build directory. You can add custom behavior to this (making it flash other binaries, for instance), but vscode will overwrite the contents of this file on every run, so you'll need to save the changes in a different file to avoid it being overwritten later. This can be achieved by adding this snippet in the project file to overwrite which file is flashed:

    void TargetDownload(void) {
        Target.LoadMemory("/path/to/hex/file.hex", 0);
    }

    Further info is available in the Ozone user manual. We'll also try to add this behavior to VS Code too.
    -Priyanka
  • Thank you for quick answer - your solution worked perfectly. If anyone else encounter similar problem, here is the code from ozone.jdebug:

    // This file will be overwritten on each session.
    // Any manual changes made to this file will be lost.
    
    void TargetDownload(void) {
        Target.LoadMemory("c:\........\build\zephyr\merged_domains.hex", 0);
    }
    
    void OnProjectLoad (void) {
        Project.SetDevice ("nRF5340_xxAA_APP");
        Project.SetHostIF ("USB", "51016119");
        Project.SetTargetIF ("SWD");
        Project.SetTIFSpeed ("4 MHz");
        Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd");
        Project.AddSvdFile ("c:\ncs\v1.9.1\modules\hal\nordic\nrfx\mdk\nrf5340_application.svd");
        Project.SetOSPlugin ("ZephyrPlugin.js");
    
        File.Open ("c:\.......\build\zephyr\zephyr.elf");
        Window.Show ("Zephyr");
    }
    
    
    
    
      

Related