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.

CCS/TMS320F28388D: sprintf floating point fails on CM core

Part Number: TMS320F28388D


Tool/software: Code Composer Studio

Hi,

I'm using Code Composer Studio to develop programs for F28388D. I am trying to do this on the CM (ARM) core:

float foo = 1.23
sprintf(buf, "%f", foo);

and it faults.

I've read in E2E in threads about similar problems in C28x core or other processors. Answers are either recommending increasing the stack, making sure library assumptions are correct and including stdio.h and stdlib.h. Therefore I've increased my stack to 2048 bytes and made sure "printf_support=full" and included stdio.h and stdlib.h.

What else can I try?

Thanks for any advice.

Best Regards,

Nik

  • Hi,

    Did increasing the stack size resolve the problem?

    Regards,

    Veena

  • Please try the suggestions in the article Tips for Using Printf.  Please let me know if this resolves the problem.

    Thanks and regards,

    -George

  • Hi Veena,

    It turns out that increasing the stack size is required. However, it is also necessary to turn off floating point support in Project Properties -> Build -> ARM

    Compiler -> Processor Options ... set it to none.

    This makes the linker map look like this (which works):

                      0021659e    00000042     rtsv7M4_T_le_xo_eabi.lib : sprintf.c.obj (.text:sprintf)

    instead of this (which crashes):


                      002163d0    00000042     rtsv7M4_T_le_v4SPD16_xo_eabi.lib : sprintf.c.obj (.text:sprintf)

    I think that the first thing I tried when I noticed this failure was to turn *on* floating point support, based on some E2E (or maybe some less reputable source on the net, I really don't remember.)

    So then after that when I grew the stack to 2048, it didn't help, because not only was it necessary to grow the stack, it's also necessary to turn of processor floating point support. Bottom line: with floating point disabled, sprintf() needs 1400 bytes to handle "%f" - and with floating point support *enabled* either it needs even more, or something else crashes, I didn't figure out what because I have what I need now.

    Best Regards,

    Nik

  • Hi George,

    The solution to my problem wasn't in that article, but what a good, helpful batch of info it is, thanks for pointing it out!

    All the best,

    Nik