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


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

RE: Placing Functions in Data Segment





On Fri, 4 Jun 1999, Mark Powell wrote:
> 
> Assuming you have the relevant functions in a separate file(s) and you are
> using COFF, you can direct the linker to place the .text sections of those
> files in RAM by placing commands in the linker script.  Something like this
> should do it:
> 
> 
> MEMORY
> {
>     ram   : ORIGIN = <wherever>, LENGTH = <whatever>
>     rom   : ORIGIN = <wherever>, LENGTH = <whatever>
> }
> 
> 
> SECTIONS
> {
>     /* Place code for RAM after the normal text, but located to run
>      * in RAM.
>      * The region between _ramtext and _eramtext must be copied from
>      * ROM starting at _etext.
>      */
>     .ramtext : AT(_etext)


Hmmm - This AT keyword obviousely results in two output sections, of which
the one actually referneced by relocation as opposed to the permanent
storage will not reside in ROM but has to be loaded into RAM by the
startup file.

Now, next question: How do I access these addresses from within 'crt0.s?'
I can always guess. To quote the 'ld' documentation example:


SECTIONS
  {
  .text 0x1000 : { *(.text) _etext = . ; }
  .mdata 0x2000 : 
    AT ( ADDR(.text) + SIZEOF ( .text ) )
    { _data = . ; *(.data); _edata = . ;  }
  .bss 0x3000 :
    { _bstart = . ;  *(.bss) *(COMMON) ; _bend = . ;}
  }

Here they define the symbols '_data' and '_edata' as the starting
and end address of the '.data' section. Can I use these symbols
for the purpose of block copy ROM->RAM? BTW, there are some special
COFF symbol names 'etext, edata' and 'end' that is supposed to
contain the end address of the '.text, .data' and '.bss' sections
respectively. Are these automatically defined in GCC?



Next question: The NewLib Libgloss example './m68k/crt0.s' references
something called 'hardware_init_hooks' and 'software_init_hooks.'
What are these meant for?




  ******************************************************

  Never ever underestimate the power of human stupidity.
  -Robert Anson Heinlein

		GeirFRS@invalid.ed.ntnu.no

  ******************************************************

_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.

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