UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
197 Views
Registered: ‎03-03-2017

ELF size reduction techniques

I am working on a Kintex-7 project in Vivado /SDK 2018.1 and am needing to reduce my ELF size so I can reduce my BRAM size in my implementation.   The current ELF size is 332K if I use -Os in the compiler.   

Is there some way is SDK to breakdown what files/functions etc are taking the space so I can start focusing on what I need to remove to reduce the size?    I am hoping for something like the utilization report you can get in Vivado.  

Thanks.  

Tim

0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
179 Views
Registered: ‎02-01-2008

Re: ELF size reduction techniques

First, I would try changing the SDK build configuration for your app from ‘Debug’ to ‘Release’.

The size of functions is avaliable by running 'mb-objdump.exe -D yourApp.elf' or simply by double clicking on the elf within SDK.

 

0 Kudos
170 Views
Registered: ‎03-03-2017

Re: ELF size reduction techniques

@johnmcd ,

   Thanks for the response.  I wasn't aware of the Release/Debug settings.   Setting it to Release it went from 332K down to 313K where my goal is <256K so I can change my BRAM from 512K to 256K.

   See below for what is seen when I double click the ELF file.   Is this the section you are talking about?   Since this is Release, I wonder why there is so much space being used for ".debug_*?

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .vectors.reset 00000008  00000000  00000000  00000094  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .vectors.sw_exception 00000008  00000008  00000008  0000009c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .vectors.interrupt 00000008  00000010  00000010  000000a4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .vectors.hw_exception 00000008  00000020  00000020  000000b4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  4 .text         0003f844  00000050  00000050  000000bc  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  5 .init         0000003c  0003f894  0003f894  0003f900  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  6 .fini         00000020  0003f8d0  0003f8d0  0003f93c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  7 .ctors        00000008  0003f8f0  0003f8f0  0003f95c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  8 .dtors        00000008  0003f8f8  0003f8f8  0003f964  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  9 .rodata       0000ce64  0003f900  0003f900  0003f96c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .sdata2       00000004  0004c764  0004c764  0004c7d0  2**0
                  ALLOC
 11 .data         00000d34  0004c768  0004c768  0004c7d0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 12 .sdata        00000004  0004d49c  0004d49c  0004d504  2**0
                  ALLOC
 13 .sbss         00000000  0004d4a0  0004d4a0  0004d504  2**0
                  CONTENTS
 14 .bss          00004b5c  0004d4a0  0004d4a0  0004d504  2**2
                  ALLOC
 15 .heap         00001004  00051ffc  00051ffc  0004d504  2**0
                  ALLOC
 16 .stack        00001000  00053000  00053000  0004d504  2**0
                  ALLOC
 17 .debug_frame  000006ec  00000000  00000000  0004d504  2**2
                  CONTENTS, READONLY, DEBUGGING
 18 .debug_info   0000db6c  00000000  00000000  0004dbf0  2**0
                  CONTENTS, READONLY, DEBUGGING
 19 .debug_abbrev 00003f96  00000000  00000000  0005b75c  2**0
                  CONTENTS, READONLY, DEBUGGING
 20 .debug_loc    00004f5f  00000000  00000000  0005f6f2  2**0
                  CONTENTS, READONLY, DEBUGGING
 21 .debug_aranges 000004a8  00000000  00000000  00064658  2**3
                  CONTENTS, READONLY, DEBUGGING
 22 .debug_ranges 00000560  00000000  00000000  00064b00  2**0
                  CONTENTS, READONLY, DEBUGGING
 23 .debug_line   000070d8  00000000  00000000  00065060  2**0
                  CONTENTS, READONLY, DEBUGGING
 24 .debug_str    00000fda  00000000  00000000  0006c138  2**0
                  CONTENTS, READONLY, DEBUGGING

Thanks.
Tim

0 Kudos
Moderator
Moderator
126 Views
Registered: ‎09-12-2007

Re: ELF size reduction techniques

Have a look at the hw and sw techniques seen in the solution here to try reduce your code size

https://forums.xilinx.com/t5/Embedded-Processor-System-Design/Why-is-Microblaze-Code-Size-too-big/td-p/702313

0 Kudos