Syntax
-s name
Description
C code requires a small startup file containing system initialization code to be executed before entering main. The standard startup code is found in the object file $(InstallDir)/lib/crt0.hzo and the compiler driver automatically links this into your program. If, however, you have special requirements for system initialization, or have changed the default names of the data sections, you can customize the standard startup code and use this alternative code rather than the standard code.
You will find the source code for the standard startup module crt0 in the file $(InstallDir)/src/crt0.asm.
Setting this in CrossStudio
To provide customized startup code for your C application:
- Select the project in the Project Explorer.
- In the Linker Options group set the Include Startup Code property to No.
- Add the assembly source file containing the replacement startup code to the project with Project | Add Existing Item.
The startup code it is just like any other source file in your project and is rebuilt when out of date, for instance.
Examples
To instruct the compiler to assemble file1.c and and link the replacement system startup code $(InstallDir)/lib/mystartup.hzo (rather than the standard startup code) into app.hzx:
hcl -smystartup -o app.hzx file1.c
To instruct the compiler to assemble file1.c and and link the replacement system startup code mystartup.asm in the current directory (rather than the standard startup code) into app.hzx:
hcl -s- -o app.hzx file1.c mystartup.asm