This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debugger does not run unless using MicroLIB

I have a Keil project that is built using ARMCC, with "use MicroLIB" unchecked. It links multiple libraries, including CppUTest, that are also built with ARMCC.

During Keil debug session with simulator, I set a single breakpoint on a line after my tests are called. I press "run" and it stops somewhere inside; I have to press "run" repeatedly to get it to step through each test call (and output each printf) and eventually reach the breakpoint I set.

However, when I compile the same project with "use MicroLIB" checked, pressing "run" behaves as expected and goes to the first breakpoint.

Does anyone have a good explanation for this behavior? I'd like to understand why this happens since I ultimately want to build without MicroLIB, but also have the debug "run" instead of having to repeatedly step.

Device: ARM Cortex M0 Plus
CMSIS pack: 5.4.0
uVision: 5.26.2.0
ARMCC: 5.06 update 6

Parents
  • Thanks for the article link, it's helpful but I'm still running into issues. I think you're right about semihosting, since I can see that my program is indeed stopping at a "BKPT 0xAB" instruction.

    1.
    When trying to solve by using the Keil Compiler Pack as suggested first, I redirect STDIN and STDERR to User (and add the default user template files to my source files). I still have STDOUT redirected to EVR (and Event Recorder DAP enabled), as outlined on the www.keil.com/.../_retarget__examples_er.html page. After compiling this, the same underlying breakpoint occurs as before.

    2.
    I also tried selecting STDOUT redirect to User (with default user template file), but the breakpoint remains. But this is without printf output, which I need anyways.

    3.
    I tried the second suggestion to turn on MicroLIB, but I can't compile ARM's retarget_io.c because of __stdout, fputc, fgetc, and abort conflicts.

    4.
    I also tried the third suggestion to add a retarget.c file according to the http://www.keil.com/support/man/docs/gsac/gsac_retargetcortex.htm page. However, this caused compiler conflicts with __stdout, __stdin, fputc, fgetc, and ferror in <stdio.h> [example warning: #2681-D: name linkage conflicts with previous declaration of variable "std::__stdout" (declared at line 138 of "C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h")].

    I feel like I'm getting close... or at least figuring out the right question to ask. How do I basically redirect STDOUT to Event Recorder (or other simulator printf output) and disable the semihosting breakpoints?

Reply
  • Thanks for the article link, it's helpful but I'm still running into issues. I think you're right about semihosting, since I can see that my program is indeed stopping at a "BKPT 0xAB" instruction.

    1.
    When trying to solve by using the Keil Compiler Pack as suggested first, I redirect STDIN and STDERR to User (and add the default user template files to my source files). I still have STDOUT redirected to EVR (and Event Recorder DAP enabled), as outlined on the www.keil.com/.../_retarget__examples_er.html page. After compiling this, the same underlying breakpoint occurs as before.

    2.
    I also tried selecting STDOUT redirect to User (with default user template file), but the breakpoint remains. But this is without printf output, which I need anyways.

    3.
    I tried the second suggestion to turn on MicroLIB, but I can't compile ARM's retarget_io.c because of __stdout, fputc, fgetc, and abort conflicts.

    4.
    I also tried the third suggestion to add a retarget.c file according to the http://www.keil.com/support/man/docs/gsac/gsac_retargetcortex.htm page. However, this caused compiler conflicts with __stdout, __stdin, fputc, fgetc, and ferror in <stdio.h> [example warning: #2681-D: name linkage conflicts with previous declaration of variable "std::__stdout" (declared at line 138 of "C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h")].

    I feel like I'm getting close... or at least figuring out the right question to ask. How do I basically redirect STDOUT to Event Recorder (or other simulator printf output) and disable the semihosting breakpoints?

Children