Jump to content
Sign in to follow this  
ChikamaYan

Serial.print(float) statement can't be compiled

Recommended Posts

  • LaunchPad board name and version: MSP430G2553 
  • Energia IDE version (found in Energia > About Energia menu): 0101E0017
  • Board package version (found in Tools > Boards > Boards Manager menu): no board manager
  • OS name and version: windows10

Following is all my code:

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  float test =1.0;
  Serial.println(test);
}

However I get a large number of errors when verifying it:

c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld.exe: sketch_nov16a.cpp.elf section `.text' will not fit in region `rom'

c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld.exe: section .vectors loaded at [0000ffe0,0000ffff] overlaps section .text loaded at [0000f800,00010b85]

c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld.exe: region `rom' overflowed by 3264 bytes

c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libcrt0.a(_copy_data.o): In function `__do_copy_data':/root/mspgcc-20120406/BUILD/gcc/gcc/../../../gcc-4.6.3/gcc/config/msp430/crt0.S:195: relocation truncated to fit: R_MSP430_16_BYTE against symbol `__data_load_start' defined in *ABS* section in sketch_nov16a.cpp.elfcore.a(TimerSerial.cpp.o): In function `TimerSerial::TimerSerial()':

TimerSerial.cpp:(.text._ZN11TimerSerialC2Ev+0x10): relocation truncated to fit: R_MSP430_16_BYTE against symbol `vtable for TimerSerial' defined in .rodata._ZTV11TimerSerial section in core.a(TimerSerial.cpp.o)

c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3/crt0ivtbl16.o: In function `__isr_14': (.text+0x2): relocation truncated to fit: R_MSP430_16 against symbol `_unexpected_' defined in .text.crt0 section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libcrt0.a(_unexpected_.o) core.a(Print.cpp.o): In function `Print::printFloat(double, unsigned char)':

Print.cpp:(.text._ZN5Print10printFloatEdh+0x22): relocation truncated to fit: R_MSP430_16 against symbol `__ltsf2' defined in .text section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libgcc.a(_lt_sf.o)

Print.cpp:(.text._ZN5Print10printFloatEdh+0x52): relocation truncated to fit: R_MSP430_16 against symbol `__divsf3' defined in .text section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libgcc.a(_div_sf.o)

Print.cpp:(.text._ZN5Print10printFloatEdh+0x68): relocation truncated to fit: R_MSP430_16 against symbol `__addsf3' defined in .text section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libgcc.a(_addsub_sf.o)

Print.cpp:(.text._ZN5Print10printFloatEdh+0x78): relocation truncated to fit: R_MSP430_16 against symbol `__floatunsisf' defined in .text section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libgcc.a(_usi_to_sf.o)

Print.cpp:(.text._ZN5Print10printFloatEdh+0x84): relocation truncated to fit: R_MSP430_16 against symbol `__subsf3' defined in .text section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libgcc.a(_addsub_sf.o) Print.cpp:(.text._ZN5Print10printFloatEdh+0xa2): relocation truncated to fit: R_MSP430_16_BYTE against `no symbol'

Print.cpp:(.text._ZN5Print10printFloatEdh+0xba): relocation truncated to fit: R_MSP430_16 against symbol `__mulsf3' defined in .text section in c:/users/chikamayan/downloads/compressed/energia-0101e0017-windows/energia-0101e0017/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3\libgcc.a(_mul_sf.o)

Print.cpp:(.text._ZN5Print10printFloatEdh+0xc2): additional relocation overflows omitted from the output

collect2: ld returned 1 exit status

 

Anyone knows what's the cause?
Ps. I posted this issue on github before and was told it's because of memory overflow. However, I was just verifying the code and didn't actually upload it to my launchpad, so I guess that's not the case?

Share this post


Link to post
Share on other sites

My experience with C compilers says: Look at the first message; in general, all the other errors flow from that.  Same for Java.

> `.text' will not fit in region `rom'

Indicates your program (and library calls) will not fit in the G2553. Since it won't fit, it doesn't upload.

 

Share this post


Link to post
Share on other sites

Hi @ChikamaYan

I haven't used Energia in a while but I noticed there is a new version 1.0.2 available from the Boards Manager in Energia V18.  I just tried it with the following on a Windows 10 machine and it worked as expected.

void setup(){
  Serial.begin(9600);
  Serial.println("Starting...");
}
void loop(){
  float test = 1.0;
  Serial.println(test);
}

When I copied your code I got a message about an extraneous character.  Use the <> code insertion feature in 43oh when you insert code and it will end up like what I posted above.

I notice the G2452 is available again also.  Took a quick look at github and it looks like the FR2433 is being implemented in Energia as well.  I have been fooling around with the FR2411 in CCS and like it - should be a good replacement for the G2553 but I wish it was available in TSSOP package.

 

Share this post


Link to post
Share on other sites

The offending Sketch will compile with the latest version of the MSP430 core in Energia 18. There is an issue with the -g flag and floats. It seems to pull in extra code that causes the overflow.

My advice would be to upgrade to Energia 18 and then update the core through the boardmanager to the latest version.

Robert

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...