Jump to content
Sign in to follow this  
Alan

mspgcc output binary sizes

Recommended Posts

I found an installed copy of 20110612 and verified that https://sourceforge.net/tracker/?func=d ... tid=432701 is present in it. The effect of this bug is that your code with -gc-sections is missing the main routine; you can verify this by using msp430-objdump -d and seeing what's actually left in the program. Naturally, no main = no operation.

 

You'll need to update to LTS-20110716+patches. As I suggested earlier, badger Ubuntu. Alternatively, I believe there are currently patched debs available on http://tinyprod.net/ but as I don't use Ubuntu have no idea how to hook into that repository beyond whatever you can glean from https://www.millennium.berkeley.edu/pip ... 52758.html.

Share this post


Link to post
Share on other sites
I'm using the 20110706 msp430-gcc with all the patches applied. It is funny that you are getting a different size clock.elf. You might want to check your path and make sure you are getting the correct msp430-gcc.

The -Os flag being in EXTRAFLAGS explains the size difference. Both 20110612 and 20110716 generate a 284 byte text when building with the same flags (though the flags do remove some unreferenced data). Using:

CC=msp430-gcc

CFLAGS= -Wall -g -Os
GCFLAGS= -fdata-sections -ffunction-sections -Wl,--gc-sections

all: clean clock.elf clockgc.elf

clock.elf: main.c
$(CC) $(CFLAGS) -mmcu=msp430g2553 -o $@ $<
msp430-size $@

clockgc.elf: main.c
$(CC) $(CFLAGS) $(GCFLAGS) -mmcu=msp430g2553 -o $@ $<
msp430-size $@

clean:
-rm *.elf

I get:

linux[26]$ PATH=/msp430/install/mspgcc-4.5.2-20110612/bin:${PATH} make
rm *.elf
rm: cannot remove `*.elf': No such file or directory
make: [clean] Error 1 (ignored)
msp430-gcc -Wall -g -Os -mmcu=msp430g2553 -o clock.elf main.c
msp430-size clock.elf
  text    data     bss     dec     hex filename
   284       0       6     290     122 clock.elf
msp430-gcc -Wall -g -Os -fdata-sections -ffunction-sections -Wl,--gc-sections -mmcu=msp430g2553 -o clockgc.elf main.c
msp430-size clockgc.elf
  text    data     bss     dec     hex filename
   122       0       1     123      7b clockgc.elf

and

vmserver[151]$ PATH=/msp430/install/ltsdev/bin:${PATH} make
rm *.elf
msp430-gcc -Wall -g -Os -mmcu=msp430g2553 -o clock.elf main.c
msp430-size clock.elf
  text    data     bss     dec     hex filename
   284       0       6     290     122 clock.elf
msp430-gcc -Wall -g -Os -fdata-sections -ffunction-sections -Wl,--gc-sections -mmcu=msp430g2553 -o clockgc.elf main.c
msp430-size clockgc.elf
  text    data     bss     dec     hex filename
   284       0       3     287     11f clockgc.elf

 

Note that I did some cleanup on the Makefile: the -L and -I flags aren't necessary, and the rm benefits from a - in front so it works when the file isn't present (do that, or use -f).

Share this post


Link to post
Share on other sites
The effect of this bug is that your code with -gc-sections is missing the main routine; you can verify this by using msp430-objdump -d and seeing what's actually left in the program.

I can confirm main is awol.

 

Note that I did some cleanup on the Makefile.

Thanks very much, I'll change mine to match. I had some initial issues using the compiler and I neglected to remove certain things from my Makefiles after I realised the correct way to do them. Should have removed the rm before posting, threw that in there as a quick fix as otherwise thinks everything is up to date no matter how many changes I made to the source :S Was also good encouragement to avoid syntax errors.

 

You'll need to update to LTS-20110716+patches. As I suggested earlier, badger Ubuntu.

Thanks I'll look into patching first, then see if I can find out how to go about requesting the Ubuntu guys do the same.

EDIT: I think I'll just badger Ubuntu actually. I reported it as a bug if anyone else stumbles across this, since it technically is. God knows when they'll get round to it though.

 

Thanks for all the advice guys. Good to know its not (directly) my fault.

Share this post


Link to post
Share on other sites
You'll need to update to LTS-20110716+patches. As I suggested earlier, badger Ubuntu.

Thanks I'll look into patching first, then see if I can find out how to go about requesting the Ubuntu guys do the same.

EDIT: I think I'll just badger Ubuntu actually. I reported it as a bug if anyone else stumbles across this, since it technically is. God knows when they'll get round to it though

.

 

Sorry for the inconvenience, it looks like the packages were not properly synched from Debian as they should be.

Fixed packages may be handpicked from debian, and I'm now trying to get someone synch them in Ubuntu too.

Share this post


Link to post
Share on other sites

Sorry for the inconvenience, it looks like the packages were not properly synched from Debian as they should be.

Fixed packages may be handpicked from debian, and I'm now trying to get someone synch them in Ubuntu too.

Cheers. I'm assuming that is you who replied to the bug? Or just some other knowledgeable person:D

 

If anyone else stumbles across the same issue on Ubuntu btw here is the raised bug: https://bugs.launchpad.net/ubuntu/+source/gcc-msp430/+bug/912709

Share this post


Link to post
Share on other sites

Cheers. I'm assuming that is you who replied to the bug? Or just some other knowledgeable person:D

 

If anyone else stumbles across the same issue on Ubuntu btw here is the raised bug:

 

Yes, I am. Thanks to Andrea it has been synched today. So, bug closed :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×