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/TMS320F28069M: How to make printf work with floats?

Part Number: TMS320F28069M


Tool/software: Code Composer Studio

Hello,

I have the program that works alright when printing strings and decimals with printf. However, if I include a simple code with float:

float a = 0.1;
printf("My float: %f", a);

The printf doesn't display anything! Whenever I pause the program for debugging, it always halts at the following line:

***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************

    .sect "codestart"

code_start:
    .if WD_DISABLE == 1
        LB wd_disable       ;Branch to watchdog disable code    <----------- HERE IT HALTS
    .else
        LB _c_int00         ;Branch to start of boot.asm in RTS library
    .endif

The same issue happens if I use snprintf.

I have already tried to play with the memory. I assigned the .cio section to USB_RAM memory range (0x1000 length - I have started another topic with a question on what is the proper way, see https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/625989 ), increased RAMM1 length to 0x1000 and thus set the stack and heap sizes to 0x1000. So this shouldn't be a problem. Any other ideas?

  • Hi Jakub,

    This is related to insufficient stack memory. Check these threads out:

    Regards,

    Gautam

  • Thanks for an answer - indeed, that was the problem.

    I have actually tried to increase stack and seen no improvement, but then it turned out I was doing it wrong! So, a lesson learned for others:

    after you increase stack size in project properties, you have to make sure you give enough space in memory by updating the linker cmd file. By default, stack size is assigned to RAMM1 - so I have simply increased its length to fit the new stack size. But then I got to know - according to the memory map in MCU datasheet, RAMM1 cannot be bigger than the default 0x400! So I moved .stack section to another memory, i.e. RAML0_L8. Now it works fine.