[TUT][SOFT] RTOS for AVR

Go To Last Post
65 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Last Edited: Sun. Jun 26, 2016 - 12:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Somewhat related are Adam Dunkels ProtoThreads at http://www.sics.se/~adam/pt/ . From the website:

Quote:
Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems, such as small embedded systems or wireless sensor network nodes. Protothreads provide linear code execution for event-driven systems implemented in C.

"Ziggy really sang, screwed up eyes and screwed down hairdo. Like some cat from Japan, he could lick 'em by smiling. He could leave 'em to hang. He came on so loaded man, well [..] and snow white tan. [Bowie]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Femto OS is another RTOS for AVR architecture.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure if I can post a question here, but why would someone want an operating system for an AVR, a microcontroller? Could someone here who uses such please explain, as I'd never considered such a thing but would like to understand the motivation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

why would someone want an operating system for an AVR, a microcontroller?

Here we go again.. Just do a search here at AVRfreaks on RTOS and similar and you will find more pro's and con's than you actually care about.

Oh, well... I am not necessarily ruling in OSes in all cases for AVRs (I'm not that stupid). But I can easily think of situations where it would help.

What if you want to run several parallell processes where some need to be higher prioritized than others? What if you want to want TCP/IP connectivity? What if you want to access an IDE hard disk with a FAT file-system? Sure you can say that you can write code for those without having an operating system, but then we'd just be playing with words.

Once upon a time I used machines with 64KB of RAM (for both program and data, Von Neumann architechture) that ran operating systems that where more complicated than several of the "small footprint" RTOSes for AVRs that are out there. The biggest AVR has 256 KB of (program) FLASH and 8KB of (data) RAM...

"Ziggy really sang, screwed up eyes and screwed down hairdo. Like some cat from Japan, he could lick 'em by smiling. He could leave 'em to hang. He came on so loaded man, well [..] and snow white tan. [Bowie]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I often think there's a limit (somewhere between 32K and 64K but not exactly sure where) at which program complexity probably becomes so great that there's a call for multi-tasking but it could be as simple as non-premeptive, perhaps even just protothreads.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That is the conditions to the OS be inclided to this list?

I know about two another free OSes
scmRTOS (is a C++ cooperative OS with Mit license) http://scmrtos.sourceforge.net/
and iRTOS (is a C preemptive OS with LGPL license ) http://irtos.sourceforge.net/

I am writing RTOS may be someone will look at it ;-)
http://sourceforge.net/projects/...
http://irtos.sourceforge.net/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, it's not correct. scmRTOS is preempteve OS.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I've found another one.
http://www.embedded.com/shared/-printableArticle.jhtml?articleID=190302110

They call it SST (Super Simple Tasker) and it's about as simple as protothreads. They also call it preemptive but I think it's "only" cooperative. It's about 500 bytes in size (on a x86) and completely written in C.
It is not specifically written for AVR, but I believe it's easy to port.

Have Fun, Paul.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is actually a port for that in the projects section! But you are correct it is not on the list.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

uCOS-II is another for AVR Architecture

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Folks, can you give URLs when you mention a missing OS that isn't in the list above then I'll edit the link into the first post. Ta.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please correct the definition of the scmRTOS. It is preemptive, not cooperative.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the list - are you able to put the licence after each one - the last two are ideal:

Quote:

scmRTOS: a C++ cooperative OS with Mit license

iRTOS: a C preemptive OS with LGPL license

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for that list. But can anyone tell me, which one RTOS for AVR that use BASIC programing language? please help me

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try this:

RTOS for Bascom

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Try this:

RTOS for Bascom

Thanks for your reply Clawson but i already know that script, its not a real RTOS, its just split the procedure into stacks and make priority for task in order every millisecond.
That i want to know is how to make more than one procedures to work simultaneously.
But really i appreciated for your help, thanks,
Do you have any ideas,links,etc?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Do you have any ideas,links,etc?

Yes switch to C then pick one of the 20+ listed above ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is supposed to be tutorial, but all I can see is a list of links. There should be some tutorial in this forum, which explains what RTOS is, what is thread, preempting, etc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To my mind there's no better tutorial about a specific RTOS than the explanation of how the AVR implementation of FreeRTOS works:

http://www.freertos.org/implemen...

The concepts explained there apply pretty much the same whatever RTOS you actually chose to use though there specific implementation may differ slightly.

