[En-Nut-Discussion] Nut/OS Initialization

Ole Reinhardt ole.reinhardt at embedded-it.de
Wed Sep 17 10:59:30 CEST 2008


Hi Harald,

> > For example in linux this is done by filling up a struct like this one
> > 
> > MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module")
> >         /* MAINTAINER("Jürgen Schindele") */
> >         .phys_io        = 0x40000000,
> >         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
> >         .boot_params    = TRIZEPS4_SDRAM_BASE + 0x100,
> >         .init_machine   = trizeps4_init,
> >         .map_io         = trizeps4_map_io,
> >         .init_irq       = pxa_init_irq,
> >         .timer          = &pxa_timer,
> > MACHINE_END
> > 
> > and linking it with the application. Right now I don't know the _exact_
> > mechanism, but I should not be that complicate.
> 
> I understand the data structure and how it forces the linker to include 
> the driver. But I do not understand, how the program code becomes aware 
> of this structure to make use of the specified routines. In other words: 
> How does the initialization code know that TRIZEPS4 exists and that it 
> can call trizeps4_init() via (*init_machine)()?

I'll examine this mechanism futher on friday. Today and tomorrow I won't
be in office and will have to do some service work at some customers...

But in general this kind of glue logic is used in several places in the
linux kernel and allows you quite nice driver design.

Regards,

Ole Reinhardt

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list