große binäre Dateien mit objcopy

Ich habe Probleme, wenn ich die Definition globaler Variablen in einem einfachen C-Programm für einen ARM9-Prozessor. Ich bin mit GNU EABI-compiler und die binary erzeugt aus einer 12 KB elf ist 4GB! Ich nehme an, das Problem ist meine scatter Datei, aber ich habe Mühe, meinen Kopf um ihn herum.

Ich habe 256KB ROM (Basis-Adresse 0xFFFF0000) und 32KBs RAM (base 0x01000000)

SECTIONS {
  . = 0xFFFF0000;
  .text : {
    * (vectors);
    * (.text);
  }
  .rodata : { *(.rodata) }
  . = 0x01000000;
  sbss = .;
  .data : { *(.data) }
  .bss  : { *(.bss) }
  ebss = .;
  bssSize = ebss - sbss;
}

Und mein Programm ist wie folgt:

int a=10;
int main() {
  int b=5;
  b = (a>b)? a : b;  
  return b;
};

Wenn ich erkläre eine wie eine lokale variable, d.h. es gibt keine .data-Abschnitt, dann funktioniert alles.
fein. Jede Hilfe sehr geschätzt.

--16. März 2011--

Kann mir jemand helfen mit diesem, Im nirgendwo und Lesen Sie die Handbücher, Foren, etc...

Mein boot, Befehl kompilieren und objcopy-Befehle eingefügt werden unten

     .section "vectors"
reset:  b   start
undef:  b   undef
swi:    b   swi
pabt:   b   pabt
dabt:   b   dabt
    nop
irq:    b   irq
fiq:    b   fiq
  .text
start:
        ldr   sp, =0x01006000
        bl    main

stop:   b     stop

arm-none-eabi-gcc -mcpu=arm926ej-s -Wand -nostartfiles -Wall main.c boot.s -o-main.Elfe -T \ scatter_file

arm-none-eabi-objcopy ./main.elf --output-target=binary ./main.bin

arm-none-eabi-objdump ./main.elf --disassemble-alle > ./main.dis

  • und wie groß ist die Datei, wenn Sie entfernen Zeile '. = 0x01000000;' ?
  • Seine 364 bytes, wenn ich entfernen Sie die ram-Adresse (0x01000000)
InformationsquelleAutor Damn | 2011-03-08
Schreibe einen Kommentar