gcc-4.1-30 & SRAM

Eric BENARD elbenard at gmail.com
Thu Jan 18 15:56:17 UTC 2007


Hi,

I'm using a MCF5208 Coldfire which has 16kB of SRAM.
I'm using the uclinux tools from Codesourcery on x86 :
$ m68k-uclinux-gcc -v
gcc version 4.1.1 (CodeSourcery Sourcery G++ 4.1-30)

I'm trying to move parts of the code into SRAM without success until now.

I've prefixed the test function I want to put in SRAM as follows :
int __attribute__((__section__(".sramcode"))) func()

In elf2flt.ld, I've added :
MEMORY {
	flatmem : ORIGIN = 0x0, LENGTH = 0x1000000
	sram  : ORIGIN = 0x80000000, LENGTH = 12k
}

and
	.sramsection : {
		*(.sramdata)
		*(.sramcode)
		*(.text.sramcode.*)
	} > sram

Then when I compile :
$ m68k-uclinux-gcc -O3 -Wa,--register-prefix-optional -Wa,-memac
-Wa,-mcpu=5208 -mcpu=5208 -o hw hw.c
read error section .text
collect2: ld returned 2 exit status

I get a hw.gdb with the rights sections :
$ m68k-uclinux-objdump  -h hw.gdb

hw.gdb:     file format elf32-m68k

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00001360  00000000  00000000  00002000  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000200  00001360  00001360  00003360  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  2 .bss          00002050  00001560  00001560  00003560  2**2
                  ALLOC
  3 .sramsection  00000016  80000000  80000000  00004000  2**1
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  4 .comment      0000002f  00000000  00000000  00004016  2**0
                  CONTENTS, READONLY

But elf2flt seems to fail :
$ m68k-uclinux-elf2flt -v -o hw hw.gdb
TEXT -> vma=0x0 len=0x80000016
read error section .text

Do you have any idea of what is wrong and prevents generation of the flt
binary ?

Next stage will be to provide a code to copy the sramsection into SRAM
as I don't think this will be done automagically but it's first
necessary to manage to generate a flt binary ;)

Many thanks
Eric



More information about the coldfire-gnu-discuss mailing list