Metrowerks startup code

Started by Adrian Vos August 3, 2004
Hi All,

Just after a bit of advice here on metrowerks. Is it possible to prevent
metrowerks from doing its copy to ram on initialisation. From a look at the
startup code, it goes through two stages... in the first it initialises the
0 ram data. In the second stage it initialises the ram data that has non
zero initial values. I can obviously modify the file startup.c, but I notice
that this is reliant on a structure which contains data regarding the
initialisation. I would prefer to find a way (linker option or something) to
modify the data in this structure so that it does not perform the ram
initilisation, but runs standard and well proven startup.c.

I obviously still dersire the other features of startup.c like the stack
initialisation etc. I currently use a main bootcode in the protected area
that has the reset vector. It jumps to the main firmware which may change.
The bootcode takes place after the startup code, so the startup code will
initialise the ram incorrectly if I change the main firmware to use the ram
differently, so I would rather just do the initilisation manually in my main
firmware and disable the initilisation of the ram in startup.c.

Thanks!!

-- Adrian



Adrian,
If you use NO_INIT in the .prm (instead of READ_WRITE), then the linker will
not initialize the given memory area.

Erich

> -----Original Message-----
> From: Adrian Vos [mailto:]
> Sent: Dienstag, 3. August 2004 04:52
> To:
> Subject: [68HC12] Metrowerks startup code > Hi All,
>
> Just after a bit of advice here on metrowerks. Is it possible
> to prevent metrowerks from doing its copy to ram on
> initialisation. From a look at the startup code, it goes
> through two stages... in the first it initialises the 0 ram
> data. In the second stage it initialises the ram data that
> has non zero initial values. I can obviously modify the file
> startup.c, but I notice that this is reliant on a structure
> which contains data regarding the initialisation. I would
> prefer to find a way (linker option or something) to modify
> the data in this structure so that it does not perform the
> ram initilisation, but runs standard and well proven startup.c.
>
> I obviously still dersire the other features of startup.c
> like the stack initialisation etc. I currently use a main
> bootcode in the protected area that has the reset vector. It
> jumps to the main firmware which may change. The bootcode
> takes place after the startup code, so the startup code will
> initialise the ram incorrectly if I change the main firmware
> to use the ram differently, so I would rather just do the
> initilisation manually in my main firmware and disable the
> initilisation of the ram in startup.c.
>
> Thanks!!
>
> -- Adrian >
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Yahoo! Domains - Claim yours for only $14.70
> http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/dN_tlB/TM
> --------------------------
> ------~- > Yahoo! Groups Links >




Adrian Vos wrote:

> Just after a bit of advice here on metrowerks. Is it possible to prevent
> metrowerks from doing its copy to ram on initialisation. From a look at the
> startup code, it goes through two stages... in the first it initialises the
> 0 ram data. In the second stage it initialises the ram data that has non
> zero initial values. I can obviously modify the file startup.c, but I notice
> that this is reliant on a structure which contains data regarding the
> initialisation. I would prefer to find a way (linker option or something) to
> modify the data in this structure so that it does not perform the ram
> initilisation, but runs standard and well proven startup.c.
>
> I obviously still dersire the other features of startup.c like the stack
> initialisation etc. I currently use a main bootcode in the protected area
> that has the reset vector. It jumps to the main firmware which may change.
> The bootcode takes place after the startup code, so the startup code will
> initialise the ram incorrectly if I change the main firmware to use the ram
> differently, so I would rather just do the initilisation manually in my main
> firmware and disable the initilisation of the ram in startup.c.


There is a segment qualifier that you can use in the *.prm file: NO_INIT

Here is the definition given by the manual: "...Qualifies a segment, where
read and write accesses are allowed. Objects within such a segment remain
unchanged during application startup. This qualifier may be used for
segments referring to a battery backed RAM.
Sections placed in a NO_INIT segment should not contain any initialized
variable (variable defined as 'int c = 8')..."

You can find more details in the 'Manual_smartlinker.pdf' which is in the
directory: C:\CodeWarrior CW12_V3.1\Help\pdf\

Ron

--
Metrowerks Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and Metrowerks' staff
-- http://www.metrowerks.com/community --

Ron Liechty - - http://www.metrowerks.com


Thanks for the input all!!

Since what I am doing is quite complex, I decided to remove the startup
code, and boot from my own reset vector. I do not require the ram
initialisation, and the only other things the startup does is initialise the
stack.... Easy!!

-- Adrian

----- Original Message -----
From: "MW Ron" <>
To: <>
Sent: Tuesday, August 03, 2004 11:15 PM
Subject: Re: [68HC12] Metrowerks startup code > Adrian Vos wrote:
>
> > Just after a bit of advice here on metrowerks. Is it possible to prevent
> > metrowerks from doing its copy to ram on initialisation. From a look at
the
> > startup code, it goes through two stages... in the first it initialises
the
> > 0 ram data. In the second stage it initialises the ram data that has non
> > zero initial values. I can obviously modify the file startup.c, but I
notice
> > that this is reliant on a structure which contains data regarding the
> > initialisation. I would prefer to find a way (linker option or
something) to
> > modify the data in this structure so that it does not perform the ram
> > initilisation, but runs standard and well proven startup.c.
> >
> > I obviously still dersire the other features of startup.c like the stack
> > initialisation etc. I currently use a main bootcode in the protected
area
> > that has the reset vector. It jumps to the main firmware which may
change.
> > The bootcode takes place after the startup code, so the startup code
will
> > initialise the ram incorrectly if I change the main firmware to use the
ram
> > differently, so I would rather just do the initilisation manually in my
main
> > firmware and disable the initilisation of the ram in startup.c. > There is a segment qualifier that you can use in the *.prm file: NO_INIT
>
> Here is the definition given by the manual: "...Qualifies a segment, where
> read and write accesses are allowed. Objects within such a segment remain
> unchanged during application startup. This qualifier may be used for
> segments referring to a battery backed RAM.
> Sections placed in a NO_INIT segment should not contain any initialized
> variable (variable defined as 'int c = 8')..."
>
> You can find more details in the 'Manual_smartlinker.pdf' which is in the
> directory: C:\CodeWarrior CW12_V3.1\Help\pdf\
>
> Ron
>
> --
> Metrowerks Community Forum is a free online resource for developers
> to discuss CodeWarrior topics with other users and Metrowerks' staff
> -- http://www.metrowerks.com/community --
>
> Ron Liechty - - http://www.metrowerks.com >
> Yahoo! Groups Links