• 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 » CCS v5.1 sprintf stdio funtion error
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

    CCS v5.1 sprintf stdio funtion error

    This question is answered
    graviton
    Posted by graviton
    on Apr 25 2012 21:46 PM
    Intellectual300 points

    When porting my CCSv4.2 code to CCSv5.1, I noticed a possible bug in the sprintf function. when I do

    char buffer[LARGE_ENOUGH_SIZE];

    sprintf(buffer, "prompt: %d", a_int_num);

    I have only one digit correct, all the following digits are 0xFFs

    e.g. if the a_int_num is 5, I got the string "prompt: 5" which is correct;

    if the a_int_num is 456, I got the string "prompt: 4\FF\FF", so the second and third digits, instead of ascii code of '5' and '6', the buffer content at those location are 0xFF.

    it doesn't matter the width option, if I use "%3d", %ld, I have the same error

    however, all floating point formats are OK, if I use %g, %f, %5.2f, etc. those formats are all correct, just the integars formating results are wrong.

    Everything worked in CCSv4.24

    Is this a possible bug, or I did something wrong? I used full printf support option.

    bug ccsv5.1 sprintf
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • randy.yates
      Posted by randy.yates
      on Apr 26 2012 07:02 AM
      Prodigy350 points

      Did you extend your heap_size? Granted that it worked in 4.x, but heap problems can appear random. 

      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 Apr 26 2012 09:33 AM
      Guru103710 points

      What target are you using?  Is it the MSP430?  If so, what compiler version is associated with your project?

      Best Regards,
      Lisa

      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 04 2012 14:05 PM
      Guru103710 points

      Hi Randy,

      I just thought I would check if there is any update with your enquiry? 

      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 10 2012 11:08 AM
      Verified Answer
      Verified by Lisa TI
      Mastermind41435 points

      You are probably suffering from SDSCM00042077, which is fixed in compiler version 4.0.1

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • graviton
      Posted by graviton
      on May 11 2012 10:44 AM
      Intellectual300 points

      Thanks, everyone! As Archaeologist suggested, after updating the CGT to v4.02, the problem is solved.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • lakeweb
      Posted by lakeweb
      on May 29 2012 17:09 PM
      Prodigy140 points

      I thought  I would mention as I ran into the same problem. Where %i doesn't work properly, %d seems to do fine. Using %d looks to be the simplest solution.

      Best, Dan.

      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