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
Thanks Ron, I have stumbled upon that thread, but I wasn't sure of what to take away from it. Even though my project already compiles (see #1 from my previous post), it's just a matter of getting the compiler to not include the extra semihosting breakpoints. Do I need to somehow compile my Pack-related retarget_io.c/EventRecorder.c files separately without the --cpp11 flag?
I was finally able to solve this problem! After reading many articles including:
www.onarm.com/.../ stackoverflow.com/.../1898523
I built with the following retarget.c file:
#include <stdio.h> #include <rt_misc.h> #include <rt_sys.h> #pragma import(__use_no_semihosting) int stderr_putchar (int ch) { return -1; } int stdin_getchar (void) { return -1; } void ttywrch (int ch) { } void _sys_exit(int return_code) { label: goto label; /* endless loop */ }
The key line not found in most retarget examples is #include <rt_sys.h>... without it I get the L6915E error. Maybe it is only needed for my particular project with external libraries.