[ECOS] Use of ifdefs a hinderance for portability.
Robert Klinkhammer
klink@mediaone.net
Mon Dec 14 03:43:00 GMT 1998
Having had significant experience in porting and
supporting a commercial multiprocessor real-time operating system to a number of
processor architectures, (as well as numerous SBC and devices), I am concerned
about the amount of "#ifdefs" in the startup and platform code.ÃÂ
(The HAL)
ÃÂ
As developers port to numerous BSPs and
processors, the use of #ifdefs will become unwieldy and complicated.ÃÂ As I
recall, one of the first iterations that we made was very similar to eCos
HAL.ÃÂ Our lives became a whole lot easier as we moved toward link-time
configuration.ÃÂ It requires a little more work to define the interfaces,
but it is worth it.
ÃÂ
For example, a possible
solution for the reset and initialization of a processor and platform could
be:
ÃÂ
ResetVSR:
ÃÂ ÃÂ ÃÂ minimal processor
initialization
ÃÂ ÃÂ ÃÂ jump
ResetPlatform
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ (ResetPlatform is linked in as a separate model and when finished,
jumps back to PlatformResetFinished).
ÃÂ
PlatformResetFinished:
ÃÂ
ÃÂ ÃÂ ÃÂ Initialization continues and establishes a C-Runtime
environment
ÃÂ ÃÂ ÃÂ with the following
properties:
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ hardware devices in a
reset state.
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ processor
interrupts disabled
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
caches invalidated and disabled.
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ MMU
disabled.
ÃÂ ÃÂ ÃÂ ÃÂ
Call Generic C startup and Initialization Routine.
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ (This will further call
"standard" BSP specific functions)
ÃÂ
This way, an eCos
configuration would be based on linking rather than conditional
compilation.ÃÂ Note that the purpose of the ResetPlatform "function" is
to initialize the hardware to a known "reset" state, not to do a
complete platform initialization.ÃÂ Similar changes could also be made
elsewhere.
ÃÂ
=========================================== Robert
Klinkhammer Principal Software Engineer
ÃÂ
klink@medaone.net http://people.ne.mediaone.net/klink
ÃÂ
ÃÂ
ÃÂ
ÃÂ
ÃÂ
More information about the Ecos-discuss
mailing list