Crossware

Table of Contents        Previous topic       Next topic       

Projects and Workspaces->Startup Files in the Embedded Development Studio

A properly constructed startup file is essential for C since the stack and heap segments to be used by the compiler must be correctly setup.  Additionally all C variables must be correctly initialised.  The libraries supplied with your compiler will contain a default startup file which will be included if you do not specify an alternative.  This startup file may not however exactly suit your requirements.

If you are programming in assembler only, then there is no default library and so no default startup file.  Traditionally you would have had to construct a startup file of your own from scratch.  Although this is not difficult to do, it is an added activity that can to some extent be automated.

A new method of handling startup files has been introduced with the Embedded Development Studio.  If you ask the New Project Wizard to create a startup file for you, then it will copy a startup file template into your project directory, rename it to startup.asm and initialise special variables in that startup file with values corresponding to the memory configuration that you have selected.  If you later change your memory configuration, the Embedded Development Studio will automatically update these special variables.

These special variables are:

__InterruptVectorOffset
__NoRom
__LowestRomLocation
__HighestRomLocation
__LowestRamLocation
__HighestRamLocation

and, for the 8051 target family

__HighestRamLocation.

These special variables can be used in any way that you wish in startup.asm.  If you look at the templates supplied, you will see the way in which some of these are used.

The templates supplied are the essentials of a startup file.  They will get you started but you may need to add many additional refinements to suit your specific target system.  If you wish, you can transfer the startup file that you have refined back into the appropriate template directory.  It will then be automatically available for your future new projects.