avr-os: multitasking library

Hey all,

First off I have to say I love Arduino! Great community and a great platform. I was playing around with multitasking and I decided to release a library for multitasking on an Arduino.

Check out the code here: https://github.com/chrismoos/avr-os
I wrote a little introduction to how it works here: avr-os: Multitasking on Arduino | chrismoos

Hello,

Nice work.
You talk about avr, any chance to have it work on a due ?
Because of low memory, I think it is difficult to use multitasking on an uno (but useful some times) easier on a mega.
But I feel it will be mandatory on the due.
Thanks for the job.

Mgth

mgth:
Hello,

Nice work.
You talk about avr, any chance to have it work on a due ?
Because of low memory, I think it is difficult to use multitasking on an uno (but useful some times) easier on a mega.
But I feel it will be mandatory on the due.
Thanks for the job.

Mgth

Yeah once I get a Due I'll probably port it over there.

chrismoos:
Hey all,

I wrote a little introduction to how it works here: avr-os: Multitasking on Arduino | chrismoos

Hey

Interesting.

How much multitasking needs memory. Is it possible to check. I am not familiar with multitasking, but I know I would need it some times. So a basic question. Is it the spinlock which yields the processing to the next task. What about interrupts. And what about very long tasks where the processing is not ready when the next task begins.

Leif

Edit: By the way, I'll probably use the mega or similar.

LMI:
Hey

Interesting.

How much multitasking needs memory. Is it possible to check. I am not familiar with multitasking, but I know I would need it some times. So a basic question. Is it the spinlock which yields the processing to the next task. What about interrupts. And what about very long tasks where the processing is not ready when the next task begins.

Leif

Edit: By the way, I'll probably use the mega or similar.

You can check out this file which shows you some of the memory overhead:

Each task will use 256 bytes for stack and 18 bytes for the task definition (which actually could be reduced a bit with those last 2 pointers -- start_delay_secs and delayMillis). The task stack size is configurable in the build also.

The spinlock is not used to implement multitasking. A timer interrupt is fired which will interrupt your taks's processing. If your task processing is longer than a tick then potentially a new task will be executed (and the current one is suspended).

Here are two more multitasking options for AVR, ChibiOS/RT and FreeRTOS.

The files are ChibiOS20120529.zip and FreeRTOS20111031.zip at http://code.google.com/p/beta-lib/downloads/list. These files support AVR and I will update them soon to the versions I used with ARM.

I have also ported these to the ARM Teensy 3.0 and Arduino Due. I have posted the Teensy 3.0 version and am finishing test for the Due version. I will probably merge the Teensy 3 and Due versions into one library.

FreeRTOS is very popular and has many users. Both systems are excellent and support a wide variety of RTOS features.

I personally like ChibiOS/RT on avr since it is a bit smaller but more people have used FreeRTOS on avr.

Here are the websites:

ChibiOS free embedded RTOS - ChibiOS Homepage also see ChibiOS free embedded RTOS - This topic does not exist yet

http://www.freertos.org/ also see RTOS Tutorial - Using an RTOS on small embedded computers

OK

Thank you both chrismoos and fat16lib for your info. I hope the OSs will be maintained and ready when I need them. The Arm Arduino is interesting. Everybody ask if we/I use an Arm cpu.

Edit: Always something to add. One reason I have chosen AVR and not ARM is Arduinos easy libraries. They save time when a new cpu is used.

Leif