Hi Peter,

this becomes toooo complex.
should be a simpler solution.

Lets find it.

cheers,
~d


On Saturday 12 April 2003 08:48, Peter Jansen wrote:
> Hi Dmitry,
>
> Find attached patches for gcc and bintuils, this initializes the stack
> in init0 right at the start. The stack is initialized to the stack - the
> reserve ram attribute of the main function.
>
> > ...
> > Basically, yes.
> > However, as long as main() in embedded does not accept parameters,
> > the hidded ctors call will not change anything.
> > But, if user puts his own routine in initX, he can make main accepting
> > args. Then this will destroy things a bit.
>
> Initializing the stack pointer in init0 or init2 might solve this
> problem (?).
>
> >..
> > RESERVE_RAM(x) actually shifts initial stack value from user code, not
> > from linker script.
> > The mentioned problem can be avoided by passing '-mstack=...' or
> > --defsym... .
>
> I had considered that when a user wanted to do this then they could use
> their own linker script and the -T option to the linker. But their are
> many ways to do the same thing.
>
> >>Its a bit of a hack but, maybe in the main prologue we could change to
> >> the .init2 section put the stack code in then change back to the .text
> >> section this would get the stack pointer initialized before the
> >>constructors are run and would allow the RESERVE_RAM to also work. Or I
> >
> > how??? RESERVE_RAM(x) is an attribute and cannot not affect any library
> > code.
>
> Ok see the attached patches for gcc and binutils, creating a symbol in
> the main function __stack_reserve to save the reserve amount, init the
> stack in init0 (through libgcc.S/ reset_vector) with __stack_start and
> added to the linker script __stack_start to compute the difference
> between __stack and __stack_reserve as this is the time the values are
> known.
>
> Maybe __stack needs renaming something else and __stack_start should be
> renamed __stack but ill leave this up to you.
>
> >..
> >
> >
> > Obviously, if ctors/dtors are not required, gcc will not issue a relevant
> > code.
>
> That is true, but if the code has destructors in it then they will be
> put into the embedded code and never run. This could be the case when
> compiling the same code for both linux and a msp430 system.
>
> Regards,

-- 
*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
*********************************************************************




Reply via email to