• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » Code Composer Studio » Code Composer Forum » Code Composer v5 -- Standard Output with MSP430F2274?
Share
Code Composer Studio
  • Forum
  • Announcements
Options
  • Subscribe via RSS
Common Questions
  • Code Composer Studio Forum Usage Guidelines

  • Resources
  • Code Composer Studio (CCStudio) Product Folder
  • Troubleshooting CCS
  • CCS Wiki
  • Download CCS
  • Order CCS
  • Tools Insider Blog
  • Bug Tracking
  • Forums

    Code Composer v5 -- Standard Output with MSP430F2274?

    This question is answered
    Duane Niles
    Posted by Duane Niles
    on May 14 2012 15:11 PM
    Intellectual275 points

    Hi all,

    I'm current doing some recreational testing and debugging -- I have an eZ430-RF2500 chip with the MSP430F2274 on-board.

    Right now, the most I've done at this point was a simple interrupt-driven piece of code that switches the LEDs when the pushbutton is pressed.

    I'd like to use standard output with the board, which I've heard is possible, but I haven't gotten it working. I've currently included "stdio.h" and have a single printf() statement in the main of the program. I've also tried it with the printf() in the interrupt itself.

    When I run the program on the chip, everything still works fine with the printf() and all there -- just the printf() doesn't ever seem to trigger. Nothing in the console, etc.

    So is it possible to get this to work...? I figure it should be. Just not sure why it's not working.

    Thanks very much.

    console eZ430-RF2500 MSP430F2274 MSP430x22x4 Output stdio
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Lisa TI
      Posted by Lisa TI
      on May 14 2012 15:13 PM
      Guru100125 points

      Hi,

      have you tried opening a CIO console or the terminal plug-in?  What version of CCS do you use?  What printf settings do you have?  Do you have full printf support enabled?  Did you increase your stack or heap size?

      Best Regards,

      Lisa

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Duane Niles
      Posted by Duane Niles
      on May 14 2012 15:34 PM
      Intellectual275 points

      Hi Lisa,

      Thanks for the speedy response. I can't really easily find anything about most of those things in CCS (or documents) after having searched a lot prior to this.

      1. I am unsure of how to do so. The only thing I've found related to CIO is this doc which mentions setting Breakpoints for printf() and setting some option in Debug Options for the project. Neither of which did anything to display.
      2. I have Version 5.1.1.00031
      3. I'm not sure how to find this besides what I mentioned in #1.
      4. Same as #4. I've only found mention of the CIO enable in Debug Options for the project. I've tried with it on and off, using breakpoints and not using breakpoints.
      5. I'm not entirely sure how to find this either.

      Pardon my lack of knowledge, as I've tried searching quite a few documents already to no avail. I've done this kind of programming before, and I know what the things you're speaking of are (e.g. stacks and heaps) and how they relate to the hardware. But it's the first time I'm using an IDE for this, and I've never made such adjustments before. So I'm not entirely where to find them or how to figure such things out.

      So if you could point me anywhere in the IDE or in a document, that'd be greatly appreciated.

      Thank you again for the response.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on May 14 2012 15:41 PM
      Guru100125 points

      Hi Duane,

      Have a look at these two wiki topics and please keep us informed if they get you up and running

      http://processors.wiki.ti.com/index.php/Printf_support_for_MSP430_CCSTUDIO_compiler

      http://processors.wiki.ti.com/index.php/How_to_install_the_terminal_plugin_in_CCSv5

      Best Regards,
      Lisa

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Duane Niles
      Posted by Duane Niles
      on May 14 2012 16:22 PM
      Intellectual275 points

      Lisa,

      :EDIT:

      This is an edit to the below information. The datasheet states that this MSP430F2274 has 1 KB of RAM. So 80 for the stack and 92 for the heap should not be anywhere near the limit. But it appears to still give me error when I got beyond the 80 + 92 = 172 limit...

      :EDIT:

      Thanks again for the response. When attempting to follow the wiki, I have received the following error:

      • "../lnk_msp430f2274.cmd", line 63: error #10099-D: program will not fit into
           available memory.  run placement with alignment fails for section ".cio"
           size 0x120 .  Available memory ranges:
           RAM          size: 0x400        unused: 0x3e         max hole: 0x3c     

      When looking into the error for the size of the program, it suggests to do one of three things: 1) decrease the heap size I allocated; 2) optimize the code more; and 3) choose minimal printf().

      So the wiki showed an MSP430 getting allocated 320 bytes of memory for the heap and 160 for the stack. Currently my program has 80 and 80 for both (it was the default in the project I'm building off of) and it's a small program with next to nothing really happening.

      When I choose to disable printf() completely, then I keep decreasing the heap size allocated -- the highest I can allocate to the heap is 92 bytes before the above error shows. And that is with the " " blank option chosen for printf() support.

      If I choose Full printf() support after that, then the project still builds, but of course nothing happens. And well I figured it would do nothing anyway as the Wiki claims it needs 300 bytes of heap for full support.

      Similarly, minimal support does nothing either.

      So my last attempt was to check optimization, where if I set Optimization Level 4, it ran some extra processes to compile the code "better" -- but again, nothing happened with printf(). And if I attempt to increase the heap size with Optimization, I still get the same error -- but I guess that's simply because the MSP430 doesn't have enough memory for it?

      The same occurs if I increase the stack. So right now I have 80 for the stack, 92 for the heap in the Linker settings. If I increase either, I get the error -- so 172 bytes total? I'm just not sure how the one in the wiki has 160 + 320 = 480 bytes overall unless it's a completely different model of MSP430 with much more memory.

      So I'm supposing that I just can't use printf() on this...

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on May 15 2012 09:07 AM
      Guru100125 points

      Hi Duane,

      one thing that might be a good idea here is to check your compiler version.  Could you please go to Window->Preferences->Code COmposer Studio->Build->COde Generation Tools and see what version(s) of the MSP430 compiler you have?  Which are you using for this project.  There have been some known issues with printf so it may be I should send you a newer version offline.

      Best Regards,
      Lisa

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Duane Niles
      Posted by Duane Niles
      on May 15 2012 11:45 AM
      Intellectual275 points

      Lisa,

      I went to the preferences and found the following. "Tool Discovery Path" is:

      • C:/ti
      • C:/ti/ccsv5/tools/compiler

      "Discovered Tools" has "MSP430", underneath of which there are:

      • TI v4.0.2 [C:/ti/ccsv5/tools/compiler/msp430_4.0.2]
      • TI v4.0.0 [C:/ti/ccsv5/tools/compiler/msp430]

      If I hit Refresh next to the list of tools, the list remains the same.

      Thanks.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on May 15 2012 11:47 AM
      Guru100125 points

      Hi Duane,

      ok, let me send you a version offline to try with some specific bug fixes.  Please look for a friend conversation request.  I can then follow that with the instructions for you.

      Best Regards,
      Lisa

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Archaeologist
      Posted by Archaeologist
      on May 15 2012 12:04 PM
      Mastermind40900 points

      Try using puts instead of printf; puts has much lower memory footprint, so it should be easier to verify that CIO is working.

      See also http://processors.wiki.ti.com/index.php/Tips_for_using_printf

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Duane Niles
      Posted by Duane Niles
      on May 15 2012 16:52 PM
      Intellectual275 points

      Lisa,

      I installed the new compiler version and chose to set it as the Compiler for my project.

      Now that the Compiler is installed, the project will allow me to increase my Stack Size and Heap Size without throwing errors. Further, I'm able to set Full for printf() settings as well -- still no errors.

      I uncommented including "stdio.h" -- still no errors.

      However, the very last step -- when I uncommented printf() itself in my code, I got:

      • size 0x120 .  Available memory ranges:
           Recommend initializing all unused ports to eliminate wasted current
           RAM          size: 0x400        unused: 0x82         max hole: 0x80     

      So the new compiler version removed the erroneous mistakes with CCS not letting me increase my Stack and Heap space available. But the error still appears for printf(). The above error showed with 80 bytes of stack space, 380 bytes of heap space, and almost all of the previous functionality of my code commented. Note: It doesn't work even when I increase stack size, decrease either, etc etc. I tried 500 Stack Size (as I saw in the Wiki that the stack should be 400 or so high) and 380 Heap size. That's under the 1 KB of RAM needed for the Chip and almost everything in my program was not there except for the essentials. I figured this may be more than the 1KB anyway but I've kept decreasing each after to see the effects. The error still goes.

      And not that it gives much more information, but I just realized that when I double-click on the #10099-D error (I only tried clicking on the other error that comes with it before), it takes me to the linker ".cmd" file, and the error appears on the line "    .cio       : {} > RAM                /* C I/O BUFFER                      */", so of course it's only the CIO buffer.

      ---

      Also to Archaeologist,

      I will try puts and see what happens.

      Edit: Puts does nothing. Even with breakpoints, I get no output.

      Thanks.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on May 15 2012 19:50 PM
      Guru100125 points

      Hi Duane,

      let me give a few things a run through in the morning for you, but in the mean time have you

      -enabled  CIO output

      - opened a CIO console

      Best Regards,

      Lisa

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Duane Niles
      Posted by Duane Niles
      on May 16 2012 09:37 AM
      Intellectual275 points

      Lisa,

      Yes, I have ensured that I have done both. And not viewing a console would not cause a size error to show when the compiler runs.

      Thanks again.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on May 16 2012 10:15 AM
      Guru100125 points

      Hi Duane,

      I tried specifically on an F2274 and see the same thing.  I suspect you might be out of luck as this seems to be an issue that the device does not have enough memory to support printf.  Unfortunately printf is pretty heavy.

      You can have a look at these wikis just in case there might have been something missed here ...  but the device does not seem to like the min required stack/heap size unfortunately.

      http://processors.wiki.ti.com/index.php/Tips_for_using_printf

      http://processors.wiki.ti.com/index.php/Printf_support_for_MSP430_CCSTUDIO_compiler

      Hope this helps confirm the suspicions.

      Best Regards,

      LIsa

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Archaeologist
      Posted by Archaeologist
      on May 16 2012 10:54 AM
      Verified Answer
      Verified by Duane Niles
      Mastermind40900 points

      Try the following program.  It's nearly as small as you can get and still have CIO.  It does not use any heap, and needs only about 20 bytes of stack, so you can use -heap 0 and -stack 50.  This should trivially fit on a MSP430F2274 without danger of stack overflow.

      #include <stdio.h>
      #include <string.h>
      #include <file.h>
      
      int main() 
      {
          const char hello[] = "Hello, world\n";
          return write(1, hello, sizeof hello);
      }
      
      CIO
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Duane Niles
      Posted by Duane Niles
      on May 19 2012 13:44 PM
      Intellectual275 points

      Archaeologist,

      Thanks very much for that program.  That worked just fine with output.

      I will just look at the function closer and see what's going on in relation to my program.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Mykro Std
      Posted by Mykro Std
      on Sep 07 2012 16:38 PM
      Intellectual590 points

      Hi, Im trying to sink into programming and I have some strange behavious with CCS and msp430g2553 (launchpad).

      Im trying to printf test code (via JTAG to console - only for test) some string , but with CCS 5.2 I cant compile code because of 4 errors:

      #10010 errors encountered during linking; "LPad.out" not built

      #10099-D</a>  program will not fit into available memory.  run placement with alignment fails for section ".stack" size 0x50 .  Available memory ranges:

      #10099-D</a>  program will not fit into available memory.  run placement with alignment fails for section ".sysmem" size 0x50 .  Available memory ranges:

      #10099-D</a>  program will not fit into available memory.  run placement with alignment fails for section "DATA_GROUP" size 0xf6 .  Available memory ranges:

      I find (above) problem with heap or non available/less memory , so I increase heap size to 300,400,500 but still same error. I ascribed error to low hw resources on 2553, but same code WORK with IAR 5.40 in FULL printf model with size :

      6 652 bytes of CODE memory
      80 bytes of DATA memory (+ 15 absolute )
      34 bytes of CONST memory

      So whats the problem with CCS, when HW resources on chip are sufficient (consideration based on working code from IAR). Thanks ;)

      #include "msp430g2553.h"
      #include "stdio.h"


      void sendChar(unsigned char ch)
      {
      while(!(IFG2&UCA0TXIFG));
      UCA0TXBUF=ch;
      }

      void sendStr(const char *string)
      {
      while(!((*string) == '\0'))
      {
      sendChar(*string);
      string++;
      }
      }


      unsigned int fcia(unsigned int x) {
      unsigned int a=34123;
      unsigned int b=1;
      unsigned int *ptr;
      ptr=&b;
      b=x+a;
      UCA0TXBUF=*ptr;
      return b;
      }


      void main(void) {
      unsigned int c;
      WDTCTL = WDTPW + WDTHOLD; // Stop WDT
      BCSCTL1 = CALBC1_1MHZ; // 86 // Set DCO
      DCOCTL = CALDCO_1MHZ; // D2
      P1SEL = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD
      P1SEL2 = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD
      UCA0CTL1 |= UCSSEL_2; // SMCLK
      UCA0BR0 = 104; // 1MHz 9600
      UCA0BR1 = 0; // 1MHz 9600
      UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1
      UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
      IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt


      c=fcia(2);
      __delay_cycles(1);
      printf("numbe %c",c); //!!!!!!!!!!!!!!§HERE PRINTF
      __delay_cycles(1);
      __bis_SR_register(GIE); // Enter LPM0, interrupts enabled
      }

      msp430g2553 printf heap IAR
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use