Simple question: When I program a demo program that uses PRINTD, where does the serial console data go? I followed the tutorials and I can see the serial data if I run it in Visual Studio Code in the debugger. However, when I program the chip, exit Visual Studio code and then reset the chip none of the messages appear. Perhaps it is being re-directed to a different UART, but which one? I am using TeraTerm and the data appears there totally outside of Visual Studio Code, but only when the debugger is running inside of VS Code.
I have several USB to UART converters, so I don't really care if it is on another set of port pins. I just need to output to provide log messages of what is happening in my code.
Thank you.
Semihosting is a mechanism where the target MCU uses the debugger to send output (like printf) to the host PC. It’s great for development, but it requires an active debugger session. Once you flash the board and run it standalone, semihosting won’t work.
BR,
Omar
Thank you. But my problem seems to be the opposite of that. It keeps working long after I exit the debugger. I have to run the debugger to get it working.
I believe the problem has something to do with the LinkServer Flash Programmer. It is actually not programming the FRDM0MCX236. I get a message at the end that programming was successful, but it actually is not. If I put a version number in a PRINTF and program with the debugger, then I see that version number on the serial port. If I change the version number and program with LinkServer, then when I reboot the old version number is on the serial console. I seem to have to use the debugger or the flash is not updated. Perhaps I am doing something wrong in the LinkServer. When I choose the program to flash, I choose the ELF. It does not complain about the file choice and I choose the correct board to program. If as a test, I choose the wrong board, it immediately fails to program.
So, I discovered the following by accident. As I said, the serial console is active if I have the debugger running. I accidentally killed VS Code with the debugger running. The serial port kept running. Even if I press the reset button or power cycle the board, it keeps working. If I return the VS Code and again program the flash, then I get the startup serial messages once as it finished programming. After that it quits outputting the serial port until I again do the debugger trick above. I am building the debug version as I am just starting the code. Don't know if that makes a difference.