[TUT][SOFT] RTOS for AVR

Go To Last Post
65 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Last Edited: Sun. Jul 31, 2016 - 02: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.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

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

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

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

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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?

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

clawson wrote:

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. 

clawson, in my opinion, your point of view is centered on the correct usage of an 8bit microcontroller for doing something. 
Has sense to me, that the normal apps doesn't really needs an real RTOS, but i'm referring on the design of such apps. 
Think about IoT, in this case there are some class of applications that need different level of hardware complexity.
It's difficult to do this kind of project using an approach that doesn't use a RTOS or similar system that offer an abstraction layer between the hardware and the logic of the specific app.
In this case i think that an RTOS simplifies a lot the design phase, although if it consume a lot of resources. The important thing is that the hardware meets the app requirements.

Obviously, nothing is necessary, and one reaches the same thing without using an RTOS, but i think that this way isn't simple for the app designer, if the objective of the app designer is centered on the modelling the software of such app.

 

Kartman wrote:

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?

Kartman, conceptually you are near at my project!
I'm aware on the limit that offer the 8bit microcontrollers, but I think it's fair to use all the functionalities that offer such kinds of microcontrollers.
If i have 4k of ram, why i can't use full ram for an given application? 
I have implemented a priority queue using the heap algorithm. I know that this data structure it's ram consuming, but the priority queue give me some functionalities, so is normal that i have to pay a price to obtain this kind of service, i'm aware about this.
Maybe there aren't application that really justify the use of a RTOS on an 8bit microcontroller, i haven't a right experience to answer to this question.
My doubts are about the design of such applications, that in my opinion became easier if one use an RTOS or another similar system.

 

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

Think about IoT,

Yeah but this 8bit AVR8 we are talking about. You wouldn't pick one of those for an IoT application. Atmel recently announced and launched Cortex M7 devices as being a targeted IoT processor. When you have a few hundred MHz, a few hundred K of flash and 16/32/64K or more RAM then,  yes,  of course you will be using an RTOS. In fact if you move a bit further up the IoT scale you hit the Cortex A devices and there's probably about a 99 out of 100 chance you'll actually be using Linux (though it leaves something to be desired over the "R" in RTOS!). But for a small 8 bit MCU reading a few sensors and operating a few actuators it's still over-kill. 

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

Does an RTOS mean pre-emptible tasks?  That is, where one task can be suspended in favor of a higher priority task. 

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

luca80 wrote:

If i have 4k of ram, why i can't use full ram for an given application? 

 

Because when your customer asks you to add 'one small feature' you will find that you have run out of RAM.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

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

steve17 wrote:
Does an RTOS mean pre-emptible tasks?

Depends on who you ask.

My definition would include cooperative as well as preemptive.

David (aka frog_jr)

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

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

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

Just a reminder that this is a tutorial thread, it's not really for a general discussion of the merits of using an RTOS, just for posting feedback to the first post (like additions/corrections) so if this is to continue it should probably be somewhere else. 

 

Moderator. 

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

clawson wrote:

Think about IoT,

Yeah but this 8bit AVR8 we are talking about. You wouldn't pick one of those for an IoT application. Atmel recently announced and launched Cortex M7 devices as being a targeted IoT processor. When you have a few hundred MHz, a few hundred K of flash and 16/32/64K or more RAM then,  yes,  of course you will be using an RTOS. In fact if you move a bit further up the IoT scale you hit the Cortex A devices and there's probably about a 99 out of 100 chance you'll actually be using Linux (though it leaves something to be desired over the "R" in RTOS!). But for a small 8 bit MCU reading a few sensors and operating a few actuators it's still over-kill. 

 

I think that the serious problem that arise on the usage of a RTOS are the MHz. Some weeks ago i have tested my actor framework on the Arduino board. My dummy test it was to send continuosly a message to an actor (proactivity). Every time that the actor is run (the message is arrived) i toggled a pin, so using a poor man oscilloscope (an usb soundcard) i have measured a frequency in the order of 10e0 Khz.

After this test i tryed to print some string in Arduino framework. I repeated the test and i have measured a frequency in the order of 10e0 Hz @ 9600 buad, 10e1 Hz @ 115000 baud. From this, trivially I realized that the frequency play an important role in the use this kind of framework. I think that the ram is an secondary problem, and it depend strongly on how good is the design of the framework.

I'm in part disagree with you when you say 

for a small 8 bit MCU reading a few sensors and operating a few actuators it's still over-kill.

I agree on the fact that for small 8bit MCU, i think you refer at the attiny series, an RTOS is over-kill, but on an atmega128/2560 that run near the their max frequency an RTOS isn't over-kill if you accept that i say before, that with an good design, the consume of the ram isn't a really problem. Obviously, one should be aware about the hardware, I doesn't believe that a RTOS is a magic component that resolve any thing.

