multi task cooperative scheduler for Teensy2 & 3 similar to java Thread with timer

Status
Not open for further replies.
multi task cooperative scheduler for Teensy2 & 3 similar to java Thread with timer

Hello
here we are, I was in the idea of building a cooperative scheduler for the Arduino platform for a while.
in fact this has to do with a 20 year old personal story :)

I m pleased to propose this library called SCoop to provide a simple multi task/thread environement for AVR & ARM platform in the Arduino IDE environement.

In this beta 0.9 version, the file is stored in my public drop box folder here and should be unrar in your arduino sketch folder. (not libraires).
It has been tested with Arduino 1.0.2 on Teensy ++2.0 and Teensy3.0 (ARM) and Arduino Uno.
The SCoopDemo file works like a charm and perform some led blink (...) with some trace info displayed on the Serial monitor.

the PDF file aims to provide a comprehensive user guide and shall be read first to understand the philosophy of this library and why it makes a difference compared to other RTOS. I feel it is quite powerfull and easy to use. this is up to the community to judge now on

Paul, this library leverage the concepts of the Java Thread and Timer and use the famous yield() function. may be this library will be attractive and a good candidate for inclusion in your teensy core :eek:

I will provide support in the coming days in order to end up with a clean v1.0

enjoy it :)
 
Some technical info which are not in the PDF.

the library to include is called "SCoop.h"
at the begining of SCoop.h it is possible to include "SCoopdebug and to define SCOOPTRACE.
this will bring a set of additional methods and macro to facilitate printing (using sp instead of Serial.print for example)
and this add a method called "trace" to the basic object of the library in order to display the adress of the this pointer and stacks.

the file SCoopswitch contains the assembly instruction for task context switching.
in a futur version, I may replace all of this by the standard setjmp.h libray but I couldnt find one for ARM yet.

good night (11pm central europe time :) )
 
Thank you for doing this, I think it is a useful addition. I have not yet tried the code, but the PDF user guide was interesting to read. There are a number of minor spelling mistakes and inconsistencies, for example using (secondLefts) instead of (secondsLeft) as it was defined, but I get the idea.

cheers,
John
 
oops there is a litle "braket { } bug" in the SCoopTask::run() and you have to put the yield() call yourself inside your task loop() otherwise the scheduler might be stuck :)
... will be corrected this week end in release 1
 
SCoop pack Version 1

Hello,
after a long week end of deep dive coding and reviewing and writing documentation, I m pleased to release the SCoop pack V1, including:

-SCoop.h scheduler library with SCoopTask, SCoopEvent and SCoopTimer object framework and the yield() global function

-TimerUp.h and TimerDown.h providing powerfull standaolne library for unlimited time counter with time base

-IOFilter.h including Input, Output, InputFilter, InputMem, OutputMem, which provides a friendly environement for declaring and using I/O and to provide time filtering and counting on any inputs in synchronous mode (with SCoop timers) or asynchronous as a standalone library.

-user guide, 14 pages of information including technical details and some performance measurement on Teensy 2 , 3 and arduino uno.

Every thing on google code here : https://code.google.com/p/arduino-scoop-cooperative-scheduler-arm-avr/downloads/list

I hope you will apreciate this pack and I m willing to get your feedbacks and remark to improve this and keep momentum on this project :)

cheers
fabrice
 
Thanks for writing a document about it! This shows that you have thought through the use carefully and are not just tossing out source code with a "good luck". This is nice to see!
Bruce
 
NEW VERSION

I m pleased to release a new SCoop library V1.1 XMass Pack with some updates and goodies.

- updated user guide now 17 pages

SCoop.h :

  • yield() routines optimized,
    new object SCoopFifo for easy handling of Fifo buffers,
    some preprocessing parameters to optimize speed
    should compile for Arduino DUE but NOT TESTED ...

Timer Up & down : cosmetic changes, code moved from .h to .cpp

IOFilter : not changed

some new examples including a 1KHZ sampling and a new performance measurement sketch

ok, it is time for a Christmas break and I wish you all a merry Christmass and an happy new year !
cheers
 
after a good night, I have slightly update the user guide document in version 1.1.1, just correcting some typo or bugs in the code examples.
please download newer pdf file from the goggle code project repository
thx!
 
google code updated with SCoop library V1.1.1 XMass Pack, for enhancing the SCoopFifo object with atomic code portion. this enable using it in ISR like inexample 4 of the pack.
please download this version if you plan to use fifo in isr.
also include a 500hz analog sampling (example 5) without interrupts

time for the week end !
 
Most ARM processors, including the Teensy 3 "claim to fame" is for low power or battery operated designs. That is why Apple used ARM processors in their iDevices.
Does SCoop RTOS provide reduced power savings or consumption on the Teensy 3?

Note: QP uses "idle time" to reduce and save power.;)
 
Last edited:
Status
Not open for further replies.
Back
Top