This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re:Discontinous RAM and linker scripts


Hi,
I use a AT91R40008 based system, too.
I changed my linker script and the vectors.S to have the possibility to
relocate functions etc. into the on-chip sram. My application is a
ROM/RAM one.

I had to modifiy the linker script manually.

My linker script:
STARTUP(vectors.o)
ENTRY(reset_vector)
INPUT(extras.o)

GROUP(libtarget.a libgcc.a libsupc++.a)
MEMORY
{
    sram : ORIGIN = 0x00000000, LENGTH = 0x040000
    ram : ORIGIN = 0x03000000, LENGTH = 0x800000
    rom : ORIGIN = 0x01000000, LENGTH = 0x400000
}

SECTIONS
{
    .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : {
*(.debug_pubnames) } .debug_info 0 : { *(.debug_info) } .debug_abbrev 0
: { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0
: { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : {
*(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } .note.arm.ident
0 : { KEEP (*(.note.arm.ident)) }
    .fixed_vectors 0x00000020 : { . = .; KEEP (*(.fixed_vectors)) } >
sram
    .rom_vectors 0x03000000 : { __rom_vectors_vma = ABSOLUTE(.); . = .;
KEEP (*(.vectors)) } > ram __rom_vectors_lma = LOADADDR(.rom_vectors);
    .text ALIGN (0x4) : { _stext = ABSOLUTE(.); PROVIDE (__stext =
ABSOLUTE(.)); *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init)
*(.glue_7) *(.glue_7t) } > ram _etext = .; PROVIDE (__etext = .);
    .fini ALIGN (0x4) : { . = .; *(.fini) } > ram
    .rodata ALIGN (0x4) : { . = .; *(.rodata*) *(.gnu.linkonce.r.*) } >
ram
    .rodata1 ALIGN (0x4) : { . = .; *(.rodata1) } > ram
    .fixup ALIGN (0x4) : { . = .; *(.fixup) } > ram
    .gcc_except_table ALIGN (0x4) : { . = .; *(.gcc_except_table) } >
ram
    .sram ((LOADADDR (.fixed_vectors) + SIZEOF (.fixed_vectors) + 4 - 1)
& ~ (4 - 1)) : AT ((LOADADDR (.gcc_except_table) + SIZEOF
(.gcc_except_table) + 4 - 1) & ~ (4 - 1)) { __sram_sram_start = ABSOLUTE
(.); *(.sram*) . = ALIGN (4); } > sram __rom_sram_start = LOADADDR
(.sram); __sram_sram_end = .; PROVIDE (__sram_sram_end = .); _esram = .;
PROVIDE (_esram = .); PROVIDE (__rom_sram_end = LOADADDR (.sram) +
SIZEOF(.sram));
    .data ((LOADADDR (.sram) + SIZEOF (.sram) + 4 - 1) & ~ (4 - 1)) : {
__ram_data_start = ABSOLUTE (.); *(.data*) *(.data1)
*(.gnu.linkonce.d.*) . = ALIGN (4); KEEP(*( SORT (.ecos.table.*))) ; . =
ALIGN (4); __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*)))
__CTOR_END__ = ABSOLUTE (.); __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT
(.dtors*))) __DTOR_END__ = ABSOLUTE (.); *(.dynamic) *(.sdata*)
*(.gnu.linkonce.s.*) . = ALIGN (4); *(.2ram.*) } > ram __rom_data_start
= LOADADDR (.data); __ram_data_end = .; PROVIDE (__ram_data_end = .);
_edata = .; PROVIDE (edata = .); PROVIDE (__rom_data_end = LOADADDR
(.data) + SIZEOF(.data));
    .bss ALIGN (0x4) : { __bss_start = ABSOLUTE (.); *(.scommon)
*(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) *(.dynbss) *(.bss*)
*(.gnu.linkonce.b.*) *(COMMON) __bss_end = ABSOLUTE (.); } > ram
    __heap1 = ALIGN (0x8);
    . = ALIGN(4); _end = .; PROVIDE (end = .);
}


The vectors.S is changed in such a way that I copied the routine which
copies the .data section into ram. I changed the start and end addresses
to match __sram_sram_end etc.

Regards,
 Sven Rehfuß



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]