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 debbung without uart

Hello all,
I would like to know if there is a way in the simulation with uVision to use a printf to display debugging information on window of uVision to a micro cortex m3 without committing a uart and without using ulink.
Tanks

  • Antonello, I have nothing against your post, I do appreciate your posts and effort on these forums :- )

    Experienced users know how to use small asm routines that do big jobs, as you 've already said, you can do existing functions with smaller codes, whether in asm or in C. Isn't it better to write your own functions that convert integers/decimals to char to display them on the LCD instead of using printf? It is not always necessary or a must to use existing compiler functions and libraries, look at this one function, I used it to display two digits only for a clock function:

    Code:

    char* bin2bcd( unsigned int val )
    { char i; static char digit[2];

    val -= 100; i = '0' + 10; do i--; while( (val += 10) & 0x8000 ); digit[0] = i;

    digit[1] = val | '0';

    return digit;
    }

    This is truly a nice routine to use instead of using % and / or even the printf function.

  • Hi,

    for Simulation and for Target Mode (with ULINK2 / pro or JLink) you can use the CMSIS function ITM_Sendchar() from core_cm3.h

    .
    BR,
    /th.

  • While all printf() functions may bring in a bit of code, that is often not a problem for ARM-class processors.

    sprintf() is a good candidate for printing to a text string, then sending the contents of this string to some suitable send-char functions like the above mentioned ITM_Sendchar() function.

    So you can create your own debug_printf(char* fmt,...) that directs the output whereever you like, while still reserving printf() for some other output stream.

  • Yes you can print to the command window without UART implementation. Look into the Function Editor in the Simulator. There is a printf function that only operates within the debugger.

    This is NOT the printf that outputs streams to a UART or a simulated UART. It is used only within a Signal or debugger Function to output to the command window. However, you can direct the command window to a file for saving if necessary.

    You can set a BreakPoint execute to fire off the debugger printf at selected loactions within you code.

    See the Debugger for details.

    Bradford

  • on window of uVision to a micro cortex m3 without committing a uart and without using ulink.

    So how did you expect those characters to make it from your micro into uVision, now that you've ruled out all physical connections --- telepathy?

  • thanks for the help,
    I used the ITM_Sendchar it works.