public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Moving one module to RAM
@ 2000-01-28 15:01 Tim Michals
  2000-02-04  7:35 ` [ECOS] " Bart Veer
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Michals @ 2000-01-28 15:01 UTC (permalink / raw)
  To: ecos-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

All,
 
Can some give me a hint on how to move only one module code 
section to a RAM section.  What I'm trying to do is run most of the code 
from ROM, POST, etc, then I would like move just a module with about 10 
functions into RAM.  This way I can call functions from ROM and they will 
run in ram, but for the module only.
 
I was looking to using the attribute label on the functions 
but is there a easier way?
 
Tim

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Re: Moving one module to RAM
  2000-01-28 15:01 [ECOS] Moving one module to RAM Tim Michals
@ 2000-02-04  7:35 ` Bart Veer
  2000-02-04  8:13   ` Tim Michals
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Veer @ 2000-02-04  7:35 UTC (permalink / raw)
  To: tim; +Cc: ecos-discuss

>>>>> "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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Re: Moving one module to RAM
  2000-02-04  7:35 ` [ECOS] " Bart Veer
@ 2000-02-04  8:13   ` Tim Michals
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Michals @ 2000-02-04  8:13 UTC (permalink / raw)
  To: bartv; +Cc: ecos-discuss

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-02-04  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-28 15:01 [ECOS] Moving one module to RAM Tim Michals
2000-02-04  7:35 ` [ECOS] " Bart Veer
2000-02-04  8:13   ` Tim Michals

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).