olivluca 12 Posted September 29, 2012 Share Posted September 29, 2012 Hello, I just received my launchpad and I'm going through the examples supplied with Energia. The StringAdditionOperator shows garbage after the first addition (I substituted * for the unprintable character that shows as a square in the serial monitor): Adding strings together (concatenation):stringThree = 123ing*ngThree = *i*Three**g*ngThree = ***g*ngThree = *i **ringTh123456789* Quote Link to post Share on other sites
olivluca 12 Posted September 29, 2012 Author Share Posted September 29, 2012 I realized that the msp430 has only 512 bytes of ram, maybe that's too little for the String class. Quote Link to post Share on other sites
energia 485 Posted October 1, 2012 Share Posted October 1, 2012 msp430 indeed has very little ram to go on and dynamic memory (re)allocation as used by the WString lib has to be used with care and avoided if at all possible. With that said, this code should have worked just fine since there is plenty of ram left in a small Sketch like this. The culprit is that realloc() was replaced by alloc() due to lack of realloc() in mspgcc. This leeds to all kinds of issues since the original string is not preserved which results in garbage in the serial output. Will look into a fix for the next release. Bug is files as: https://github.com/energia/Energia/issues/113 Thanks for the report! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.