ARM objcopy导致空二进制文件

时间:2012-11-23 00:38:59

标签: gcc arm objcopy eabi

如何arm-none-eabi-objcopy.axf文件复制/翻译成适合使用.bin闪烁到设备的lm4tools

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

我正在尝试修改stellaris-launchpad-template-gcc项目提供的示例以使用C ++代码进行编译。我设法让它以.axf格式生成elf32-littlearm文件(根据.lst文件),但是当我尝试时

arm-none-eabi-objcopy -v -O binary main.axf foo.bin

将其转换为可编程文件,.bin文件输出的大小为0字节。 This question描述了类似的问题。我确信.axf文件已完成,为什么我的.bin文件中没有填充任何内容?如果我删除-O binary,则文件将被正确复制。该目录是可写的,所有权限都可以。我尝试用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
    ...

这是正确的,还是我甚至没有正确编译,因为这似乎是某种汇编程序?

有关.axf文件的一些信息:

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          20372 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         14
  Section header string table index: 11

运行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.

0 个答案:

没有答案