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

ARM: Simulator printf

I have created a project in Microvision 5 for an ARM Cortex-M0 (ARMCM0), and enabled the Simulator. I pull up the Debug (printf) Viewer and run the following code

#include <stdio.h>

main(void)
{
        printf("Hello world\n");

}

but no output appears in the Debug window. The code is definitely running to completion (I added additional statements to check). I am running an Evaluation copy of Microvision V5 17.0.0.

Am I missing some checkbox or option to redirect output in the Simulator?

Parents
  • You wonder about "redirect output in the Simulator".

    But long before you worry about that, you should spend some time trying to figure out what "console" your hardware has. What is printf() actually expected to do?

    After you have considered that, you could look at the documentation how to direct printf() to a serial port of the processor. Then you could ponder how to let the debugger capture the serial data of that simulated serial port.

    The above is rather important since embedded devices aren't PC machines - there are no pre-defined "standard out" device the debugger can directly capture to pick up printf() output.

    Another thing - your program really shouldn't exit main(). This is also one of the differences from a PC - your program will not exit back to a command line prompt or a GUI.

Reply
  • You wonder about "redirect output in the Simulator".

    But long before you worry about that, you should spend some time trying to figure out what "console" your hardware has. What is printf() actually expected to do?

    After you have considered that, you could look at the documentation how to direct printf() to a serial port of the processor. Then you could ponder how to let the debugger capture the serial data of that simulated serial port.

    The above is rather important since embedded devices aren't PC machines - there are no pre-defined "standard out" device the debugger can directly capture to pick up printf() output.

    Another thing - your program really shouldn't exit main(). This is also one of the differences from a PC - your program will not exit back to a command line prompt or a GUI.

Children