size of segments

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

size of segments

Post by skoe »

Hi,

Is there something like the "size" tool to find out the segment size of an executable? The only possibility I found is to disassemble it using xobjdump.

That's what I mean:

Code: Select all

> size tools/hexdump/hexdump
   text    data     bss     dec     hex filename
   2121     532      24    2677     a75 tools/hexdump/hexdump
Thomas

Edit:
This is *nearly* the solution:

Code: Select all

xobjdump --disassemble-all $@ | grep "size" | grep -e "text\|init\|rodata"
But this cannot provide information about the bss segment.


User avatar
kris
Experienced Member
Posts: 84
Joined: Mon Jan 18, 2010 2:52 pm

Post by kris »

Hi Thomas,

If you use the --split option to xobjdump, then this splits the xe file into its parts. You can then use the standard (gnu) size tool on the relevent elf file, e.g:

xobjdump --split a.xe
size image_n0c0.elf

However, in the upcoming tools release (which should be along shortly), there's a --size option to xobjdump which will do what you want...

Cheers,
Kris.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

Post by skoe »

Thank you, this is very helpful. I didn't realize that the ELF format is so generic.

Another question about the toolchain: Is there a simple possibility to create dependencies using xcc (like -M in gcc)? Otherwise I'll call GNU cpp directly.

Regards,

Thomas
User avatar
kris
Experienced Member
Posts: 84
Joined: Mon Jan 18, 2010 2:52 pm

Post by kris »

Hi Thomas,

Xpp (the preprocessor) does support the -M options. However, xcc (the compiler frontend) only accepts -MD and -MMD, which is similar to -M but puts the dependencies in a file instead.

So, xcc -e -MD test.xc
would put the dependencies in a file named test.d

Or if you need the dependencies to come out on stdout, you could call xpp directly, but in that case the system include paths would need to be passed to the preprocessor:

e.g. xpp -isystem TOOLS_PATH/Linux/target/include -isystem TOOLS_PATH/Linux/target/include/gcc -M test.xc

Cheers,
Kris.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

Post by skoe »

However, xcc (the compiler frontend) only accepts -MD and -MMD
Oh, sorry. I didn't know that. This helps, thank you.