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.

Implementation of Sprintf/Snprintf into TI CCS

Other Parts Discussed in Thread: MSP430G2232

Hello everyone,

I am currently working on my final year project and i encountered some problems with my software when using TI CCS. Right now, i am trying to print out a value from a variable and display it out into my LCD screen. I am currently using MSP430g2232 and the code for my LCD is from - https://sites.google.com/site/cacheattack/msp-projects/msp430-launchpad-with-lcd-module#TOC-MSP430-Pin-Interface-to-LCD . The code from the website is fine as i can print out the words and seen on my LCD screen. However, i am clueless as to how to print out values from a variable into my LCD screen. For example, if i declare an int i = 8 , i am not sure what function to use to print it out on the screen. I have researched on the internet and they say to use Sprintf/Snprintf. I have tried a few codes from the internet using Sprintf/Snprintf but there are always 4 errors showing out as seen below.  I am quite new to programming and all help are appreciated (: 

Thank you,

Captain Spock

 

  • The specific linker errors you are seeing during build time mean that there were several compiler generated sections (for code, data, cio) that could not be allocated into memory because they were too large. Depending on the amount of CIO in the code, this could happen in MSP430 devices with limited memory. Check the project build options and see if the option --printf_support=minimal is enabled. If not, enable this option and see if the build completes.

    Having said that, sprintf may not be the best option in your case as there may be a better, more efficient way to print to your LCD. I will move your post to the MSP430 forum as the folks there would be more familiar with setting up and printing to LCD and could suggest alternate methods.

  • AartiG is right. The errors come from too much code for a small MSP.
    sprintf code is quite large, especially with support for all value types enabled. Limited (s)printf support only supports string output or integer.
    The 2k flash of the 2232 are rapidly filled.
    Your total code size (as shown in the 'text segment' error message) is 0xbec bytes, which is nearly 3k.

    However, (s)printf also makes heavy use of the stack. The 2232 only has 256 bytes ram for variables and stack. Not much space here.
    And the last two errors tell that bss is 0x22c bytes (= 556 bytes) and .css is 0x120 bytes (= 288 bytes). both are much larger than the available amount of ram, not counting the stack at all. And I don't think those will shrink much if you omit the usage of sprintf.

    your project (or at least you programming concept) is much too much for the poor little MSP you try to fit it in.

**Attention** This is a public forum