When porting my CCSv4.2 code to CCSv5.1, I noticed a possible bug in the sprintf function. when I do
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.
Did you extend your heap_size? Granted that it worked in 4.x, but heap problems can appear random.
What target are you using? Is it the MSP430? If so, what compiler version is associated with your project?
I just thought I would check if there is any update with your enquiry?
You are probably suffering from SDSCM00042077, which is fixed in compiler version 4.0.1
Thanks, everyone! As Archaeologist suggested, after updating the CGT to v4.02, the problem is solved.
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.
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.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.