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

printf problem (nothing in Debug (printf) window)

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

Parents Reply Children
  • I've just got this source and printf works now.

    Thank You

  • 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.