This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

--printf_support



hi,

the printf format is limited why? I see the default setting of --printf_support is full.

the expected output is "ISP00102"

 

  • I think you just use x not hx to print hex values.

    Try this:

    printf("ISP 0x%.3x 0x%.2x\r\n", 1, 2);

    Also you may be interested in this.

  • the output is still wrong.
    the precision should be 3 but the output is 2.
    the output is "ISP 0x01 0x02" while the expected output should be "ISP 0x001 0x02"
  • Oh, I did not know you wanted it that way. In that case I think you have to change it to this:

    printf("ISP 0x%3x 0x%2x\r\n", 1, 2);

    Notice that there is no dot (".") since you want to format the integer-part, not the fractional-part.

    Hope I am right.

  • Your original format string should work just fine. It does for me when using TI ARM compiler version 5.2.7. The 'h' modifier is for "short" values; it should have no effect for the "int" values you are trying to print. The output in your original post does strongly suggest that you are somehow using minimal printf support instead of the full printf support you intend to use. Perhaps your linker command file link.cmd has another instance of the option --printf_support in it? One way to determine for sure which version you got is to look in the linker map file to see which of __TI_printfi, __TI_printfi_nofloat, or __TI_printfi_minimal was linked in (you should only have one of those three).
  • I can not find any one of the the three __TI_printfi, __TI_printfi_nofloat or __TI_printfi_minimal in the map file.
    I can only see the printf.
    my compiler version is 5.1.1 not 5.2.7.
  • Another way to look is with the names utility armnm.  From a command line interface, execute:

    >>> armnm -g file.out | find "printf"

    Show the output in your next post.

    Thanks and regards,

    -George

  • The TI compiler RTS version of printf cannot be linked against successfully unless one of those __TI_printfi functions is also linked (for older TI RTS versions, it was _printfi). Perhaps you are using some additional library that overrides the TI compiler RTS version of printf?

    I get the same result with TI ARM compiler 5.1.1 and its corresponding library.
  • hi,

    this is the outline of the armnm comand.

    and I beleive one of your colleage's suggestion is correct. the TI's RTS library is suppressed by another library.

    I use a project based on the safeRTOS.

    now I have make a special printf called my_printf and it works.

    thank you.

  • hi,

    you are right. TI compiler RTS library is overrided.

    the project I used is based on a safeRTOS which have a library (I guess from the output of the armnm command). 

    I create a simple project to call the printf and use the armnm command to find the __TI_printfi.

    what is the mechanism about the overriding the RTS library of TI compiler?

    e.g. the low level of IO functions fputc() ?

  • eric said:
    what is the mechanism about the overriding the RTS library of TI compiler?

    Some library, other than the RTS library supplied with the compiler, provides the implementation of printf you use.  To see which library that may be, use the linker option --scan_libraries .  It is described in the ARM assembly tools manual.

    Thanks and regards,

    -George