3

我正在使用 objcopy 删除一些必要的脚本,以将资源文件(zip 文件)嵌入闪存(ARM 嵌入式事物)中。

我正在使用这样的 objcopy:

arm-none-eabi-objcopy.exe -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata input.zip input.zip.o
arm-none-eabi-nm.exe -S -t d input.zip.o
00006301 R _binary_input_zip_end
00006301 A _binary_input_zip_size
00000000 R _binary_input_zip_start

我需要知道的是 _end 和 _size 符号的宽度是多少。我只能猜测 _start 是一个可以像字节数组一样访问的地址:extern uint8_t _binary_input_zip_start[];。我假设 _end 和 _size 是“本机”int-size,我想我可以放心地假设我可以将它们解释为 uint32_t。

不过我不能确定。我在 objcopy 的文档中找不到任何与“大小”相关的内容:https ://sourceware.org/binutils/docs/binutils/objcopy.html

4

1 回答 1

0

I'm not %100 sure if this will work, but try adding the option --sort-size to arm-none-eabi-nm. This is supposed to sort the symbols by size, by comparing them to the next symbol above. In combination with the -S option, it should print a size. Hopefully, this will help you deduce their width.

What ARM micro are you using? 32-bits is a good guess, but there are exceptions. If you happen to be using a Texas Instruments part, I can help a lot more. I don't have an ARM project handy that I can test this on, but it's worth a shot. If that doesn't work, I'll keep digging.

Source: My knowledge, and double-checking via http://manned.org/arm-none-eabi-nm

于 2014-12-01T08:09:19.113 回答