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.

What chip support printf

Other Parts Discussed in Thread: ENERGIA, MSP430G2553, MSP430I2041

Hi,

I'm just getting started with this product line.  I had plans for using a MSP430I2041 for a kickstarter project, but I'm starting on a simple MSP430G2553  Launchpad.  After 2 days wasted trying to find an answer on the web and forums, there is no direct support for printf (or serial on Energia) on the the smaller chips, like the MSP430G2553 that I'm using to learn on.  

To say I'm frustrated with this is an understatement,  So before I waste my time and money on another board, what Launchpads support printf,

I can not overstate the disapointment of Ti for thier lack of support on printf and the amount of confusion out ther on this topic.  TI needs to fix this in thier offical products.

Thanks,

Chris

  • Hello Chris,

    I am not familiar with the MSP430. What do you mean by no direct support?

    Do you see any type of printf function in the runtime code directory?

    Stephen
  • The only answer I have found for the MSP430G2553 is forums and answers that are highly complex.  I'm starting out and for a basic function of printf TI should have a direct answer for this basic question.

    Since that don't support printf on this chip, what launch pads do work?

  • Those direction are based of a chip with 16kb or RAM, the MSP430G2553 has 0.5kb of ram.

    I followed these directions to the letter. Here is the log:

    **** Build of configuration Debug for project printf_test ****

    "C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
    'Building file: ../main.c'
    'Invoking: MSP430 Compiler'
    "C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/bin/cl430" -vmsp --use_hw_mpy=none --include_path="C:/ti/ccsv6/ccs_base/msp430/include" --include_path="C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/include" --advice:power=all -g --define=__MSP430G2553__ --diag_warning=225 --diag_wrap=off --display_error_number --printf_support=minimal --preproc_with_compile --preproc_dependency="main.d" "../main.c"
    "../main.c", line 17: warning #112-D: statement is unreachable
    "../main.c", line 14: remark #1532-D: (ULP 5.3) Detected printf() operation(s). Recommend moving them to RAM during run time or not using as these are processing/power intensive
    'Finished building: ../main.c'
    ' '
    'Building target: printf_test.out'
    'Invoking: MSP430 Linker'
    "C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/bin/cl430" -vmsp --use_hw_mpy=none --advice:power=all -g --define=__MSP430G2553__ --diag_warning=225 --diag_wrap=off --display_error_number --printf_support=minimal -z -m"printf_test.map" --stack_size=80 --heap_size=320 -i"C:/ti/ccsv6/ccs_base/msp430/include" -i"C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/lib" -i"C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="printf_test_linkInfo.xml" --use_hw_mpy=none --rom_model -o "printf_test.out" "./main.obj" "../lnk_msp430g2553.cmd" -llibc.a
    <Linking>
    "../lnk_msp430g2553.cmd", line 100: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".cio" size 0x120 . Available memory ranges:
    remark #10371-D: (ULP 1.1) Detected no uses of low power mode state changing instructions
    RAM size: 0x200 unused: 0x12 max hole: 0x12
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 1 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 2 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 3 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.

    >> Compilation failure
    makefile:140: recipe for target 'printf_test.out' failed
    "../lnk_msp430g2553.cmd", line 91: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".data" size 0xfe . Available memory ranges:
    RAM size: 0x200 unused: 0x12 max hole: 0x12
    "../lnk_msp430g2553.cmd", line 94: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".stack" size 0x50 . Available memory ranges:
    RAM size: 0x200 unused: 0x12 max hole: 0x12
    error #10010: errors encountered during linking; "printf_test.out" not built
    gmake: *** [printf_test.out] Error 1
    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****
    *******************************************************************************************************
    Here is the program :

    #include <msp430.h>
    #include <stdio.h>

    int counter = 0;
    /*
    * main.c
    */
    int main(void) {
    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer


    while(1) {
    // __bis_SR_register(LPM3_bits+GIE); // Enter LPM3, enable interrupts
    printf("Hello world %d!\r\n", counter++);
    }

    return 0;
    }

  • Hi Chris,

    Those errors are telling you that those sections of code are too big for the available space that you are trying to squeeze the code section into.

    For the more wordy explanation, see:

    http://processors.wiki.ti.com/index.php/Compiler/diagnostic_messages/10099

    Note the important comment on C I/O (printf):

    "If you have added I/O code for debugging purposes this can be larger than expected. Specifically, printf() will not fit on many small embedded devices. Depending on the size of the device, the --printf_support=minimal option may solve the problem or printf() may not be a viable means of debugging at all."

    Simply put, printf takes up a lot of space and many small MCUs (like MSP430) doesn't have a lot of space for it.

    Thanks

    ki