Last Edited: Thu. Nov 26, 2009 - 09:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you. Looks good.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is our port for FreeRTOS to the ATMega168, 328, 644, 1280 and 1284:

http://robotgroup.com.ar/noticias/20091102/duinos-sistema-operativo-multitarea-para-arduino

It was made to be integrated with the Arduino IDE, but could be used alone or with other IDEs (we often use Code::Blocks internally).

Regards,
Julián

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:

http://www.embedded.com/shared/-printableArticle.jhtml?articleID=190302110

They call it SST (Super Simple Tasker) and it's about as simple as protothreads. They also call it preemptive but I think it's "only" cooperative.

SST is a fully preemptive, prioritized RTOS. I have spent a good deal of time over the decades on embedded software and different RTOS's, both commercial and had-rolled. My current favorite is SST. Very light weight, easy to prove correct. Conceptually simple.

So many of the commercial products seem to have a less than required quality, with defects in systems due to the RTOS - why did I buy one if I have to troubleshoot it? I have grown to believe
smaller + simpler = better. SST fits the bill.

DavePed

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've very surprised that no one mentioned NUTOS
http://www.ethernut.de/en/firmwa...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ChibiOS from Giovanni de Sirio.

http://chibios.sourceforge.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, the link to download DuinOS (the port of FreeRTOS to Arduino) had changed to this:

http://robotgroup.com.ar/duinos/...

There you will find (in the downloads section) the v0.1 and the v0.2 versions.

Regards,
Julián
http://robotgroup.com.ar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is Abassi also. It's preemptive and super small (like <800 bytes small)...

http://www.code-time.com/avr.html
http://www.code-time.com/portdocs.html

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
iRTOS: a C preemptive OS with LGPL license

This is not related to AVR

Quote:
This project is supporting LPC2000, LPC17xx series MCU made by NXP.

Alex

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

This is not related to AVR

Thanks - removed from list now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Add Pumpkin's Salvo to the list, it's a cooperative RTOS, both the Tiny version and Lite versions are free and fairly easy to use, a good manual can be downloaded as well. I added a project to show how to set up the tiny version on a Mega16 with lots of flash available.
-jim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone know the status of AvrX?
This link is not helpful anymore:
AvrX: Real-Time Kernel for AVR processors

Not surprisingly Google will also send you into 404 pages, sometimes via another page.

Einar Sjaavik

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

duinoOS link in first post is also death
its better link on GIT or WIKIpedia (there is also death link but on Wikipedia is also link on 0.2 which is maintaned with other person)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The duinOS link doesn't work, it seems it has been relocate to http://code.google.com/p/duinos/

Alex

[first post edited]

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just checked the complete list, there are three more that need to change:

AVRx site is also down (there is only info that it is not maintained any longer, no OS there) so the best alternative seems to be sourceforge http://avrx.sourceforge.net/

Adam Dunkel's Protothreads site exists but the link has changed to http://dunkels.com/adam/pt/

Contiki link seems to not work any longer but a search lead to http://www.contiki-os.org/

Alex

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TinyRealTime by Dan Henriksson and Anton Cervin (Lund University)
Characteristics:
1. Originally created for mega8.
2. Preemptive kernel.
3. Earliest Deadline First (EDF) scheduler.
4. Each task has a stack.
5. About 1200 bytes of flash.

It was extended by Dr. Bruce Land to mega644 and mega1284; cross-links between the 2 URLs.
A preemptive kernel for Atmel Mega1284 microcontrollers by Bruce Land (Cornell University, ECE4760; October 18, 2013)
A video of a presentation of it in ECE4760:
#19 -- Premptive Kernel and Lab 4 (Bruce Land, YouTube)

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a very useful list for some one like me looking to get started with AVRs however looks like some these are not existing any more. Guess this need a clean up?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

This is a very useful list for some one like me looking to get started with AVRs

Perhaps. Most beginners don't need, or will not be helped, by an RTOS. Same for many AVR apps.

"Ziggy really sang, screwed up eyes and screwed down hairdo. Like some cat from Japan, he could lick 'em by smiling. He could leave 'em to hang. He came on so loaded man, well [..] and snow white tan. [Bowie]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Guess this need a clean up?

You tell me which links are dead and I'll edit my post.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i just looked at the first few links...out of which the 2,3 arent related anymore.

