Gcc ARM objcopy导致空二进制文件

Gcc ARM objcopy导致空二进制文件,gcc,arm,objcopy,eabi,Gcc,Arm,Objcopy,Eabi,如何获取arm none-eabi-objcopy以将我的.axf文件复制/转换为.bin,该文件适用于使用lm4tools闪烁到设备 我有一个约20KB的.axf文件,已编译并与arm none eabi-*链接。对任何感兴趣的人来说,这是Stellaris Launchpad 我尝试修改项目提供的例子,用C++代码编译。我已经设法让它以elf32 littleram格式生成了一个.axf文件(根据.lst文件),但是当我尝试这样做时 arm-none-eabi-objcopy -v -O b

如何获取
arm none-eabi-objcopy
以将我的
.axf
文件复制/转换为
.bin
,该文件适用于使用
lm4tools
闪烁到设备

我有一个约20KB的
.axf
文件,已编译并与
arm none eabi-*
链接。对任何感兴趣的人来说,这是Stellaris Launchpad

<>我尝试修改项目提供的例子,用C++代码编译。我已经设法让它以
elf32 littleram
格式生成了一个
.axf
文件(根据
.lst
文件),但是当我尝试这样做时

arm-none-eabi-objcopy -v -O binary main.axf foo.bin
要将其转换为可编程文件,
.bin
文件输出的大小为0字节。描述了一个类似的问题。我确信
.axf
文件已经完成,那么为什么我的
.bin
文件没有填充任何内容呢?如果我删除了
-O二进制文件
,则可以很好地复制该文件。目录是可写的,所有权限都可以。我试着用各种各样的术语在SO和互联网的其他地方搜索,结果都没用。似乎以前没有人有过这个问题

运行
arm none-eabi objdump-D main.axf
会将文件转储到似乎是汇编程序的地方:

main.axf:     file format elf32-littlearm


Disassembly of section .debug_info:

00000000 <_end_text>:
       0:   00000082    andeq   r0, r0, r2, lsl #1
       4:   00000002    andeq   r0, r0, r2
       8:   01040000    mrseq   r0, (UNDEF: 4)
       c:   00000057    andeq   r0, r0, r7, asr r0
      10:   00000c04    andeq   r0, r0, r4, lsl #24
      14:   00002300    andeq   r2, r0, r0, lsl #6
    ...
      28:   08010200    stmdaeq r1, {r9}
      2c:   00000015    andeq   r0, r0, r5, lsl r0
      30:   00410103    subeq   r0, r1, r3, lsl #2
      34:   32010000    andcc   r0, r1, #0
      38:   00000048    andeq   r0, r0, r8, asr #32
    ...
      48:   69050404    stmdbvs r5, {r2, sl}
      4c:   0500746e    streq   r7, [r0, #-1134]    ; 0x46e
      50:   00000001    andeq   r0, r0, r1
      54:   46430100    strbmi  r0, [r3], -r0, lsl #2
    ...
运行
arm none eabi readelf-lS main.axf后,不会返回任何程序头:

There are 14 section headers, starting at offset 0x4f94:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .debug_info       PROGBITS        00000000 000034 0019a6 00      0   0  1
  [ 2] .debug_abbrev     PROGBITS        00000000 0019da 0005ad 00      0   0  1
  [ 3] .debug_loc        PROGBITS        00000000 001f87 001796 00      0   0  1
  [ 4] .debug_aranges    PROGBITS        00000000 003720 000088 00      0   0  8
  [ 5] .debug_ranges     PROGBITS        00000000 0037a8 000130 00      0   0  1
  [ 6] .debug_line       PROGBITS        00000000 0038d8 00077d 00      0   0  1
  [ 7] .debug_str        PROGBITS        00000000 004055 000aa8 01  MS  0   0  1
  [ 8] .comment          PROGBITS        00000000 004afd 00003a 01  MS  0   0  1
  [ 9] .ARM.attributes   ARM_ATTRIBUTES  00000000 004b37 000039 00      0   0  1
  [10] .debug_frame      PROGBITS        00000000 004b70 000388 00      0   0  4
  [11] .shstrtab         STRTAB          00000000 004ef8 00009a 00      0   0  1
  [12] .symtab           SYMTAB          00000000 0051c4 000200 10     13  18  4
  [13] .strtab           STRTAB          00000000 0053c4 0000e0 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no program headers in this file.

@dwelch这是一个ARM芯片,所以我非常怀疑它会变成一个多GB的文件,在vim中打开该文件会产生一个空文件。没有程序头,没有文本或数据节,所以
objcopy
很好,
.axf
文件构建不正确。@chill这一点很明显。谢谢你的提示。我想我会提出一个新问题,因为生成.axf文件超出了此文件的范围。您正在使用此链接器脚本吗?是的,但是我已经改变了两个Mag文件的位来支持C++文件。我应该在这里发布Makefile吗?