官术网_书友最值得收藏!

Binary format conversion

Despite containing all the compiled symbols in binary format, an ELF file is prefixed with a header that contains a description of the content, and pointers to the position where the sections start within the file. All this extra information is not needed to run on an embedded target, so the ELF file produced by the linker has to be transformed into a plain binary file. A tool in the toolchain, called objcopy, converts images from one standard format to others, and what is generally done is a conversion of the ELF into a raw binary image, without altering the symbols. To transform the image from ELF to binary format, invoke:

$ arm-none-eabi-objcopy -I elf -O binary image.elf image.bin

This creates a new file, called image.bin, from the symbol contained in the original ELF executable, which can be uploaded to the target.

Even if not suitable in general for direct upload on the target with third-party tools, it is possible to load the symbols through the debugger and upload them to the flash address. The original ELF file is also useful as the target of other diagnostic tools in the GNU toolchain, such as nm and readelf, which display the symbols in each module, with their type and relative address within the binary image. Furthermore, by using the objdump tool on the final image, or even on single object files, several details about the image can be retrieved, including the visualization of the entire assembly code, using the -d disassemble option:

arm-none-eabi-objdump -d image.elf
主站蜘蛛池模板: 天门市| 文山县| 开原市| 左云县| 神农架林区| 阿尔山市| 绥棱县| 黄梅县| 儋州市| 九龙坡区| 雅江县| 普洱| 宣汉县| 贡嘎县| 马龙县| 永安市| 梅河口市| 盐津县| 重庆市| 乌兰察布市| 乌兰浩特市| 墨脱县| 安岳县| 遵化市| 宁河县| 大厂| 长顺县| 马山县| 吉水县| 凤阳县| 怀远县| 无极县| 墨竹工卡县| 富裕县| 白城市| 罗城| 丁青县| 日照市| 龙里县| 酉阳| 东乡|