[SOLVED] Bug: Ozone will reflash after each "continue" or even "disconnect" if breakpoint is at "wrong place"

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

  • [SOLVED] Bug: Ozone will reflash after each "continue" or even "disconnect" if breakpoint is at "wrong place"

    I encountered this bug before but wasn't able to reproduce reliably until today.

    The bug is that if you put a breakpoint in a place that is somehow special (not sure if it's because of inlining or macros), then after almost each pressing of "continue", there will appear the "Reflashing" window and will reflash numerous times the ELF.

    Even if you press the "disconnect" (end session) button, it will first reflash MCU several times before disconnecting.

    Example of such breakpoint can be seen on this attached screenshot - if you set it, it will trigger the above bug, once you remove it, Ozone will again work normally without the spurious reflashes:




    OS: Ubuntu 20.04 LTS
    JLink libraries: 7.64
    Ozone: 3.26d
    MCU: STM32F427VI

    I was trying to find smallest example that triggers it, but could only find this one in Rust for Raspberry Pico: github.com/rp-rs/rp2040-project-template

    Breakpoints put on some lines will also trigger the "reflash several times after continue or before disconnect", seems that breakpoints on "info!" lines will cause it as well on second attached screenshot:

  • Hi,
    Thank you for your inquiry.

    Without knowing your exact setup I would assume that you are setting more breakpoints than available on your hardware.
    In such a case the J-Link software has to set Flash breakpoints. These flash breakpoints have to be programmed to the device,
    hence the download.

    If you end the debug session these breakpoints have to be removed, which - again - will cause a flash download.

    BR
    Fabian
    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.
  • OK, interesting idea, but it would make sense if a function is inline that it will set more than one breakpoint, but I will have to test that. Both of those ARMs ahve either 4 or 6 HW breakpoints.

    Does "Type=Flash" or "Type=Mixed" mean it's setting the those flash breakpoints?
  • Thanks! You were right, I guess I didn't expect this behavior since GDB+openocd+other JTAG/SWD adapters will just slow your program by having to check for breakpoints after exhausting number of HW breakpoints, but it's implemented differently in GDB+openocd compared to Ozone/JLink libraries.

    Though I have to ask, why does the reflash happen before disconnect as well? To restore the original program state?
  • Hi,
    I answered that in my initial message:

    SEGGER - Fabian wrote:

    If you end the debug session these breakpoints have to be removed, which - again - will cause a flash download.
    The breakpoints will stay in flash otherwise, which would mean that the program flow would be stopped on the first BP hit.
    So you are correct: It restores the original program state.

    Best regards,
    Fabian
    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.
  • Thought I caught it in action wihout exceeding the 4-6 HW breakpoints as shown here:



    Thus after fimware reload, will somehow not correctly map the breakpoints (of which there were only 2), but starts using flash breakpoints.

    Could we have a setting dialog like "do you want to reaload firmware now? yes,no,always, never." and make it "You are now setting flash breakpoints". ACK for future/ ask every time, do not, never". Last part is important. since it means that "yes keep resolved adresses as they were, but don't add any flash breakpoints.

    Flash breakpoints are important if your firmware checks and hashes/verifies signatures of your code, which we do for Trezor T for example. It's because the code won't if the overall hash doesn't matchk, so you can't simply change assembly instructions.

    Thus the flashpoint adding should have similar dialog "We are going to change instructions here, here and here". Do you acccept "Yes/No/Always/Never"

    And ideally option to turn off flash points for a project at all in settings.
  • Hi,

    Disabling flash breakpoints is already supported:
    wiki.segger.com/J-Link_Command_Strings#DisableFlashBPs
    How to use command strings in Ozone:
    wiki.segger.com/J-Link_Command…ng_J-Link_Command_Strings

    Does this solve the issue?

    BR
    Fabian
    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.