next up previous contents
Next: GDB and uCR Up: Link Time Context Previous: Memory Map

Hardware Initialization Code

There is no way any portable program can support the variety of hardware platforms available. UCR therefore expects to be called by code that you write. You write code that configures the hardware, and makes the first C/C++ call, to the ucr_start() function that runs uCR. The hardware initialization file is conventionally called locore.o and is usually written in a single assembly source file.

However, uCR does come with ready-made initialization code for certain targets. If such code exists, there is also a linker script (a ``MODEL'') that describes the layout of memory and the name of the startup file. Conventionally, that file is called locore.o.

The locore.o file exists in $UCR/$TARGET/lib/locore.o. The source for locore.o is practically always assembly code, and can be found in $UCR/source/libucr/$(TARGET)-locore.s. The Makefile in source/libucr knows whether the locore.o file exists for the target at hand, and if it does exist, knows how to compile it.

Stephen Williams