energia / Energia

Fork of Arduino for the Texas Instruments LaunchPad's
http://energia.nu
Other
793 stars 673 forks source link

MSP430. Real String problem #220

Closed C-In-OFF closed 11 years ago

C-In-OFF commented 11 years ago

// IDE ENERGIA 0101E0009 + MSP430G4252 + Windows 7/XP

String stringOne; String stringTwo; String stringTree;

void setup() { Serial.begin(9600); stringOne = String("0123456789ABCD"); //stringOne = String("0123456789ABCDE"); // <--- Point "A" stringTwo = String("XYZ"); stringTree = String("ZYX"); Serial.println("\n\n***Test******"); }

void loop() { stringOne += stringTwo; stringTwo = stringOne + stringTree; Serial.println(stringOne); Serial.println(stringTwo); // <--- Point "B" Serial.println(stringTwo.length()); // <--- Point "C" Serial.println("End"); while(true); }

If [stringOne] add 1 symbol (look Point "A"), than script do not work. (look Point "B" & "C") [stringTwo] will be = NULL !!! Why?

rei-vilo commented 11 years ago

Please read the specification sheet of the MSP430G2452 available at http://www.ti.com/lit/ds/symlink/msp430g2112.pdf

The MSP430G2452 features 256 bytes only of RAM.

The String object you're using wastes a lot of memory so you're running out of memory.

Use instead the char array as described at http://arduino.cc/en/Reference/String or use a MCU with more RAM as the MSP430G2553.

@C-In-OFF

Have you posted your question there? I haven't seen any post about that topic.

So I close this issue just like #219 and I ask you not to open another one. Thank you.

C-In-OFF commented 11 years ago

Thanks.

I am try use MSP430G2553. Real No Problem. Tell me please, how can I see free size of RAM in IDE ENERGIA in my Cod?

and about a more suitable place as forum.43oh: some peoples from 43oh say: "... For energia constants look into the sources/energia web site/forums" http://forum.43oh.com/topic/3590-problem-using-arduino-code-in-energia/

On Fri, Apr 5, 2013 at 1:50 AM, Rei Vilo notifications@github.com wrote:

Please read the specification sheet of the MSP430G2452 available at http://www.ti.com/lit/ds/symlink/msp430g2112.pdf

The MSP430G2452 features 245 bytes only of RAM.

The String object you're using wastes a lot of memory so you're running out of memory.

Use instead the char array as described at http://arduino.cc/en/Reference/String or use a MCU with more RAM as the MSP430G2553.

@C-In-OFF https://github.com/C-In-OFF

  • This is a duplicate with question #219https://github.com/energia/Energia/issues/219 .
  • As I said, the forum at http://forum.43oh.com/forum/28-energia/ is a more suitable place for this kind of question.

Have you posted your question there? I haven't seen any post about that topic.

So I close this issue just like #219https://github.com/energia/Energia/issues/219and I ask you not to open another one. Thank you.

— Reply to this email directly or view it on GitHubhttps://github.com/energia/Energia/issues/220#issuecomment-15929129 .

rei-vilo commented 11 years ago

String is not a constant but a type.

On the 43oh forum, do a search with ram usage.

First answer found is Application RAM Usage with code.

rei-vilo commented 11 years ago

To know the FLASH and estimated RAM used,

``` /Applications/Energia.app/Contents/Resources/Java/hardware/tools/msp430/bin/msp430-size

$/Applications/Energia.app/Contents/Resources/Java/hardware/tools/msp430/bin/msp430-size /var/folders/kd/70m4ltxn14l086ddy860ff3c0000gn/T/build7439050874009286986.tmp/Blink.cpp.elf text data bss dec hex filename 590 0 6 596 254 /var/folders/kd/70m4ltxn14l086ddy860ff3c0000gn/T/build7439050874009286986.tmp/Blink.cpp.elf


* do the maths:

text + data = FLASH bss + data = estimated SRAM

C-In-OFF commented 11 years ago

Wow! :-)

I am found msp430-size.exe in dir: C:\Program Files\Energia\hardware\tools\msp430\bin

but can't find Blink.cpp.elf I am use Windows. No UNIX OS.

message after run msp430-size.exe in terminal: 'a.out' : No such file

But... many Thanks. CS

On Wed, Apr 10, 2013 at 4:08 PM, Rei Vilo notifications@github.com wrote:

To know the RAM used,

  • find the location of the avr-size utility /Applications/Energia.app/Contents/Resources/Java/hardware/tools/msp430/bin/msp430-size
  • find the location of the elf file /var/folders/kd/70m4ltxn14l086ddy860ff3c0000gn/T/build7439050874009286986.tmp/Blink.cpp.elf

    open a terminal window and type the command

    $/Applications/Energia.app/Contents/Resources/Java/hardware/tools/msp430/bin/msp430-size /var/folders/kd/70m4ltxn14l086ddy860ff3c0000gn/T/build7439050874009286986.tmp/Blink.cpp.elf text data bss dec hex filename 590 0 6 596 254 /var/folders/kd/70m4ltxn14l086ddy860ff3c0000gn/T/build7439050874009286986.tmp/Blink.cpp.elf

    do the maths:

    text + data = FLASH bss + data = SRAM

— Reply to this email directly or view it on GitHubhttps://github.com/energia/Energia/issues/220#issuecomment-16172840 .

rei-vilo commented 11 years ago

Please refer to http://forum.43oh.com/topic/3682-flash-and-estimated-ram-usage/?p=33054

I strongly recommend reading Getting Started with Arduino by Massimo Banzi co-founder of Arduino

img

rei-vilo commented 11 years ago

See https://github.com/energia/Energia/wiki/FLASH-and-estimated-RAM-Usage

C-In-OFF commented 11 years ago

Thank for links.

I am understand. And found ELF files. Hm. But result is strange. RAM size (incorrect working version script on MSP430G2452) = 72 byte.

No Overload! And No Compilation Errors! But script is No working. (S1 String = "0123456789ABCDE") See screenshot [RAM No work Scrpit.jpg]

And if I am Delete One symbol in String S1 (S1 String = "0123456789ABCD") - then Script OK! ))) See screenshot [RAM Scrpit OK.jpg]

On Wed, Apr 10, 2013 at 6:34 PM, Rei Vilo notifications@github.com wrote:

See https://github.com/energia/Energia/wiki/FLASH-and-estimated-RAM-Usage

— Reply to this email directly or view it on GitHubhttps://github.com/energia/Energia/issues/220#issuecomment-16182032 .