However at this moment i not care about the hardware. I'm trying to apply the MBD methodology for develop a project, so i don't know and i don't care about what kind of hardware i need to satisfy my requirements. At this moment my role is like an architect, i need to design a good framework infrastructure, after that i can choose my hardware.

 

Brian Fairchild wrote:

Because when your customer asks you to add 'one small feature' you will find that you have run out of RAM.

 

This is a good tip, thank a lot! 

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

I said the switch point is probably somewhere between 32K and 64K of code so we're in total agreement aren't we? But in this day and age if folks are looking at 64K+ flash then surely they are going to pick Cortex M or even Cortex A? I doubt many choose 64K+ AVR in volume production do they? This is 2016, not 1996!

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

Yes, we are in total agreement but only on the switching point! :) 

It's true that this is 2016 and a fortiori think that the use of an RTOS is not prohibitive for a 8-bit microcontroller like an atmega2560 for do some task like acquiring a sensor signal or control an actuator.

Here we are speaks about RTOS on the 8bit microcontroller so for curiosity i have ask a question about the RTOS.

I'm well aware that we are in 2016. It is not the case I'm trying to use the MBD approach for my project. Following the MBD, the hardware is just an implementation detail! ;)

 

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

However, the your range is very similar with range cited in this article: http://www.ti.com/lit/wp/spry238/spry238.pdf and obviosly, the author of this article think like you.

What I meant it is mainly reported in paragraph 3 of Article. In this sense, the choice on the use of an RTOS for an 8-bit microcontroller is motivated by the fact that a good software architecture inevitably requires the use of an abstraction layer between the hardware and the software. For me it makes sense to accept a decrease in performance (an RTOS on a microcontroller 8bit) if it takes me a serious advantage for my software architecture.
Simple processes that require the use of time and a certain formalism (eg PID or other control systems), can be executed on a microcontroller 8bit (eg ATmega128 / 256), in these cases the use of an RTOS is not essential but much easier life is at the project level and is at the implementation level. This is what I would say based on my limited experience in embedded systems.

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

Luca, we would like to think that all embedded projects are like pink fluffy unicorns dancing on rainbows, but the reality isn't quite as cosy. When you need the performance, then niceties like abstraction go out the window. Many times, poor decisions (on reflection) have been made and you're committed, so you just have to make it work. Or there's an existing product you need to add features to. The list goes on. I had to give a motivational speech to a programmer than was seconded to the team recently to remind him that what they teach at school doesn't necessarily reflect the commercial world. Do we want pretty code that doesn't work, or code that works?

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

Kartman, I understand your motivations and those of clawson only that I agree in part with you. Let me give an example:

I have a Esc, and I have to design an application to make it work. At the moment, I do not know the hardware on which this application should run. 

It can be an ATtiny, an atmega or.. Well, how I can design this application?
Using oop, I can create two classes that help me to abstract the logic of the ESC and the logic of the hardware. Using the uml
 formalism, I should do something like this:

please ignore the number and the operator + in the association link, also ignore the Eint type, i'm new to papyrus and at this moment i don't know how hide this symbol and use the standard type.

 

This diagram show an important features that is the abstraction. In this case it is rappresented with the PwmIF interface. In this contex the PwmIF interface work like an HAL, an Hardware Abstraction Layers.

I use it to separate the logic of the ESC from the hardware. If my final hardware is an attiny, i need an another class (es AttinyPwm) that extend the PwmIF, same thing if my hardware is a corterx arm or an atmega microcontroller.

So, in this case if you adopt this design, for this simple application, you need 3 class (the Esc class, the PwmIf and the AttinyPwm for ex) and the main obviosly.

Question, are all this class necessary for make this simple application? Maybe not, but this design meets all requirements of this application and, more important, in this way the software is very portable because you have designed it without know nothing about the hardware. But how about the performance? There is a overhead due this design. This is true, but i'm aware of this overhead and i accept it because it is a price that i pay to meets the requirements.

This is that i mean when i express my opinion on the use of a RTOS on an 8bit microcontroller. I prefer to pay something in term of performance at the expense of a good design.

I don't know if this is a good o bad, maybe someone have some cripticism about it, but it work and the code is pretty to read and mantain.

Obviosly there are some application in which this kind of design doesn't work due the overhead, so you can analyse the application before to suggest any desgin, due to my little experience this is my forma mentis.

In the real wold, there are some other factors (like time to develop, the whims of the customer etc) that actually may negatively affect the choice of a type of design, and should be taken into account.

I'm not have considered this aspect, but maybe i should! :)

 

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

clawson wrote:

Just a reminder that this is a tutorial thread, it's not really for a general discussion of the merits of using an RTOS, just for posting feedback to the first post (like additions/corrections) so if this is to continue it should probably be somewhere else. 

 

Moderator. 

So locked. If anyone has suggestions / corrections for the list in the first post contact a Moderator who will unlock this for you.