[SOLVED] Ozone always shows hardfault on RP2040/Pi-Pico

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

  • [SOLVED] Ozone always shows hardfault on RP2040/Pi-Pico

    Short Story (Steps to reproduce):
    - Open blinky example for RP2040-Pico in Segger-Embedded-Studio.
    - Build the project
    - Click "Debug/Debug With Ozone (Alt F5)"
    - When Ozone opens, start debug session
    - Get a Hardfault at 0x00000000 (screenshot is attached)

    This is all done using standard Raspberry Pi Pico Dev-Board, no custom hardware is used yet.

    Long Story (Background):
    After many years of development with STM32 micros (using Eclipse and Ozone/J-Link as my toolchain), I need to start a project with Raspberry Pi RP2040.
    For a quick start, I used Visual Studio Code with the integrated debugger, the Pico-SDK and the Pico-Debug-Probe.
    This worked well, besides the limited functionality of the debugger, compared to Ozone.

    So after the initial development I wanted to switch to Ozone and J-Link.
    But after connecting the J-Link to the Pi-Pico (as shown in the Segger Knowledgebase: SWCLK, SWDIO, GND, Vtarget) and loading the elf file into Ozone a Hardfault occured immediatly after starting debugging.
    Side note: The file which was flashed by Ozone just runs fine, after disconnecting.

    To verify the hardware and make sure there is nothing wrong with my software, I downloaded the Eval version of Segger Embedded Studio.
    The provided blinky example worked out of the box.
    I could build the project and debug it inside Segger Embedded Studio, so all used hardware must be fine.
    But as soon as I clicked on Debug with Ozone and started the debug session the Hardfault occured.

    So it seems, that debugging works with SES, but not with Ozone.

    Used software versions are:
    Ozone 3.38d
    J-Link 8.20
    SES 8.22a

    I also tried this on two different PC's, they behaved exactly the same.
    I can not see what could be wrong on my side.
    Any hints on this would be really appreciated.

    Best regards,
    Martin
    Images
    • Ozone-Hardfault.png

      32.29 kB, 1,267×512, viewed 91 times
  • Hi enz,
    it appears to be the case that your Ozone project is not set-up correctly. If your Ozone project replicates your ES environment correctly, you will be able to debug your application with Ozone as well. I cannot tell where the issue lies. You may check our knowledge base for ideas. Assuming that your system uses a boot loader, you may check out this article: kb.segger.com/Debug_on_a_Target_with_Bootloader
    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.
  • Hi Alex

    Thanks for the reply.

    No, there is no bootloader involved.
    As i wrote at the beginning of my first post, i stripped the problem down to the Blinky example delivered with SES.

    If the Ozone project is not set-up correctly, then how do i get a correct set-up?

    SES does not seem to produce a correct Ozone setup, as mentioned.

    Doing the set-up with the Ozone project wizard also does not produce a correct setup.

    As mentioned, there is currently no user specific code involved, it is all just the blinky example delivered with SES.

    Is there a known good Ozone project configuration which does not depend on SES?

    I meanwhile was able to try debugging using the J-Trace Pro of my customer, also the same problem.
    So i really think we can rule out the hardware.


    Best regards,
    Martin
  • Hi Martin,
    please have a look at kb.segger.com/Raspberry_Pi_RP2040. There it is stated
    "the RP2040 includes a boot ROM which needs to be executed after reset in order to guarantee proper functionality."
    Please check if the knowledge base article I referred to earlier does help you here.
    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.
  • Hi Alex,

    sorry, i had a brain block.
    When you mentioned a bootloader i only thought of a custom one, not of a builtin ROM-Bootloader.

    Of course you were right. In the knowledge base article you linked the "secret" is mentioned at the very bottom.

    For reference, if anybody will stumble about this in the future, i will repeat the important sentence here:

    Simply leave the functions AfterTargetDownload() and AfterTargetReset() empty (but not commented out!).

    This did the trick for me.


    Why the Ozone project wizard does not add this important part does escape me.


    Thanks for the help.
    Best regards,
    Martin
  • Hi Martin,
    glad to see you are up and running again.
    Happy debugging and 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.