[coldfire-gnu-discuss] gcc-4.1-30 & SRAM
Eric BENARD
elbenard at gmail.com
Wed Mar 7 16:58:02 UTC 2007
Eric BENARD wrote:
> Nathan Sidwell wrote :
>> Accessing objects in the sram region you define is going to be tricky.
>> The most straight forward mechanism will be via a pointer to that
>> memory. You may be able to produce a linker script that loads the sram
>> image into the data segment, but keeps it's VMA as you desire. You'll
>> have to adjust the FLT file creation to remove relocations against that
>> segment (normally relocations are kept). I've not thought hard about
>> this though.
>>
> OK, I'll let you know if I find a way to do this.
here is the dirty way I found :
m68k-uclinux-gcc -DHAVE_CONFIG_H -I. -Iinclude $CFLAGS -o $i
$LIBOGGSRC_O $LIBSRC_O $APPSOBJ_O $i.o -lc -lm
m68k-uclinux-objcopy --output-target binary -j .sramcode $i.gdb $i.bin
Function to put in SRAM are prefixed with :
__attribute__((__section__(".sramcode")))
Then I have a small app which loads app.bin at the right address in
SRAM. And then it's possible to execute the app, after comenting out the
address validity check in linux/fs/binfmt_flat.c :
if (!flat_reloc_valid(r, start_brk - start_data + text_len)) {
/* printk("BINFMT_FLAT: reloc outside program 0x%x (0 - 0x%x/0x%x)",
(int) r,(int)(start_brk-start_code),(int)text_len);
goto failed;
*/ }
Very dirty but that works ...
Eric
More information about the coldfire-gnu-discuss
mailing list