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 in CCE v3.1 SR1

Other Parts Discussed in Thread: MSP430F2274

Below is the code I'm using to try and print information to the CCE console (CIO). I am following a tutorial, but have been unable to get anything to print. Is there something I'm missing? I am sorry if it does not format properly. Anyone have a suggestion on how to paste code in?

#include

 

<msp430x22x4.h>

#include

 

<stdio.h>

void

 

main()

{

WDTCTL = WDTPW + WDTHOLD;

 

 

while(1)

{

printf(

"Hello, World");

}

}

  • Have you followed the steps outlined in this FAQ, http://tiexpressdsp.com/index.php/CCE_FAQ#How_to_use_printf_in_CCE_v3.3F?

    C I/O functions such as printf require a lot of heap space, so as mentioned in the FAQ you would need to increase your heap size within the Project Buid options.

     

  • Aarti,

    Thanks for the link to the help files. I followed the instructions provided in the pdf but I'm receiving some errors.

    The linking failed stating "run placement fails for object ".cio"" and..
    "run placement fails for object ".sysmem""

    I search for information on these errors and it looks like my target may not enough RAM to support the I/O functions. My target is an MSP430F2274 on the eZ430-rf2500.

  • Yes that is the likely cause. The F2274 has only RAM size of 0x400 and as you can see from the linker command file (lnk_msp430f2274.cmd), the sections .bss, .sysmem, .stack and .cio are all allocated to RAM. Since CIO functions typically need a lot of heap (.sysmem section) you might be running out of RAM space on the device.

    You can create a map file that produces a listing of the input and output sections from the linker where you can review how much space is taken up by each of these sections:

    Project-Properties->C/C++ Build -> Tool Setttings -> MSP430 Linker -> Linker Output -> Produce listing of input and output sections in <file> (--map_file)

  • Hi, Aarti ,

               By the way, does this "printf trick" apply to "cout" in C++ 's iostream library?

    Br,

    AppleCat

  • Yes I would expect it to apply to cout as well.