We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
I have nothing in the Debug (printf) window dialog when I use the printf instruction. (UART #x too)
Is there something to initialize, or include a specific header? How the printf could be assigned to a specific port?
I'm simulating a simple programm running on an STM32 µc
thx
np, have fun :-)
There is also a back channel implemented, where text typed in the ITM/Printf Viewer Window is sent to a memory location on the target (if a special Variable Name is found).
You may use it as follows: (Example, if you don't use RTX, just use the ITMRx_Getc() )
#include <RTL.h> /* RTX kernel functions & defines */ #include "itm_rx.h" #include "rx_buffer.h" volatile unsigned int ITM_RxBuffer; // 0x5AA55AA5 is handshake value // ITM Serial Window Input Watch and Init function void ITMRx_InInit(void) { ITM_RxBuffer = 0x5AA55AA5; } int ITMRx_Getc(void) { int recChar=0; // zero is default if no new char recv if(ITM_RxBuffer != 0x5AA55AA5) { recChar = ITM_RxBuffer & 0xff; ITM_RxBuffer = 0x5AA55AA5; } return(recChar); } __task void ITMRx_GetcWatch(void) { int tmp; os_itv_set (1); // 10 ms while(1) { tmp = ITMRx_Getc(); if(tmp) itm_rxBuffer_putchar(tmp & 0xFF); // write buffer os_itv_wait (); } }
Note: For usage with scanf() (fgetc() - retarget) you should add a blocking wrapper calling ITMRx_Getc(), because it returns 0 when no new char is avaiable.
BR, /th.