[En-Nut-Discussion] Nut/OS Initialization
Harald Kipp
harald.kipp at egnite.de
Tue Sep 16 09:57:20 CEST 2008
Hi Ole,
Ole Reinhardt wrote:
>
> 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)()?
Btw. not all compilers fully support C99, specifically designated
structure initializers. But that's no big deal, just a bit more text to
write.
Harald
More information about the En-Nut-Discussion
mailing list