optimize for size for the epiphany

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

optimize for size for the epiphany

Postby schmurfy » Tue May 20, 2014 9:37 am

Hi,

I am trying to get pHash running on the epiphany, I managed to find some flags for gcc to remove what is not needed but I am still having a hard time making it fit into the 32K on a core.

Since I use only two function of pHash I extracted them out into my pHash.cpp so the size is pretty small, he problem comes from its dependencency CImg which is one freaking huge file, by using the various optimization flags I found (see the Makefile below) I reduced the size grealty but there is still a lot remaining (gcc says I exceed the internal ram by 192824 bytes xD).
I tried to remove large chunks of CImg I wasn't using but it just confirmed the optimization already removed them since the final size did not change by even a byte after removing hundreds of lines.

From there I am not sure where to go, is there a way to know what exactly is using space in the resulting object files ?
If at least I can find what is taking so much space I can track down what is using it.

Here is the Makefile I am currently using: https://gist.github.com/schmurfy/3f6f7c ... e-makefile

What is really weird is that I somehow managed to make it fit but only once, as soon as I recompiled it gcc started complaining again it was too big for the internal ram :(
schmurfy
 
Posts: 12
Joined: Mon Dec 17, 2012 3:22 am

Re: optimize for size for the epiphany

Postby ysapir » Tue May 20, 2014 3:11 pm

generally, the e-objdump utility is your friend. One thing you can try is to increase the available memory in the LDF so the program finishes its build. Then use e-objdump to carefully inspect the various object allocation and make your adjustment. Beware not to try loading this executable on the actual hardware, b/c some of your allocated memory is fictional.
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Re: optimize for size for the epiphany

Postby schmurfy » Wed May 21, 2014 9:54 am

thanks,
I will check this tool see if I can find my culprit :)
schmurfy
 
Posts: 12
Joined: Mon Dec 17, 2012 3:22 am

Re: optimize for size for the epiphany

Postby schmurfy » Wed May 21, 2014 5:25 pm

I feel stupid but I have no idea how e-objdump can help me :o

I used the legacy.ldf to allow the compilation to finish but after looking at all the flags of e-objdump and trying them on the final elf file I don't how how to make sense of the different outputs.
schmurfy
 
Posts: 12
Joined: Mon Dec 17, 2012 3:22 am

Re: optimize for size for the epiphany

Postby ysapir » Fri May 23, 2014 9:06 am

I usually use "e-objdump -D" to get a listing of all the placed objects - location and size, and for the disassembly. It can be overwhelming at first, but you get used to it. If you just want to see the section sizes, then you can use the "e-size" utility. Since you mentioned you are trying to understand what takes space in the executable, then objdump will show you every function and object in the binary, so you can analyze the memory consumption. The "-x" option can help in listing the objects and symbols so you can have a more concise view of the memory.
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 12 guests

cron