[En-Nut-Discussion] Run-time or compile-time configurable devices?

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Jan 3 21:02:49 CET 2012


>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:

    Harald> Hi Uwe, On 03.01.2012 15:48, Uwe Bonnes wrote:

    >> At the moment to my knowledge, a call like
    >> NutRegisterDevice(&DEV_UART4, 0, 0); has no restrictions and and so
    >> all the dependancies of the used NUTDEVICE must be resolved at
    >> runtime. Is there a usage for that feature? If not, a lot of
    >> dependancies can be resolved at compiled time and will result in much
    >> smaller code.

    Harald> I'm afraid I do not understand your question. Actually it works
    Harald> like this:

    Harald> Including

    Harald>   NutRegisterDevice(&DEV_UART4, 0, 0);

    Harald> will add a dependency at compile time and thus add the UART
    Harald> driver to the final binary.

My question was:

Are there application, that read a pointer to a device during runtime and
then open that device during run-time. That way, the code has to do
decisions caused on different device pointers during runtime.
The NutOS examples I have looked at only define the pointer to the device at
compile times. So these decisions can be done during compile time.

The AVR is no good example. But the STM32 has e.g. zillions of timers in
groups with same capabilities in the group and slightly different
capabilities between groups. If the used timer is changable
(let's assume only in the group) at runtime, we either have to carry code to
handle all timers of that group or we need a wrapper that handles that group
and has to do decisions based on the used timer during runtime.

If there are only use-cases that change the timer during compile time,
either only _one_ timer has to be included in the code or the device group
wrapper can do the decision during compile time.

Hope the question is now a little clearer.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the En-Nut-Discussion mailing list