EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Problem with .ld file

Started by cbitsunil May 1, 2005
Hi to all group members,
Iam using LPC2214 for my project.
i am using external memory for my project.Iam getting some problems
with my .ld file.Coz i dont know how to write it.I have an .ld file wc
which is deined for internal flash and ram.But i have to define one
more segment for External memory.
so plese some body can send .ld file which is used for
three memory regions(flash,ram and external memory ranging from
0x80000000).
Thanks in advance.
sunil.



An Engineer's Guide to the LPC2100 Series

Sunil,

It depends on your requirement, what you want at each
memory.

Basically you have the .text (code), .data
(initialized data) & .bss (uninitialised data) -- 3
main sections & you can decide on keeping these
different sections at different memories. Also you can
spilt them between many memory regions by specifying
the object files explicitly.

Let me know what you want to use the external memory
for & I will help you with the linker script.

Cheers,
-Mike.

--- cbitsunil <cbitsunil@cbit...> wrote:
> Hi to all group members,
> Iam using LPC2214 for my
> project.
> i am using external memory for my project.Iam
> getting some problems
> with my .ld file.Coz i dont know how to write it.I
> have an .ld file wc
> which is deined for internal flash and ram.But i
> have to define one
> more segment for External memory.
> so plese some body can send .ld file which
> is used for
> three memory regions(flash,ram and external memory
> ranging from
> 0x80000000).
> Thanks in advance.
> sunil. >
>

__________________________________________________




Hi Mike,
thanks for your reply.Iam using external memory to place some
data and read it whenever necessary.
Iam just placing some data and there is no need to map interrupt
vectors.
Iam placing my code in internal flash memory.

here's my .ld file.Can u please modify with external memory added to
it.

thanks once again mike.
sunil.

MEMORY
{
Peripherals (wx) : ORIGIN = 0xe0000000, LENGTH = 0x20000000
SRAM (wx) : ORIGIN = 0x40000000, LENGTH = 0x00004000
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000
}

