Deadstripping unused code

Topics for the Eclipse Environment
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Deadstripping unused code

Post by sblair »

It doesn't appear that by default the Linker is deadstripping unused functions when compiling. Does anyone know if there are options to enable this?

I admit that I'm quite used to the Codewarrior tools which will deadstrip any unused vars and code, including inside libraries which saves a TON of space. With the amount of libraries linked in and trying to add in AJAX I'm really bumping into the ceiling on flash space and would like to have it deadstrip to make space.

Thanks,
Scott
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Deadstripping unused code

Post by sblair »

Anyone?

:?:
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Deadstripping unused code

Post by tod »

See if this answer on StackOverflow does you any good. I believe the more recent NNDK's are using the GCC 4.2.1 toolchain so you can also look at the gcc docs to see if -dead-strip or strip-unneeded are supported. There is a GUI setting for the linker to optimize for size, not sure how much that gets you.
User avatar
pbreed
Posts: 1082
Joined: Thu Apr 24, 2008 3:58 pm

Re: Deadstripping unused code

Post by pbreed »

The basic GCC linker does not do this.
The correct answer is to split up a bunch of files into smaller compliation units so the linker can be smart.
We did this for the SBL2E and greatly reduced the space used.

I have an active project to rearrange the system files and do this, alas it probably will not bear fruit for at least 6 months.

Does anyone know of any automatic/semi automatic refactoring tools that will do this?


Paul
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Deadstripping unused code

Post by sblair »

That sucks. I didn't realize how spoiled I've been by the CodeWarrior tools for the last 10 years. I just took it for granted everyone would have this feature by now. It's a godsend for doing embedded development!
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Deadstripping unused code

Post by rnixon »

Which platform are you using? Even if everything is included, the final apps I build are still pretty small. When you do a build, what does eclipse say you are using for compressed space?
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Deadstripping unused code

Post by sblair »

I'm over a 100% of space used with everything in there. Right now I'm leaving the AJAX prototype.js pulled out to get it to compile. I'm on a Mod5270B. I'd kill for a version with more Flash.
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: Deadstripping unused code

Post by seulater »

might not be practical for your app but you can always use a SD card to hold your web site files on.
Previously, we were using Flex for our web site, which pushed us out of flash area as Flex is a pig on final outputs.
So we added a micro SD card to out boards and placed the whole site on that.
Now we use Silvelight, and its far better for size. As a comparison, the Flex site was 480k, the same site in silverlight was 12k
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Deadstripping unused code

Post by sblair »

Yeah, unfortunately that ship has pretty much sailed as I just had my carrier board built already. I wasn't expecting to be this close on space at all when I turned my guy loose on designing it.

It was the recent attempt to add both AJAX support and IUI for the IOS webpage support that pushed me so far over the edge. With the amount of libraries involved in the basic Netburner setup I'm a bit shocked that it doesn't sound like there is an option available to deadstrip. That was such a huge feature for me in the CodeWarrior stuff the few time I wanted to pull in string libraries so that it only brought in the space for the couple functions I used rather than the entire library.
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: Deadstripping unused code

Post by seulater »

i dont know if this may help. I have a LCD project where i have something like 20 different fonts and many different screen images.
all my fonts are in their own files. like Lucida_20.cpp, Lucida_22.cpp and so on.

i included the entire font set just in case they want a quick change to another font, but some projects use only 2 fonts and others may use 4.
so what i do to keep the size down is in eclipse you can right click on the file name and click exclude from build.
Post Reply