I am having problems when I define global variables in the base program on an ARM9 processor. I am using the EABI GNU compiler, and the binary code generated from 12KB elves is 4 GB! I assume that the problem is with my scatter file, but I am having problems with its head.
I have 256 KB of ROM (base address 0xFFFF0000) and 32 KB of RAM (base 0x01000000)
SECTIONS { . = 0xFFFF0000; .text : { * (vectors); * (.text); } .rodata : { *(.rodata) } . = 0x01000000; sbss = .; .data : { *(.data) } .bss : { *(.bss) } ebss = .; bssSize = ebss - sbss; }
And my program is as follows:
int a=10; int main() { int b=5; b = (a>b)? a : b; return b; };
If I declare as a local variable, that is, a .data section, then everything works. well. Any help was greatly appreciated.
- March 16, 2011
Can anyone help with this, I don't get anywhere and read manuals, forums, etc.
Download, compile, and objcopy commands are inserted below
.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 -Wall -nostartfiles -Wall main.c boot.s -o main.elf -T \ scatter_file
arm-none-eabi-objcopy./main.elf --output-target = binary./main.bin
arm-none-eabi-objdump./main.elf --disassemble-all> ./main.dis
source share