Let's discuss why it won't work in this particular library. Because the Arduino IDE preconfigures all the hardware resources (Timers, Serial Ports, etc) in a MCU "under the covers" to make it easy for new programmers, there are few resources available to drive a RTOS without generating conflicts with Arduino Libraries, or causing important features to cease working. Luckily with
AVR ATmega devices the Watchdog Timer was unused by the Arduino IDE, so I could use that to drive the RTOS System Tick, and the Watchdog Timer is configured identically across all ATmega devices.
Also because no resources were re-purposed (borrowed from the Arduino IDE), there was no need to generate a separate core for the
AVR version FreeRTOS library. It works with the standard Arduino core.
To support other hardware within FreeRTOS it is necessary to have both a specific configuration for a hardware timer to generate System Tick interrupts, and a specific efficient Scheduler Interrupt to drive task switching. These two items depend strongly on the hardware, and mean that the implementation will be different for each implementation of the Cortex M0+ core. The Arduino Zero uses the SAMD21 but the Arduino MKR1000 uses the SAMW25. Whilst these are both Cortex M0+, the implementation for each one is different, because of the different features they provide.
Cortex M0+ is a VLSI "library" which can be licenced from ARM. There is no requirement from vendors to implement it in exactly the same way for each device they produce. Unlike ATmega which is a proprietary implementation from one vendor (AVR), each vendor usually changes the implementation of the Cortex line of processors to suit their exact business requirements, which generally change from vendor to vendor, and even across the range provided by one vendor.
So whilst someone might find it useful to support all of these different ARM based boards with an implementation of FreeRTOS, I find that most of my needs are covered by ONE
AVR implementation which supports all of these Arduino boards; UNO, LEONARDO, YUN, PRO MINI, MICRO, ESPLORA, all of the Arduino Wearables lke LilyPad, MEGA 2560, Adafruit Feather, and all of the options that third parties produce for inexpensive clones.
There are other timing solutions already available, that provide Threading (quite different from a RTOS in capabilities and features) which may suit simple requirements. These have been mentioned.
Perhaps not the desired answer, but in reality the
AVR ATmega based range of Arduino hardware essentially covers all the requirements of those interested in using the Arduino IDE. Beyond these basic projects, the limitations inherent in using the Arduino IDE outweigh the advantages.
Lesezeichen