SECTIONS
{
Peripherals_segment_start :
{
__Peripherals_segment_start__ = .;
} > Peripherals

SRAM_segment_start :
{
__SRAM_segment_start__ = .;
} > SRAM

FLASH_segment_start :
{
__FLASH_segment_start__ = .;
} > FLASH

.vectors_ram __SRAM_segment_start__ (NOLOAD) :
{
__vectors_ram_start__ = .;
*(.vectors_ram)
. = MAX(__vectors_ram_start__ + 60, .);
}
__vectors_ram_end__ = __vectors_ram_start__ + SIZEOF(.vectors_ram);

. = ASSERT(__vectors_ram_end__ >= __SRAM_segment_start__ &&
__vectors_ram_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".vectors_ram is too large to fit in SRAM memory
segment");

.vectors __FLASH_segment_start__ :
{
__vectors_start__ = .;
*(.vectors .vectors.*)
}
__vectors_end__ = __vectors_start__ + SIZEOF(.vectors);

. = ASSERT(__vectors_end__ >= __FLASH_segment_start__ &&
__vectors_end__ <= (__FLASH_segment_start__ + 0x00020000) , ".vectors
is too large to fit in FLASH memory segment");

.init (__vectors_end__ + 3) / 4 * 4 :
{
__init_start__ = .;
*(.init .init.*)
}
__init_end__ = __init_start__ + SIZEOF(.init);

. = ASSERT(__init_end__ >= __FLASH_segment_start__ && __init_end__
<= (__FLASH_segment_start__ + 0x00020000) , ".init is too large to
fit in FLASH memory segment");

.text_load (__init_end__ + 3) / 4 * 4 (NOLOAD) :
{
__text_load_start__ = .;
*(.text_load)
}
__text_load_end__ = __text_load_start__ + SIZEOF(.text_load);

. = ASSERT(__text_load_end__ >= __FLASH_segment_start__ &&
__text_load_end__ <= (__FLASH_segment_start__ +
0x00020000) , ".text_load is too large to fit in FLASH memory
segment");

.text (__text_load_end__ + 3) / 4 * 4 :
{
__text_start__ = .;
*(.text .text.* .glue_7t .glue_7 .gnu.linkonce.t.*)
}
__text_end__ = __text_start__ + SIZEOF(.text);

. = ASSERT(__text_end__ >= __FLASH_segment_start__ && __text_end__
<= (__FLASH_segment_start__ + 0x00020000) , ".text is too large to
fit in FLASH memory segment");

.dtors (__text_end__ + 3) / 4 * 4 :
{
__dtors_start__ = .;
KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors))
}
__dtors_end__ = __dtors_start__ + SIZEOF(.dtors);

. = ASSERT(__dtors_end__ >= __FLASH_segment_start__ &&
__dtors_end__ <= (__FLASH_segment_start__ + 0x00020000) , ".dtors is
too large to fit in FLASH memory segment");

.ctors (__dtors_end__ + 3) / 4 * 4 :
{
__ctors_start__ = .;
KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors))
}
__ctors_end__ = __ctors_start__ + SIZEOF(.ctors);

. = ASSERT(__ctors_end__ >= __FLASH_segment_start__ &&
__ctors_end__ <= (__FLASH_segment_start__ + 0x00020000) , ".ctors is
too large to fit in FLASH memory segment");

.rodata (__ctors_end__ + 3) / 4 * 4 :
{
__rodata_start__ = .;
*(.rodata .rodata.* .gnu.linkonce.r.*)
}
__rodata_end__ = __rodata_start__ + SIZEOF(.rodata);

. = ASSERT(__rodata_end__ >= __FLASH_segment_start__ &&
__rodata_end__ <= (__FLASH_segment_start__ + 0x00020000) , ".rodata
is too large to fit in FLASH memory segment");

__fast_load_start__ = (__rodata_end__ + 3) / 4 * 4;
.fast __vectors_ram_end__ : AT((__rodata_end__ + 3) / 4 * 4)
{
__fast_start__ = .;
*(.fast .fast.*)
}
__fast_end__ = __fast_start__ + SIZEOF(.fast);

. = ASSERT((__fast_load_start__ + SIZEOF(.fast)) >=
__FLASH_segment_start__ && (__fast_load_start__ + SIZEOF(.fast)) <=
(__FLASH_segment_start__ + 0x00020000) , ".fast is too large to fit
in FLASH memory segment");

.fast_run (__vectors_ram_end__ + 3) / 4 * 4 (NOLOAD) :
{
__fast_run_start__ = .;
. = MAX(__fast_run_start__ + SIZEOF(.fast), .);
}
__fast_run_end__ = __fast_run_start__ + SIZEOF(.fast_run);

. = ASSERT(__fast_run_end__ >= __SRAM_segment_start__ &&
__fast_run_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".fast_run is too large to fit in SRAM memory segment");

__data_load_start__ = (__fast_load_start__ + SIZEOF(.fast) + 3) / 4
* 4;
.data __fast_run_end__ : AT((__fast_load_start__ + SIZEOF(.fast) +
3) / 4 * 4)
{
__data_start__ = .;
*(.data .data.* .gnu.linkonce.d.*)
}
__data_end__ = __data_start__ + SIZEOF(.data);

. = ASSERT((__data_load_start__ + SIZEOF(.data)) >=
__FLASH_segment_start__ && (__data_load_start__ + SIZEOF(.data)) <=
(__FLASH_segment_start__ + 0x00020000) , ".data is too large to fit
in FLASH memory segment");

.data_run (__fast_run_end__ + 3) / 4 * 4 (NOLOAD) :
{
__data_run_start__ = .;
. = MAX(__data_run_start__ + SIZEOF(.data), .);
}
__data_run_end__ = __data_run_start__ + SIZEOF(.data_run);

. = ASSERT(__data_run_end__ >= __SRAM_segment_start__ &&
__data_run_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".data_run is too large to fit in SRAM memory segment");

.bss (__data_run_end__ + 3) / 4 * 4 (NOLOAD) :
{
__bss_start__ = .;
*(.bss .bss.* .gnu.linkonce.b.*) *(COMMON)
}
__bss_end__ = __bss_start__ + SIZEOF(.bss);

. = ASSERT(__bss_end__ >= __SRAM_segment_start__ && __bss_end__ <=
(__SRAM_segment_start__ + 0x00004000) , ".bss is too large to fit in
SRAM memory segment");

.heap (__bss_end__ + 3) / 4 * 4 (NOLOAD) :
{
__heap_start__ = .;
*(.heap)
. = MAX(__heap_start__ + 4096, .);
}
__heap_end__ = __heap_start__ + SIZEOF(.heap);

. = ASSERT(__heap_end__ >= __SRAM_segment_start__ && __heap_end__
<= (__SRAM_segment_start__ + 0x00004000) , ".heap is too large to fit
in SRAM memory segment");

.stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
{
__stack_start__ = .;
*(.stack)
. = MAX(__stack_start__ + 4096, .);
}
__stack_end__ = __stack_start__ + SIZEOF(.stack);

. = ASSERT(__stack_end__ >= __SRAM_segment_start__ && __stack_end__
<= (__SRAM_segment_start__ + 0x00004000) , ".stack is too large to
fit in SRAM memory segment");

.stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
{
__stack_irq_start__ = .;
*(.stack_irq)
. = MAX(__stack_irq_start__ + 1024, .);
}
__stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);

. = ASSERT(__stack_irq_end__ >= __SRAM_segment_start__ &&
__stack_irq_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".stack_irq is too large to fit in SRAM memory
segment");

.stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
{
__stack_fiq_start__ = .;
*(.stack_fiq)
. = MAX(__stack_fiq_start__ + 1024, .);
}
__stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);

. = ASSERT(__stack_fiq_end__ >= __SRAM_segment_start__ &&
__stack_fiq_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".stack_fiq is too large to fit in SRAM memory
segment");

.stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
{
__stack_svc_start__ = .;
*(.stack_svc)
. = MAX(__stack_svc_start__ + 256, .);
}
__stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);

. = ASSERT(__stack_svc_end__ >= __SRAM_segment_start__ &&
__stack_svc_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".stack_svc is too large to fit in SRAM memory
segment");

.stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
{
__stack_abt_start__ = .;
*(.stack_abt)
. = MAX(__stack_abt_start__ + 0, .);
}
__stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);

. = ASSERT(__stack_abt_end__ >= __SRAM_segment_start__ &&
__stack_abt_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".stack_abt is too large to fit in SRAM memory
segment");

.stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
{
__stack_und_start__ = .;
*(.stack_und)
. = MAX(__stack_und_start__ + 0, .);
}
__stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);

. = ASSERT(__stack_und_end__ >= __SRAM_segment_start__ &&
__stack_und_end__ <= (__SRAM_segment_start__ +
0x00004000) , ".stack_und is too large to fit in SRAM memory
segment");

Peripherals_segment_end :
{
__Peripherals_segment_end__ = .;
} > Peripherals

SRAM_segment_end :
{
__SRAM_segment_end__ = .;
} > SRAM

FLASH_segment_end :
{
__FLASH_segment_end__ = .;
} > FLASH

} --- In lpc2000@lpc2..., Michael Anburaj <embeddedeng@y...>
wrote:
> Sunil,
>
> It depends on your requirement, what you want at each
> memory.
>
> Basically you have the .text (code), .data
> (initialized data) & .bss (uninitialised data) -- 3
> main sections & you can decide on keeping these
> different sections at different memories. Also you can
> spilt them between many memory regions by specifying
> the object files explicitly.
>
> Let me know what you want to use the external memory
> for & I will help you with the linker script.
>
> Cheers,
> -Mike.
>
> --- cbitsunil <cbitsunil@y...> wrote:
> > Hi to all group members,
> > Iam using LPC2214 for my
> > project.
> > i am using external memory for my project.Iam
> > getting some problems
> > with my .ld file.Coz i dont know how to write it.I
> > have an .ld file wc
> > which is deined for internal flash and ram.But i
> > have to define one
> > more segment for External memory.
> > so plese some body can send .ld file which
> > is used for
> > three memory regions(flash,ram and external memory
> > ranging from
> > 0x80000000).
> > Thanks in advance.
> > sunil.
> >
> >
> >
> >
>
> __________________________________________________
>




Memfault Beyond the Launch