[ABANDONED] nRF9161 debugging with Ozone

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

  • [ABANDONED] nRF9161 debugging with Ozone

    Hi,

    I'm developing software for Nordic nRF9161 and using Ozone for debugging. I use Nordics nRF Connect for VS Code to write the code and launch the debugging from VS code with Debug with Ozone button.

    Previously when using nRF9160 using "Program & Reset Program" and "Attach to Running Program" worked just fine. Now when using nRF9161 the "Program & Reset Program" fails with this error message

    Source Code

    1. Failed to verify @ address 0x00FF8108
    2. Download failed: error during verification phase
    When selecting nRF9160 under "Tools->J-Link Settings" it works just fine (even when using nRF9161 as hardware).

    Main reason why I'm using Ozone for debugging is that we are using secure bootloaders which write to OTP memory area and with Ozone I was able to debug the code without trying to rewrite the OTP area (This was problem when trying to debug using nRF Connect for VS Code and not Ozone).
  • Hi,
    After having started Ozone via the "Debug with Ozone" button, do you save the Ozone project file or do you always discard the Ozone project when closing Ozone? Could you please try to set-up your project via the Ozone new project wizard, save the project file and then use that project file all the time afterwards?
    Best regards-- AlexD
    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.
  • I tried to create project trough new project wizard. I got an Cortex-M BusFault Exception error.
    Cortex-M BusFault Exception.

    Source Code

    1. The target stopped in BusFault exception state.
    2. Reason: Unknown at 0x00035012.
    3. For more information about analyzing faults on Cortex-M, refer to:
    4. https://wiki.segger.com/Cortex-M_Fault.

    Console output

    Brainfuck Source Code

    1. Disabled output of control characters
    2. SEGGER Ozone - The J-Link Debugger V3.30a
    3. J-Link software found at: C:/Program Files/SEGGER/Ozone/JLink_x64.dll
    4. File.NewProjectWizard();
    5. Target core support plugin loaded.: C:/Program Files/SEGGER/Ozone/Plugins/Core/CorePluginARM.dll
    6. Project.SetDevice ("nRF9161_xxCA");
    7. Project.SetHostIF ("IP", "10.184.80.105");
    8. Project.SetTargetIF ("SWD");
    9. Project.SetTIFSpeed ("4 MHz");
    10. Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M33F.svd");
    11. File path resolved: "$(InstallDir)/Config/CPU/Cortex-M33F.svd" was found at "C:/Program Files/SEGGER/Ozone/Config/CPU/Cortex-M33F.svd"
    12. File.Open ("C:/sworkspace/s_app/app/build/zephyr/zephyr.elf");
    13. File.Open: completed in 322 ms
    14. Program segments:
    15. Address Size Code RO Data RW Data ZI Data Flg
    16. --------- --------- --------- --------- --------- --------- ---
    17. 0004ABB4 0 0 0 0 0 R
    18. 00030000 130 064 109 488 920 19 656 0 RWE
    19. 2000C568 24 0 0 24 0 RW
    20. 2000C580 3 200 0 136 3 064 0 RW
    21. 000508B0 84 0 20 64 0 RW
    22. 2000D200 52 682 0 0 52 682 0 RW
    23. 0004B220 0 0 0 0 0 R
    24. --------- --------- --------- --------- --------- --------- ---
    25. Total: 186 054 109 488 1 076 75 490 0
    26. --------- --------- --------- --------- --------- --------- ---
    27. For further information on ELF file data sections, execute command Elf.PrintSectionInfo(0).
    28. Debug.ReadIntoInstCache: updated instruction information within 2 code ranges (0x00030000-0x0004ABB4)
    29. Debug.Start();
    30. Device "NRF9161_XXCA" selected.
    31. ConfigTargetSettings() start
    32. ConfigTargetSettings() end - Took 19us
    33. InitTarget() start
    34. InitTarget() end - Took 19.8ms
    35. Found SW-DP with ID 0x6BA02477
    36. DPIDR: 0x6BA02477
    37. CoreSight SoC-400 or earlier
    38. AP map detection skipped. Manually configured AP map found.
    39. AP[0]: AHB-AP (IDR: Not set)
    40. AP[0]: Core found
    41. AP[0]: AHB-AP ROM base: 0xE00FF000
    42. CPUID register: 0x410FD212. Implementer code: 0x41 (ARM)
    43. Feature set: Mainline
    44. Cache: No cache
    45. Found Cortex-M33 r0p2, Little endian.
    46. Cortex-M (ARMv8-M and later): The connected J-Link (S/N 504505560) uses an old firmware module that does not handle I/D-cache correctly. Proper debugging functionality cannot be guaranteed if cache is enabled
    47. FPUnit: 8 code (BP) slots and 0 literal slots
    48. Security extension: implemented
    49. Secure debug: enabled
    50. CoreSight components:
    51. ROMTbl[0] @ E00FF000
    52. [0][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
    53. [0][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
    54. [0][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
    55. [0][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
    56. [0][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
    57. [0][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
    58. Connected to target device.
    59. Reset: ARMv8M core with Security Extension enabled detected.
    60. Reset: Halt core after reset via DEMCR.VC_CORERESET.
    61. Reset: Reset device via AIRCR.SYSRESETREQ.
    62. Elf.GetBaseAddr(); // returns 0x30000
    63. Target.ReadU32 (0x00030000); // returns 0x4, data is 0x20017FD0
    64. Target.SetReg ("SP", 0x20017FD0);
    65. Elf.GetEntryPointPC(); // returns 0x346F0
    66. Target.SetReg ("PC", 0x346F0);
    67. J-Link: Flash download: Bank 2 @ 0x00000000: Skipped. Contents already match
    68. Elf.GetBaseAddr(); // returns 0x30000
    69. Target.ReadU32 (0x00030000); // returns 0x4, data is 0x20017FD0
    70. Target.SetReg ("SP", 0x20017FD0);
    71. Elf.GetEntryPointPC(); // returns 0x346F0
    72. Target.SetReg ("PC", 0x346F0);
    73. Memory map 'after startup completion point' is active
    Display All
    Here is the .jdebug file which Ozone uses when using "Debug with Ozone" button on Visual Studio Code if that helps.

    Source Code

    1. // This file will be overwritten on each session.
    2. // Any manual changes made to this file will be lost.
    3. void TargetDownload (void) {
    4. Util.Log ("Downloading Program: c:\sworkspace\s_app\app\build\zephyr\merged.hex");
    5. Target.LoadMemory ("c:\sworkspace\s_app\app\build\zephyr\merged.hex", 0);
    6. }
    7. void OnProjectLoad (void) {
    8. Project.SetDevice ("nRF9161_xxCA");
    9. Project.SetHostIF ("IP", "10.184.80.105");
    10. Project.SetTargetIF ("SWD");
    11. Project.SetTIFSpeed ("4 MHz");
    12. Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd");
    13. Project.AddSvdFile ("c:\sworkspace\modules\hal\nordic\nrfx\mdk\nrf9160.svd");
    14. Project.SetOSPlugin ("ZephyrPlugin.js");
    15. File.Open ("c:\sworkspace\s_app\app\build\zephyr\zephyr.elf");
    16. Window.Show ("Zephyr");
    17. }
    Display All
  • Hi msdg,

    could you please check out the following WIKI page? wiki.segger.com/Nordic_Semiconductor_nRF91xx

    I understand that after creating a project with the new project wizard your target runs into an exception. This is often the case when the target is not set-up correctly for debugging, so when starting the application to reach main() - or whatever function Ozone was told to be the startup completion point - an operation fails due to wrongly initialized or uninitialized hardware, thus raising an exception. Does your target operate with a boot loader? In that case you may wish to apply the information found in this WIKI article: wiki.segger.com/Debug_on_a_Target_with_Bootloader.


    From the project File I can see that you are loading a file "zephyr.elf" but when it comes to downloading, your are downloading a file merged.hex to address 0x0. Ozone retrieves the debug information (e.g. where a symbol resides) from the ELF file, but if the hex file does not match that ELF file or is being loaded to a wrong address, the memory content in the target does not match the debug information in the ELF file, which will likely cause exceptions as well.

    Why is it required to have a hex file downloaded instead of the ELF file content?

    When creating an Ozone project via the new project wizard, do you also consider the hex file?

    Best regards
    -- AlexD
    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.
  • That .jdebug file is automatically generated by Nordic toolkit for vscode and matches my first posts error message. The error was when I tried to use Ozones new project wizard.

    I am using bootloader. The merged.hex file consists of the bootloader and the application. zephyr.elf is only for application.

    On nRF9160 this .jdebug file works just fine. Only difference is that SetDevice is set to nRF9160 and not nRF9161. But with nRF9161 I get error on verification phase. Is it possible to skip verification on some parts or skip it totally?
  • Hi msdg,

    apparently the Ozone project file created by your tooling is not working correctly. So you should switch to setting up an Ozone project and maintaining that by yourself. You may use the Ozone project created by the new project wizard as a starting point and integrate the special handling found in the Ozone project your tooling provided. This would be a starting point for any further investigation.

    Having done so, could you please provide the Ozone project file as well as an Ozone log and a J-Link log, both logs being recorded during the same debug session where the issue is reproduced? How to create an Ozone log is described in section 8 of the Ozone user's manual, creating a J-Link log is described here: wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File.

    Best regards
    -- AlexD
    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.