Go Down

Topic: avr-os: multitasking library (Read 3367 times) previous topic - next topic

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: http://www.chrismoos.com/2012/12/05/avr-os-multitasking-on-arduino

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 : ArduixPL http://www.mgth.fr


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.

LMI


Hey all,

I wrote a little introduction to how it works here: http://www.chrismoos.com/2012/12/05/avr-os-multitasking-on-arduino

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.


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:

https://github.com/chrismoos/avr-os/blob/master/os_internal.h

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).

fat16lib

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:

http://www.chibios.org/dokuwiki/doku.php also see http://www.chibios.org/dokuwiki/doku.php?id=chibios:documents:introduction

http://www.freertos.org/  also see http://www.freertos.org/tutorial/index.html

LMI

#6
Dec 10, 2012, 08:22 pm Last Edit: Dec 10, 2012, 08:24 pm by LMI Reason: 1
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

Go Up