When a target specific executable project is created using the New
Project Wizard, the following default
files are added to the project:
- Target_Startup.s - The target specific startup
code.
- crt0.s - The CrossWorks standard C runtime code.
- Target_MemoryMap.xml - The target
specific memory map file for the board. Note that for some target's a
general linker placement file may not be suitable. In
these cases there will be two memory map files, one for a Flash build and one
for a RAM build.
- flash_placement.xml - The linker placement file for a Flash build.
- sram_placement.xml - The linker placement file for a RAM build.
- Target_Target.js - The target
script file.
Initially, shared versions of these files are added to the project, if you
want to modify any these files you should select the file in the project
explorer and then click the Import option from the context menu. This
will copy a writeable version of the file into your project directory and change
the path in the project explorer to be that of the local file. You will then be
able to make changes to the local file without effecting the shared copy of the
file.
The following list describes the typical flow of a C program created using
CrossStudio's project templates:
- The processor starts executing at address 0x0000000 which is the reset
exception vector. The exception vector table can be found in the target specific startup code, it is put into the program section .vectors
which is positioned at address 0x00000000 by the target
specific memory map file.
- The processor jumps to the reset_handler label in the target specific startup code which configures the target.
- When the target is configured the target specific startup
code jumps to
the _start entry point in the C runtime
code which sets up the C runtime
environment.
- When the C runtime environment has been set up the C runtime
code jumps to the C entry
point function main.
- When the program returns from main, it re-enters the C runtime
code, executes the destructors and then finally enters an endless loop.