[SOLVED] Misleading singlesteps in source code

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

  • [SOLVED] Misleading singlesteps in source code

    Hi,

    a snippet of my c-code looks like this:

    ----------------------------------------------------------------------------------------------------------------
    if (tempa == 0)
    {
    Ergebnis = 0;
    }
    }
    Wait_ms (100);
    ----------------------------------------------------------------------------------------------------------------

    With a breakpoint on the if statement the contents of tempa is 9 (= correct in this case).
    Next singlestep stops @ Ergebnis = 0 which pretends that tempa is 0 (= obviously not correct).
    With a look at the assembly the program flow is ok because with the BNE in effect program execution
    resumes with the preparation of the wait-loop. But this is not part of the Ergebnis statement.


    The program is running fine but debugging is misleading .

    ----------------------------------------------------------------------------------------------------------------

    In assembly the code reads :


    if (tempa == 0) ;Breakpoint, tempa currently = 9
    080039AE 7800 LDRB R0, [R0, #0]
    080039B0 2800 CMP R0, #0
    080039B2 D102 BNE 0x080039BA ;Branch active because tempa != 0
    080039B4 A802 ADD R0, SP, #8
    080039B6 2100 MOVS R1, #0
    {
    Ergebnis = 0;
    080039B8 7001 STRB R1, [R0, #0]
    080039BA 2064 MOVS R0, #100 ;Branch destination = start of Wait_ms(100)
    }
    }
    Wait_ms (100);
    080039BC F7FE FC70 BL Wait_ms
    080039C0 A802 ADD R0, SP, #8
  • Hello,

    Thank you for your inquiry.
    Such an issue is not known to us.
    Which version of Ozone are you using?
    The code snippet seems to have an error. Did you mean to post it with one less closing bracket?
    Which compiler do you use for code generation? Are any optimizations active?
    What target device are you debugging exactly?

    Best regards,
    Nino
    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 Nino,

    thanks for your reply.

    Ozone-Version is 3.22.
    The code snippet shows just some lines of a complete (well-running) function with about 80 lines.
    I compile it with Keil-ARM , load the axf with Keil+JLink+SWD into the STM32F051, debug the named lines with Keil and stepping is ok.
    For some reason Ozone is not able to download this axf so I have to "Attach to running program", but stepping is ok, too.
    (JLink reports an unspecified download error)
    Using the same sourcefiles in emStudio for ARM 5.30, compiling with gcc (hopefully the most recent version), loading the gcc-axf with
    Ozone (download running fine) , stepping in Ozone (or emStudio) runs into "Ergebnis = 0".

    The Keil-Disassembly looks like this:

    76: if (tempa == 0)
    77: {
    0x08002FA8 2D00 CMP r5,#0x00
    0x08002FAA D100 BNE 0x08002FAE
    78: Ergebnis = 0;
    79: }
    80: }
    81: //-----------------------------------------------------------------------------
    0x08002FAC 2400 MOVS r4,#0x00
    82: Wait_ms (100); // SR macht ca 50ms Driver-OFF nach letzter Sendung
    83: //-----------------------------------------------------------------------------
    0x08002FAE 2064 MOVS r0,#0x64
    0x08002FB0 F000FD28 BL.W Wait_ms (0x08003A04)
    84: if (Ergebnis == 0)

    I could send a small video, but it is 1.6MBytes long.

    Best regards
    Detlef

    The post was edited 2 times, last by keyboardwizard ().

  • I wrote some senseless lines to get closer to the problem (see attachment). Mind you, everything is working fine.
    But you're upset when single stepping shows the wrong statement.
    Images
    • Misleading single step.png

      119.31 kB, 1,550×944, viewed 340 times
  • Hi Nino,

    with today's installation of emStudio 5.40 the Problem is solved.
    Please see the attached screenshot :
    The disassembly shows the same compilation, only the blockmarkers for lines 53 and 55 are placed one line earlier.

    Best regards
    Detlef
  • Hello Detlef,

    I must say I am a bit confused now. First the inquiry was related to Ozone with Keil output.
    Now you are using Embedded Studio.

    Is the issue resolved or not?
    What is working and what is not working?

    Best regards,
    Nino
    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 Nino,


    the problem occured while testing a project with Ozone which had been edited and compiled in emStudio, so I started with focus on Ozone.
    It is an old Keil project which I imported into emStudio, so I had the chance to compare Ozone's reactions with these two compilations.

    And yes, the issue has been resolved by updating emStudio to version 5.40 which might have included an update of the compiler, too.

    Best regards,
    Detlef
  • Hi Detlef,

    OK I see. Thank you for clarifying.
    Good to hear that you are up and running again.

    We will consider this thread as solved now.

    Best regards,
    Nino
    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.