Differences between Elf BIN file and elf BIN file

Source: Internet
Author: User

During embedded development, we compile a *. s file and finally generate the binfile. The compilation command is roughly as follows:

Cc = arm-softfloat-Linux-GNU-gcc

LD = arm-softfloat-Linux-GNU-LD

Objcopy = arm-softfloat-Linux-GNU-objcopy

 

$ (CC)-G $ (cflag)-C boot. s # first generate the boot. s file to boot. o

$ (LD)-g-bstatic-T $ (ldfile)-ttext 0x12345600 boot. O -- start-group-map boot. map-O boot. elf # restart boot. O generate boot. elf, boot. ELF is usually an executable file, similar to GCC-O test. in C, enter the test file in Linux Shell. /test.

$ (Objcopy)-O binary boot. Elf boot. Bin # Run boot. Elf-> boot. bin to reduce the code size.

 

Run arm-softfloat-Linux-GNU-objdump-H boot. Elf to view the file information.

Arm-softfloat-Linux-GNU-objdump-H boot. Bin will prompt an error. To view the boot. binfile information, enter:

Arm-softfloat-Linux-GNU-objdump-H-B Binary-M arm boot. Bin. Haha, I also learned a trick. The parameter-h can be replaced with-D,-S,-S, and so on, use the meaning in arm-softfloat-Linux-GNU-objdump -- Help Viewer.

 

Differences between Elf bin files:

We have a Linux OS. To run executable files, they follow the ELF format, usually gcc-O test. c. The generated test file is in ELF format, so that you can run it.

The arm-softfloat-Linux-GNU-objcopy command removes the ELF format and only keeps the most pure assembly (I don't know how to explain it ),

In embedded, if the system does not have an operating system when it is powered on, if the ELF format file is burned in and contains some ELF format files, arm runs these commands, this will cause a failure. If you use arm-softfloat-Linux-GNU-objcopy to generate a pure assembly, the program can be run step by step.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.