Re: Startup code
- From: Chris Hills <chris@xxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 14:21:58 +0100
In article <d9tsta$po7$1@xxxxxxxxxxxxxxxxxxxx>, Jet Morgan <jm@paran---
andr---.wanadoo.co.uk> writes
>
>"Meindert Sprang" <mhsprang@xxxxxxxxxxxxxxxxxxx> wrote in message
>news:11c4t1rcaohggba@xxxxxxxxxxxxxxxxxxxxx
>
>> I'd like to disagree with this. In all compilers I used so far, the
>startup
>> code only set's up the very basic things like the stack pointer, code and
>> data segments dependig on the CPU used and initializing all variables and
>> constants.
>
>> The rest, like further processor and peripheral initialisation is
>> done in user written C functions.
>
>That is still startup code, even if written in C.
>
>And so far, I have never written start up
>> code, I could always use the start up code supplied by the compiler
>vendor,
>> which is automatically chosed and configured by most IDE's.
>
>The compiler vendor will not typically know how the processor
>is connected to the other devices, such as memory bus widths,
>clock timings etc. That's why YOU (the designer) has to write it.
>
>There seems to be this perception that startup code is specifically
>assembler. It *could* be written that way but I've always
>written my startup code in a combination of C and assembler.
>
>Richard [in PE12]
>
>
Start up code is the minimum code required to get to main... The start
point of the C code.
It depends on the processor how much start up code there is. This is
usually a file supplied with the compiler. I have know embedded C
programmers never realise there was start up code before the main as the
compiler added it transparently. This file is of course is all written
in assembler.
On some MCU some people modify this start up assembler. Most don't. On
other MCUs the start up file is a template that the user has to set up
various variables (stack, memory, clocks etc.).
So the answer as to what is start up code is "it depends" but it usually
refers to the assembler that sets up enough of the MCU so that the C
program can start at main.
Note strictly speaking if you are using start up code there is no OS and
therefore the first C function is not required to be called main.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ chris@xxxxxxxxxxxx www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
.
- References:
- Startup code
- From: ravikumar . n
- Re: Startup code
- From: Jet Morgan
- Re: Startup code
- From: Meindert Sprang
- Re: Startup code
- From: Jet Morgan
- Startup code
- Prev by Date: Re: Startup code
- Next by Date: Re: Startup code
- Previous by thread: Re: Startup code
- Next by thread: Re: Startup code
- Index(es):
Relevant Pages
|