This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: Allocate memory from predefined section


Hi,

You may instruct the linker that certain sections of certain objects
are to be put in special regions of memory.

Something similar to next lines would work for you. In the example 
I assumed that compiler generates sections .bss, .text and .data, as 
my m68-coff cross compiler generates for me, and that the data you
want to allocate is in the .bss section of objects file1.o and
file2.o . This is probably not correct for you. You must determine, (for
example with objdump) what are the sections that you must reallocate. 


MEMORY
{
 ram (rwx): ORIGIN = 0, LENGTH = 0xefffff
 ioRAM (rwx): ORIGIN = 0xf00000, LENGTH = 1M
}

SECTIONS
{
...
 special_data: 
   {
    file1.o (.bss) 
    file2.o (.bss)
   } > ioRAM
 normal_data:
  {
   *(.bss)
   *(.text)
   *(.data)
  } > ram
 
}

As I posted in recent messages, in
http://www.gnu.org/manual/ld-2.9.1/ld.html you can see the document 
"Using LD - the GNU Linker", where you will find how to use linker
scripts.

Regards,
José Miguel

José Miguel Robles Román
Development Engineer
Indra S.A.
Alcobendas (Madrid) Spain
mailto:jmrroman@indra.es


> -----Mensaje original-----
> De: Daniel Lidsten [mailto:Daniel.Lidsten@combitechsystems.com]
> Enviado el: martes, 30 de julio de 2002 13:32
> Para: crossgcc
> Asunto: Allocate memory from predefined section
> 
> 
> Hi,
> 
> I am having some trouble with my mpc850. Currently i cache 
> all RAM data
> and because of that both the serial port and ethernet have stoped
> working. A workaround for this problem is to let the serial 
> and ethernet
> drivers allocate memory in a section that is not cached. 
> 
> Is there a way to tell the compiler/linker that all memory used within
> certain files (typ smc.c) shall be allocated from a predefined section
> or do i have to rewrite the code to allocate memory from a the new
> section. In the below clip i have created a new section called ioRAM
> where i want to put all serial and ethernet related data.
> 
> Any ideas?
> 
> Regards, Daniel
> 
> 
> MEMORY
> {
>     ram : ORIGIN = 0, LENGTH = 0xefffff
>     ioRAM : ORIGIN = 0xf00000, LENGTH = 0x100000
> }
> 
> SECTIONS
> {
>     SECTIONS_BEGIN
>     SECTION_vectors (ram, 0, LMA_EQ_VMA)
>     SECTION_text (ram, 0x5000, LMA_EQ_VMA)
>     SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA)
>     SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA)
>     SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA)
>     SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA)
>     SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
>     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
>     CYG_LABEL_DEFN(__IOSpace) = 0xf00000; . = 
> CYG_LABEL_DEFN(__IOSpace)
> + 0x100000;
>     SECTIONS_END
> }
> 
> 
> ------
> Want more information?  See the CrossGCC FAQ, 
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to 
> crossgcc-unsubscribe@sources.redhat.com
> 
> 



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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