3

如何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 字节。这个问题描述了一个类似的问题。我确信.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.
4

0 回答 0