ChibiOS/RT RTOS for Due

I have posted versions of the ChibiOS/RT RTOS for AVR Arduinos, Due, and Teensy 3.0 as

A small patch is required to run ChibiOS on Due. This patch involves a hook for access to the Cortex M SysTick interrupt. Future versions of the Arduino IDE should have this hook. I included the patched version of wiring.c for 1.5.1r2.

I have packaged ChibiOS as two libraries, ChibiOS_AVR and ChibiOS_ARM. It would have been possible to combine these into one library but that would require a lot of modification to combine of the original ChibiOS files with conditional compilation.

A number of examples are included.

ChibiOS is extremely fast and small on Due. One example measures the time for a semaphore and a context switch using a scope. I use digitalWrite to generate pulses for this test. The time to execute digitalWrite is almost the same as the total time for giving a semaphore and doing a context switch between two threads.

I plan to post FreeRTOS soon. I want to update the AVR version of FreeRTOS and do more testing first.

Hi fat16, thank you very much for this great tool!
I’ve tried both freeRTOS and ChibiOS and they worked out of the box on the DUE with your libraries (of course, after having applied the patch).

In the examples you provided, there is no chBlinkPrint for ARM, so I’ve edited the chBlinkPrint for AVR, changed the #include command, removed the F() in the println commands (by the way, what was it for?).
I was impressed to observe that the ChibiOS version has a smaller footprint and that it runs faster (at least, comparing the numbers provided in the two BlinkPrint examples).

In your opinion, since you tried both the RTOSes, which one is the best? I know it’s not easy to give an absolute answer. And probably there’s no absolute answer. However, in terms of responsiveness and easiness of learning/use, which one do you suggest?

For a discussion this is pretty good. Seems like the AYEs are with ChibiOS

I checked and it has a blink print for ARM but I called the file ChBlinkPrint.ino instead of chBlinkPrint.ino. It works on windows but probably not on Linux or a Mac.

I like ChibiOS but FreeRTOS is very popular and there are lots of examples and documentation for FreeRTOS. I leave it to users to choose.

I will soon post 16 examples from the FreeRTOS book. I can't post the book because of copyright.

I will also be posting more ChibiOS examples.