i tried generate image there small portion of code initializes board (raspberry pi 2b), copies rest of stuff in upper memory , starts running rest of code there.
the idea whole image first loaded @ 0x8000 "functonality" copied upper memory , started, , stuff in 0x8000 abandoned.
it doesn't work. errors ld:
... /bin/ld: address 0x124ac of loader.elf section `.text2' not within region `exec' ... /bin/ld: address 0x1ff18 of loader.elf section `.bss' not within region `exec' ... /bin/ld: address 0x124ac of loader.elf section `.text2' not within region `exec' ... /bin/ld: address 0x1ff18 of loader.elf section `.bss' not within region `exec' ... /bin/ld: address 0x124ac of loader.elf section `.text2' not within region `exec' ... /bin/ld: address 0x1ff18 of loader.elf section `.bss' not within region `exec' ... /bin/ld: region `exec' overflowed -520487144 bytes collect2: error: ld returned 1 exit status make: *** [loader.elf] error 1 make: target `all' not remade because of errors.
my linker script:
entry(_start) memory { load (rwx) : origin = 0x00008000, length = 512k /* initial */ exec (rwx) : origin = 0x1f000000, length = 512k /* runtime */ } sections { /* starts @ loader_addr. */ . = 0x8000; __text_start = .; .text : { *(.init) *start1.o(.text) *start1.o(.data) *start1.o(.bss) *(.text.startup) } >load .text2 align(0x1000): { __code_begin = .; *loader.o(.text) *rpi2.o(.text) *serial.o(.text) *util.o(exclude_file(*instr_util.o).text) *gdb.o(.text) *(.text) } >exec at>load __text_end = .; __data_start = .; .data : { *(.data) } >exec at>load __data_end = .; __bss_start = .; .bss align(0x8): { bss = .; *(.bss) stacks = .; . = . + 512; /* fiq stack size */ __fiq_stack = .; . = . + 1024; /* usr & sys stack size (common) */ __usrsys_stack = .; . = . + 16384; /* svc stack size (start-up) */ __svc_stack = .; . = . + 4096; /* irq stack size (serial) */ __irq_stack = .; . = . + 512; /* mon stack size */ __mon_stack = .; . = . + 512; /* hyp stack size */ __hyp_stack = .; . = . + 512; /* und stack size */ __und_stack = .; . = . + 16384; /* abrt stack size (gdb-stub) */ __abrt_stack = .; } >exec at>load __bss_end = .; __new_org = 0x1f000000; /* gcc-generated crap */ .note : { *(.note.*) } >load .debug : { *(.debug*) } >load __end = .; }
it works fine, when use >load everywhere (all in lower memory). program not big:
0x0001ff18 __bss_end = . 0x00032098 __end = .
forgot mention: bare metal program.
[edit] funny, works (but i'd rather 'catenate'...)
.text2 0x1e000000: { __code_begin = .; *loader.o(.text) *rpi2.o(.text) *serial.o(.text) *util.o(exclude_file(*instr_util.o).text) *gdb.o(.text) *(.text) } at>load
[/edit]
after quite trials: ">exec at>load" work. doesn't 'competing definitions': align(0x1000).
Comments
Post a Comment