Page 1 of 1

NIL 4.0.0 Documentation

Posted: Sat Jan 18, 2020 4:00 pm
by tfAteba
Hello Giovanni,

I don't see the documentation of the NIL 4.0.0, may be it is not released yet?
I'm looking on this page:

I need to update AVR NIL demo because of new method on the NIL API.
THD_TABLE_ENTRY have been replace by THD_TABLE_THREAD in file: includet/ch.h:583:#define THD_TABLE_THREAD(_prio, _name, _wap, _funcp, _arg)

So I need to know the new parameters used by the new API. It is present in code source but I wanted to look at the online documentation.
Is there another place to look please?

Re: NIL 4.0.0 Documentation

Posted: Sat Jan 18, 2020 6:38 pm
by Giovanni

It is not yet released but you could look at the demos in trunk.

Note that there is a huge difference, threads can be defined in the table OR created at runtime. In chconf.h you can define how many priority level you need, then you can have one thread at each priority level (or none). It is not possible to have multiple threads at same priority, just like the previous NIL.

The table has one extra parameter for each thread: the priority:

In chconf.h:

Code: Select all

 * @brief   Maximum number of user threads in the application.
 * @note    This number is not inclusive of the idle thread which is
 *          implicitly handled.
 * @note    Set this value to be exactly equal to the number of threads you
 *          will use or you would be wasting RAM and cycles.
 * @note    This values also defines the number of available priorities
 *          (0..CH_CFG_MAX_THREADS-1).
#if !defined(CH_CFG_MAX_THREADS)
#define CH_CFG_MAX_THREADS                  8

In main.c:

Code: Select all

 * Threads creation table, one entry per thread.
  THD_TABLE_THREAD(0, "blinker1",     waThread1,       Thread1,      NULL)
  THD_TABLE_THREAD(1, "blinker2",     waThread2,       Thread2,      NULL)
  THD_TABLE_THREAD(4, "tester",       waThread3,       Thread3,      NULL)

Note that the "tester" thread needs 2 free priority levels before and after itself, it needs those empty slots to create its own threads during execution. Zero is the highest priority, the main has implicitly the lowest priority and is the idle thread (just like before).


Re: NIL 4.0.0 Documentation

Posted: Sun Jan 19, 2020 12:41 am
by tfAteba
Yes, I look at STM32 demo to make changes.

Thanks for all details on how thing works.