If you don't want printf to go to a serial port, perhaps you'd like to have it redirect to the gdb console (inside Eclipse).
1. Add to your linker options:
-specs=rdimon.specs -lrdimon
2. In your debug configuration, find Run Commands and add:
monitor arm semihosting enable
3. In your main() make this call early (before calling printf):
initialise_monitor_handles();
That's it. Now printf will go to your console.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Hmm - I just get this ;-(
Error in final launch sequence:
Failed to execute MI command:
monitor arm semihosting enable
Error message from debugger back end:
Protocol error with Rcmd
Are you sure? yes | no
Your Debug Probe is probably set to ST-LINK (ST-LINK GDB Server), change it to ST-LINK (OpenOCD). This option is in your Run Configuration, Debugger tab.
Are you sure? yes | no
Don't forget this lets you open files on the host for read/write, do console input, etc.
Are you sure? yes | no
Although that's slow, so you can also call fflush if you don't put a newline at the end of things.
Are you sure? yes | no
Oh yeah. You might want to put:
setbuf(stdout,NULL);
In to keep stdout from buffering.
Are you sure? yes | no