Kernel porting notes

There are two aspects of porting eCos: porting to a new CPU (architectural porting) and porting to a new board with a CPU that is already supported (platform porting).

In this release of eCos we provide these brief notes on platform porting.

Another useful reference for porting to a new platform is the GNUPro documentation on gdb stubs, which can be found at

For the purposes of this presentation, we will call the new target board myboard, and we will assume that it is closely related to the stdeval1 board (if the new board has an MN10300 CPU) or a jmr3904 board (if the new board has a TX39 CPU).

Now follow this sequence of steps, noting that all pathnames are relative to the directory in which eCos has been installed.

Prepare a new directory in the HAL package

You should start by copying the entire directory packages/hal/mn10300/hal/v1_1/stdeval1 (or packages/hal/mips/hal/v1_1/jmr3904) to packages/hal/mn10300/v1_1/myboard (or packages/hal/mips/v1_1/myboard).

In the new directory change the names stdeval1.ld and stdeval1.S (or jmr3904.ld and jmr3904.S) to myboard.ld and myboard.S

Modifying vectors.S

The file packages/hal/mn10300/arch/v1_1/src/vectors.S (or packages/hal/mips/arch/v1_1/src/vectors.S) contains initialization code which is placed in the interrupt vectors for the particular CPU. It also contains the first level default vector service routines that save and restore state for both exceptions and interrupts.

Now for the MN10300 you should:

For the TX39, instead, copy the area in which memory regions are set up; this is enclosed in the preprocessor statements

#ifdef CYG_HAL_MIPS_JMR3904
    (set up controller according to where the memory is installed)

and change it to

    (set up controller according to where the memory is installed)

Modifying hal_diag.c

The file packages/hal/mn10300/myboard/v1_1/src/hal_diag.c (or packages/hal/mips/myboard/v1_1/src/hal_diag.c) implements support for HAL diagnostic output. You should provide an implementation of diagnostic routines if you are not using on-chip devices for diagnostics, since the HAL already supports the on-chip devices.

Modifying PKGconf.mak

The file packages/hal/mn10300/myboard/v1_1/src/PKGconf.mak (or packages/hal/mips/myboard/v1_1/src/PKGconf.mak) contains makefile targets for the given board. You should change occurrences of stdeval1 (or jmr3904) to say myboard.

Modifying myboard.ld

The file packages/hal/mn10300/myboard/v1_1/src/myboard.ld (or packages/hal/mips/myboard/v1_1/src/myboard.ld) is the linker script for myboard. You should: