Nil RTOS update - Fast and Tiny!

The issue is they use SdFat and Sd2Card

SdInfo was meant to be a standalone diagnostic so I didn't use the SdFat class which wraps Sd2Card, SdVolume, and the root file.

I wanted to first initialize the SD card and get info that didn't depend on the card format. I then initialize SdVolume and check the format.

You probably have two copies of SdVolume. Surprised it works.

STACK
Stack Sizes: 197 85 85 101 101 85 117 85 117 197 85 197 165 197 197 309 309 10107
Unused Stack: 165 55 55 47 49 55 87 55 87 58 55 167 41 71 167 192 50 9995

Looks like you are going beyond the design thread count for Nil. I removed this when I made the thread count dynamic.

#if NIL_CFG_NUM_THREADS > 12
#error "Nil is not recommended for thread-intensive applications, consider" \
       "ChibiOS/RT instead"
#endif

Nil uses very simple algorithms for scheduling that involve scanning tables. ChibiOS uses more conventional linked lists to order objects for more efficiency when there are many objects. This also allows dynamic priorities and priority inheritance for a mutex.

Is there any better option how to handle the error states within a Nilrtos thread?

Alarms, events, and logging are major components of large embedded systems. Usually there is an API for threads to communicate with this module using something like mail boxes. Error messages are logged and displayed for operators. Operators can acknowledge errors and reply to threads.

Here are two links that illustrate the scale of this subsystem.

An old link to FANL which had the Tevatron http://www-ad.fnal.gov/controls/micro_p/errlog.html#ch-2

A newer link for an LHC experiment at CERN http://iopscience.iop.org/1742-6596/396/1/012038/pdf/1742-6596_396_1_012038.pdf

BTW the FreeRam() does not work under Nil well.

That's why Stack Size and Unused Stack exist in Nil.