This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Auto initialisation of packages
- To: ecos-discuss at sourceware dot cygnus dot com
- Subject: [ECOS] Auto initialisation of packages
- From: lunn at ma dot tech dot ascom dot ch (Andrew Lunn)
- Date: Thu, 28 Oct 1999 10:05:47 +0200 (MET DST)
Hi folks
Im working on a new package for eCos which will need to be
initialised, in a similar way to the cyg_uitron_start() and
cyg_iso_c_start(). The documentation says to add my own
cyg_package_start() routine which calls the cyg_uitron_start(),
cyg_iso_c_start() and then my own my_package_start().
When there are only a few packages this is OK but as eCos expands and
new packages are added this becomes unmanagable. eg when the TCP/IP
port is complete i expect there will be a cyg_tcpip_start(). There may
also be a cyg_filesystem_start() etc.
How about using the same magic as for device drivers. Each device
driver declares a structure which is put into a special segment. Its
the linkers job to pull all these structures together and it
effectivly makes an array. On startup the code walks the array in this
segment and does what needs to be done with the drivers.
Why not use the same method for package start functions? What way its
all automagic. You could add a start-order field so that packages that
build on other packages have a higher value and so are started later
rather than earlier in the sequence.
Andrew