Andes Workshop http://forum.andestech.com/ |
|
將1個elf檔切成多個bin檔的方法 http://forum.andestech.com/viewtopic.php?f=25&t=661 |
Page 1 of 1 |
Author: | cindy [ Tue Jan 22, 2013 11:44 am ] |
Post subject: | 將1個elf檔切成多個bin檔的方法 |
將1個elf檔切成多個bin檔的方法如下 我們看了一下 objcopy 的manual和code, 只有 -j 和 -R 這兩個參數可以用 [-j sectionname|--only-section=sectionname] [-R sectionname|--remove-section=sectionname] 例如我有一個a.out, 有 .text, .foo, .bar 三個sections [ 1] .text PROGBITS 00004000 001000 000008 00 AX 0 0 2 [ 2] .foo PROGBITS 00004008 001008 000008 00 WA 0 0 2 [ 3] .bar PROGBITS 00004010 001010 00000a 00 WA 0 0 2 1. nds32le-elf-objcopy -O binary a.out a.bin 這樣會生出一個 0x8 + 0x8 + 0xa 大的 bin 檔 2. nds32le-elf-objcopy -O binary -j .text a.out a.text.bin 這樣會生出一個 0x8 大的 bin 檔 (以 .text 的lma為base) 裡面只存在 .text section 3. nds32le-elf-objcopy -O binary -R .text a.out a.foobar.bin 這樣會生出一個 0x8 + 0xa 大的 bin 檔 (以 .foo 的lma 為base) 內容只存在 .foo 與 .bar 如果section比較複雜, 那麼可能需要多個 -j 或 -R 才能組合出想要的binary檔 意思是說,例如我要留2個sections,則 nds32le-elf-objcopy -O binary -j .text –j .foo a.out a.textfoo.bin |
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |