tyron's page 不断探索是一件好事,学无止境!

objcopy的用法

2021-09-06
David


参考:原文

产生S-records(srec):-O srec.

产生raw binary(bin):-O binary.

把elf -> s19格式:

objcopy --srec-len 1 --srec-forceS3 --output-target=srec xxxx.elf xxxx.s19

把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

# 其他例:
$ 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

Comments

Content