I've followed the steps here to copy the "printf_redirect" example project from the pack installer: www.keil.com/.../_retarget__examples_er.html
I left everything as is within the example project. When I rebuild the "CM0 Simulator" target, it succeeds but with 1 warning:
C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.6.0\Source\EventRecorder.c(660): warning: #1215-D: #warning directive: "Invalid Time Stamp Source selected in EventRecorderConf.h!"
When I start debug in the simulator, it runs the included debug.ini file as expected. But I only see values updating in the "My First Viewer" window, not the Event Recorder or Debug (printf) Viewer windows.
Does something need to be done for the compiler warning? Is there a step not listed at the URL above that I'm missing? I just expected this example project to work out of the box. My immediate goal is to simply run this example project and see output in the Debug (printf) Viewer, so that I may later adapt an existing project to similarly redirect I/O.
Keil uVision: version 5.23.0.0 Toolchain: MDK-ARM Standard Cortx-M only, version 5.23 Compiler/Assembler/etc: version 5.06 update 4 (build 422)
Thanks!
printf_redirect example
It should work out of the box. I have tried it with the latest MDK V5.26 which also includes ARM_Compiler pack V1.6.0 (includes EventRecorder). I see the expected values in Debug (printf) and Event Recorder Window. You should try it out with the latest MDK and updated example.
I also get the mentioned compiler waring (was introduces by the newer Event Recorder component) but you can ignore it since the simulator for Cortex-M0 is extended with a debug script to emulate DWT Cycle Counter.
Anyway you can change the Time Stamp Source to SysTick. Modify the EventRecorderConf.h:
#define EVENT_TIMESTAMP_SOURCE 1
Then the warning goes away and the example actually uses the SysTick rather than DWT.
It seems that you have an older example. Try out the updated example from latest ARM_Compiler pack 1.6.0.
SCVD Cortex-M0 SysTick example
Also that example should run out of the box. I have just tried the latest example from ARM_Compiler pack 1.6.0 and I see the expected events in the Event Recorder window. Note: Debug (printf) retargeting is not used in this example.
Thanks for the suggestion! I upgraded to MDK v5.26 and both projects now work.