This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project. See the eCos home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

[ECOS] Use of ifdefs a hinderance for portability.



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