This is the mail archive of the ecos-discuss@sourceware.cygnus.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]

Re: Moving one module to RAM


Bart,

Thanks for the input.  At this time I'm using the attribute method and
placing it in data segment. I'm just lazy, to create another segment in the
linker file.

I'm working on a MPC850.  The idea is to move code into Dual Port memory to
do POST level operations on DRAM and have access to 'C' functions.

I tried using the linker to put modules in certain places but you have to
detail each module and where it has to go. This is do to the wild card for
placing modules in the text segment.   Which is painful.

Again,

Thanks.



----- Original Message -----
From: Bart Veer <bartv@redhat.com>
To: <tim@cygnetinc.com>
Cc: <ecos-discuss@sourceware.cygnus.com>
Sent: Friday, February 04, 2000 9:34 AM
Subject: Re: Moving one module to RAM


> >>>>> "Tim" == Tim Michals <tim@cygnetinc.com> writes:
>
>     Tim> Can some give me a hint on how to move only one module code
>     Tim> section to a RAM section. What I'm trying to do is run most
>     Tim> of the code from ROM, POST, etc, then I would like move just
>     Tim> a module with about 10 functions into RAM. This way I can
>     Tim> call functions from ROM and they will run in ram, but for the
>     Tim> module only.
>
>     Tim> I was looking to using the attribute label on the functions
>     Tim> but is there a easier way?
>
> The way I would do this is indeed to use attributes on the function
> declaration, e.g.:
>
>     extern void foobar (void) __attribute__ ((section ("bar")));
>
> combined with some linker script information which places that section
> in the appropriate memory region.
>
> There are probably many other approaches. A brief glance at the linker
> documentation mentions a FILENAME command which can be used to place
> some sections from given files into the current output section. You
> might be able to do some section renaming on the intermediate .o file
> by using objcopy with appropriate runes. You might be able to use some
> inline assembler in the C source code to change the current output
> section.
>
> If the source file is compiled with -ffunction-sections then this
> could cause a certain amount of extra confusion, in that the compiler
> will automatically put each function into different sections. You may
> be able to use this to your advantage, or it may cause extra
> confusion.
>
> Note that although you may want to execute the code from RAM, it still
> has to be present in the ROM. This requires more linker script magic,
> I believe you need to look at the documentation for the AT command.
> Also, the code will not magically get copied from ROM to RAM, it will
> be necessary to do a little bit of extra work in the startup.
>
> Bart Veer // eCos net maintainer


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