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.
Hello,
It seems that the sprintf() does not work when used wit the MSP430F5529. And the problem is not related to its implementation as it does not work even in its simplest form.
For example the following:
char st[16]; // the buffer is allocated in RAM
sprintf(st, "TEST");
puts random chararcters in the buffer st.
also sprintf(st, "%s", "Test"); does not work either
All the other forms of sprintf(.....) produce the same incorrect result. Any tip how to make it work?
Thanks in advance,
Mario
Mario,
I see that you posted the question on the MSP430 forum as well. As suggested there, try increasing both stack and heap size. These can be set from Project Build Properties->C/C++ Build->Linker->Basic Options.
This article contains some helpful tips in general: http://processors.wiki.ti.com/index.php/Tips_for_using_printf
Be sure you #include <stdio.h> . That is the most common mistake in such situations.
Thanks and regards,
-George
Hi aarti,
first of all, sorry for posting twice the same issue but I was not sure the first was sent to the right place. Additionally, I sent the second one just a couple of minute before your reply.
I tried increasing the stack and it worked fine; thanks a lot.
However, I wonder where I can get information, similar to the ones in the article you mentioned, in order to know all the requirements for all the functions in libc.a.
Thanks a lot indeed,
Mario
Hi George,
STDIO.H was incuded, the problem was in the size of stack.
Regards,
Mario
The MSP430 C/C++ Compiler Users Guide contains a section (Chapter 7) on the runtime support library and requirements for some of the functions. The C I/O functions failing due to insufficient stack or heap space has been seen many times before, hence we have also captured this information in wiki articles. It has also come up a few times in these forums as well.
In addition to the Users Guides, searching the Embedded Processors wiki and this forum can produce a lot of good information on frequently asked questions.
Hi Aarti,
thank you for your reply. I understand I am a bit annoying but I am new of Code Composer, not for MSP430 however, as I come from IAR and thus sometimes it is difficult for me to orientate in all the docs as well knowing where to look for the information.
Thanks a lot indeed,
Regards,
Mario Monti
I ran into this problem too. I but did not know what to do about it.
My assumption was that I was doing something wrong, so thank you for this post.
I needed to convert 16 bit numbers to HEX strings, so so that I could save data from the ADC12 to a MMC card.I wrote a function to do this which was probably more compact than using Sprintf since I only needed this one format. This was probably lucky misfortune. It was frustrating though to find that sprintf did not work. It made me feel like I was building my house on sand.
Given the price of the Code Composer Studio, compared to the IAR solution, I am willing to live with a lot of difficulties using CCS. The problems I have encountered are due to my lack of experience. Is there a known list of problems, people have found using CCS and the associated workarounds somewhere?
Thank you mark