MiV and printf to the Debugger Console #5
Replies: 2 comments 7 replies
|
@rockoguido Do you mean that there is no UART IP used in the design and you want to transport the messages over debugger JTAG interface? |
|
I've got this working on an Avalanche Board with SoftConsole v2021.3 You can define you own 'output buffer' and use sprintf(buf, fmt, ...) or your own print function to write a zero terminated string into the buffer, and then call sys_writes() [see attached] to send it to the GDB console via OpenOCD running under SoftConsole. This approach is 'relatively non-blocking' in that the action will auto-complete. Reading input from the GDB console is accomplished using the sys_readc() [see attached] function to poll for input characters one at a time. Currently, I find that this action will 'block' execution of the RISC-V code because the GDB console 'buffers' typed characters until the 'enter key' is pressed. Then each call to sys_readc() will return one character until the 'enter' character is read. Then a subsequent call to sys_readc() will again 'block' execution. I'm looking for a way to tell OpenOCD to turn-off character buffering in the GDB console - anyone know the right command ? Note: I added a global variable that defaults to 'disable' the semi-hosting console interface at power-up/boot so that the RISC-V program can 'free run' at boot time. I added an ISR that is triggered by a push-button to 'enable' the interface after a debugger is attached, and an 'exit' command to again disable the interface before closing the debugger. That way - the 'main loop' can operate normally when the console is not active. Note: if you get 'strange' results when printing to the GDB console via semi-hosting, make sure that you're GDB console preferences look something like this: |



Uh oh!
There was an error while loading. Please reload this page.
Working with a customer with a Bare Metal App on the Mi-V and there is no UART support. Is there a way to map printfs to the Debugger Console in Soft Console?
Looked around and no magic Macro jumped out at me..
Thx!
Dave
All reactions