Platform hal porting, Hal platform porting process, Brief overview – Comtrol eCos User Manual

Page 326: Stepbystep, Step-by-step

Advertising
background image

Chapter 11. Porting Guide

Platform HAL Porting

This is the type of port that takes the least effort. It basically consists of describing the platform (board) for the
HAL: memory layout, early platform initialization, interrupt controllers, and a simple serial device driver.

Doing a platform port requires a preexisting architecture and possibly a variant HAL port.

HAL Platform Porting Process

Brief overview

The easiest way to make a new platform HAL is simply to copy an existing platform HAL of the same archi-
tecture/variant and change all the files to match the new one. In case this is the first platform for the architec-
ture/variant, a platform HAL from another architecture should be used as a template.

The best way to start a platform port is to concentrate on getting RedBoot to run. RedBoot is a simpler environment
than full eCos, it does not use interrupts or threads, but covers most of the basic startup requirements.

RedBoot normally runs out of FLASH or ROM and provides program loading and debugging facilities. This allows
further HAL development to happen using RAM startup configurations, which is desirable for the simple reason
that downloading an image which you need to test is often many times faster than either updating a flash part, or
indeed, erasing and reprogramming an EPROM.

There are two approaches to getting to this first goal:

1. The board is equipped with a ROM monitor which allows "load and go" of ELF, binary, S-record or some

other image type which can be created using objcopy. This allows you to develop RedBoot by downloading
and running the code (saving time).

When the stub is running it is a good idea to examine the various hardware registers to help you write the
platform initialization code.

Then you may have to fiddle a bit going through step two (getting it to run from ROM startup). If at all possible,
preserve the original ROM monitor so you can revert to it if necessary.

2. The board has no ROM monitor. You need to get the platform initialization and stub working by repeatedly

making changes, updating flash or EPROM and testing the changes. If you are lucky, you have a JTAG or
similar CPU debugger to help you. If not, you will probably learn to appreciate LEDs. This approach may also
be needed during the initial phase of moving RedBoot from RAM startup to ROM, since it is very unlikely to
work first time.

Step-by-step

Given that no two platforms are exactly the same, you may have to deviate from the below. Also, you should
expect a fair amount of fiddling - things almost never go right the first time. See the hints section below for some
suggestions that might help debugging.

The description below is based on the HAL layout used in the MIPS, PC and MN10300 HALs. Eventually all
HALs should be converted to look like these - but in a transition period there will be other HALs which look

222

Advertising