Last Edited: Fri. Sep 19, 2014 - 05:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are probably 25-50 scheduler/OSes for AVR.

I have a collection.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Usefull list , cheers to Clawson...which one do you reckon is the easiest to implement with mega128 ? In your experience,

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

None - the mega128 has only 4k of ram - a rtos can chew that up pretty quickly. Why would you need a rtos on a mega128 is the question.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Kartman how about http://www.femtoos.org/doxy/code... ....femtoOS ?

There's no specific reason....only experiment since I have some task to be done ....it can be done with state machine we talked about last time but...I want to try something else...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:
.it can be done with state machine we talked about last time but...I want to try something else...
Quantum Platform (QP) is one way, of several, to implement state machines and is an alternative to an RTOS via an event framework.

The complete QP (QP/C) has gone legacy for AVR approximate to 2015-Nov; current are ARM and MSP430.

The subset QP (QP-nano) is still active for AVR and Arduino; might try it on an Arduino MEGA.


http://www.state-machine.com/doc/QP-QM_Overview_Slides.pdf

http://www.state-machine.com/doc/QP-QM_Overview_Notes.pdf

http://www.state-machine.com/downloads/index.html#QDK {Legacy QP Development Kits (QDKs)}

http://state-machine.com/arduino/index.html

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The obvious one for me is FreeRTOS but,  like Kartman, I only really see RTOS on AVR as an interesting intellectual experiment. In the real world almost anything you do on an 8bit micro does not warrant use of an OS. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

..like Kartman, I only really see RTOS on AVR as an interesting intellectual experiment. In the real world almost anything you do on an 8bit micro does not warrant use of an OS. 

Why?

Last Edited: Fri. Jun 24, 2016 - 09:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See #43. For each task you need a stack and task control block (TCB). Since many AVRs don't have much ram, you'd really want to be sure you needed a RTOS. For this class of processor, most apps simply don't need a RTOS. Due to the pricing at the moment, you could use an ARM part with much more ram and performance and not be so concerned with the overhead of an RTOS. Whether or not that would be a wise design decision depends on many factors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank Kartman, 
i'm aware about the overhead due of an RTOS, i'm less aware about ram consuming.
So, in the case that an application doesn't use too much tasks, an RTOS fit well on a 8 bit device, or there are some other negative effect on using it?
In my opinion, there are some class of applications that needs the benefits due to an RTOS becasue it simplify and improve a lot the quality of the design of those applications.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's quite a range of AVRs from 1K (even a couple of 0.5K) up to 384K. The majority in use are probably 2K..16K. In those "controller apps" the design is often a main loop and perhaps 2..10 interrupt handlers and that's all that's really required to achieve the design. In such chips/designs the use of RTOS (well certainly a preemptive one) is just huge over-kill. Sure if you are programming 64K+ (perhaps even 32K) then the interaction of the processes may get to such a position of complexity that an RTOS will help to coordinate things but for "normal" apps typically found in small 8 bit controllers it saps both available RAM resource and available CPU resource for very little (if any) gain. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Consider what you might use an AVR for. My commercial applications involved MODBUS communications using RS485, usually driving relays and/or indicators, sensing switch and analog inputs and doing some basic calculations like average and alarm set points. In some cases there was a simple user interface with a 16x2 lcd and three pushbuttons. The main real-time requirement was MODBUS in that I had to service the usart in time, everything else was not time critical. Relays and indicators don't work much faster than 100ms and likewise with the user interface. All this ran a one thread of execution with a timer and a usart interrupt. In this instance, a RTOS would offer no benefit in either execution time or code 'cleanliness'. Frequently in this low end embedded systems, computer science doctrines go out the window - tricks are used to minimise the code size, improve execution time and to minimise the stack profile. You've also asked about C++ and STL - it is unlikely you'd use the more advanced data structures in an AVR - there's usually not enough ram to use and/or justify them. Consider the overhead of a red/black tree - from memory, there at least 4 pointers per node, so that is 8 bytes on top of the data you search on. In 4K of ram, you're not going to have a very big structure. If you need to search, the size constraint would mean a brute-force search is viable. Also consider that the app is designed to do a specific job - it's configuration is pretty well fixed at compile time. You wouldn't be creating/deleting objects on the fly, notwithstanding the problems with memory allocation. 

So, given a mega328 with 32k flash and 4k ram,what application would justify the use of a RTOS?

Pages

Topic locked