Jump to content
43oh

Where's the actual binary?


Recommended Posts

Hi all, haven't been here for a while :-)

 

Sorry if this was brought up before and I missed it. For some nefarious reason, I want to see the actual compiled binary code that gets sent to the MSP430G2 Launchpad. Energia says (for a particular program of course):

 

Binary sketch size: 1,739 bytes (of a 16,384 byte maximum)

 

But the generated Hex file is actually 4,957 bytes long, and visually I can't spot any big blank space in it. So where does the extra content come from, and how can I isolate and see just the stuff that goes onto the Flash?

 

Thanks!
 

Link to post
Share on other sites

Oh.... ok, I found some info on this format, and the data in there is actually text-based HEX, and there's some meta-data as well - that explains the discrepancy. So... new question, is there an easy way to extract the actual machine language bytes without writing a program to do it? :)

Link to post
Share on other sites

It generates an ELF file.  Not sure how to pull the binary copy of the sections themself, but you can disassemble using (e.g. for msp430)-

 

<energia install dir>/hardware/tools/msp430/bin/msp430-objdump -CD <file.elf>

 

(or for all other ARM platforms)-

<energia install dir>/hardware/tools/lm4f/bin/arm-none-eabi-objdump -CD <file.elf>

Link to post
Share on other sites

It generates an ELF file.  Not sure how to pull the binary copy of the sections themself, but you can disassemble using (e.g. for msp430)-

 

<energia install dir>/hardware/tools/msp430/bin/msp430-objdump -CD <file.elf>

 

That's some detailed disassembly! :-)

It's not what I need for my current little project, but I'm sure it will turn out very useful sometime - thanks!

Link to post
Share on other sites

xxx-objdump has a bunch of different options for various output formats.

There is also "xxx-objcopy" for converting between different "binary formats"  This is used to generate .hex files (ascii text of the binary), or .bin files (straight binary) from the .elf file that the compiler produces.  (.elf files also contain a bunch of debugging information that doesn't end up in the final binary.)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...