参考:原文
产生S-records(srec):-O srec.
产生raw binary(bin):-O binary.
[1]把elf -> s19格式:
objcopy --srec-len 1 --srec-forceS3 --output-target=srec xxxx.elf xxxx.s19
[2]把elf -> bin文件:
# 接着将 boot.elf 转换为 boot.bin
# 使用 -O binary (或--out-target=binary) 输出为原始的二进制文件
# 使用 -R .note (或--remove-section) 输出文件中不要.note这个section,缩小了文件尺寸
# 使用 -S (或 --strip-all) 输出文件中不要重定位信息和符号信息,缩小了文件尺寸
$ arm-linux-objcopy –O binary –S file.elf file.bin
$ arm-linux-objcopy -O binary -R .note -R .comment -S boot.elf boot.bin
#复制:将可执行程序test_adr.elf从一种二进制格式(elf)转换成另外一种二进制格式(bin)
$ arm-linux-objcopy -O binary -S test_adr.elf test_adr.bin
其他例:
$ objcopy --srec-forceS3 -O srec cr7_rtos_app.out cr7_rtos_app.srec
$ objcopy --srec-forceS3 --adjust-vma=0xe6320000 -I binary -O srec bootloader.img bootloader.img.srec
a2b | desc |
---|---|
elf2s19 | objcopy –srec-len 1 –srec-forceS3 –output-target=srec xxxx.elf xxxx.s19 |
elf2bin | arm-linux-objcopy –O binary –S file.elf file.bin |