ArdOS: The Arduino Operating System. Now for the Arduino IDE!

Hi all,

A while back I released the original version of ArdOS that was really meant to be compiled using Atmel Studio 6. Today I am proud to introduce the latest version of ArdOS that was re-written for use within the Arduino IDE. :smiley:

ArdOS is now available at ctank / ArdOS IDE / wiki / Home — Bitbucket. You can download the ZIP file (includes quick start guide and reference guide) directly from ctank / ArdOS IDE / Downloads — Bitbucket.

The following changes were made:

  • 100% support for Arduino libraries. All the features that you love like Serial, attachInterrupt, etc are now accessible in ArdOS.
  • You can now bring ArdOS into the Arduino IDE through Sketch->Import Library->Add Library (on Arduino 1.0.5 onwards) or by unzipping the ZIP file into the libraries directory.
  • Examples accessible through File->Examples->ArdOS.
  • Much better documentation.
  • Greatly simplified configuration. By default all components of ArdOS will be compiled in, but you can edit the kernel.h file to exclude components.
  • Simplified task creation. Task stacks are automatically created for you.
  • Stack sizes for each task can now be set at run-time.
  • The number of tasks can now also be set at run-time, albeit only when ArdOS is initialized. However this means no more fiddling with the ArdOS header files to set the number of tasks.
  • Now supports boards based on the ATmega168, ATmega328, ATmega1280 and ATmega2560.
  • Now supports analog output on all PWM pins.

ArdOS features:

  • A compact and configurable kernel.
  • Prioritized scheduling for hard real-time tasks.
  • Binary and counting semaphores.
  • Mutex locks and conditional variables.
  • First-in-first out and prioritized message queues.

Do take ArdOS out for a spin and let me know your thoughts!

Best regards,
Colin.

Sounds pretty cool, you think I can monitor one analog pin with this while I report in low priority some values thru ethernet? Right now I have to stop the monitoring for few seconds every couple minutes (asking before testing anything, I tried some different similar approaches in the past, but ethernet never worked properly)

eried:
Sounds pretty cool, you think I can monitor one analog pin with this while I report in low priority some values thru ethernet? Right now I have to stop the monitoring for few seconds every couple minutes (asking before testing anything, I tried some different similar approaches in the past, but ethernet never worked properly)

Hi Eried,

Sorry for this late reply. For the moment I don't have Ethernet support, but that's definitely something good to add in once I get an Ethernet shield.

Thanks again for your input!
Colin.

Hi,
I downloaded and tried example.It works properly, I try to figure out codes (what is going on).Then I will try drive multiple (2 or more) servos simultaneosly.
Thanks for sharing

Thanks cegav4r! Please do let me know how it turns out.

@ctank - this is excellent and well-timed for me. At the moment, I am playing around (since last night) with NilRTOS (from author of ChibiOS/RT ported by Bill), and after downloading ArdOS and going thru it's quick-start and reference manual, I can see how easy it looks.

Do you have any figures on flash and RAM use of code using ArdOS using various features/combinations ?
Secondly, do you have any plans of supporting ArdOS on some of the ATtiny AVRs like tiny84/85/86x ? They do have some limitations (usually fewer peripherals, pins etc.) but still excellent for ultra low-cost projects.

hello,
in the future do you support ' ATMEGA32U4 ' ?
cordially

Hi everybody. Thanks for your help and work. Greatly appreciated.

ArdOS mutlitasking is the way to do things but I guess there are limitations or there is something wrong with my code.

Still, I have tried a direct (loop) program and then convert it to a Task. So the logic is first tested, as much as possible, as a single serial program.

The problem is a single task routine that uses the standard OneWire and Dallas library.

void setup()
{
.
.
sensors.begin();
.
.
.
.
}

void temperature( void *p)
{
Serial.println("Start");

    while (true)
  {
    Serial.println("prereq");
       sensors.requestTemperatures();
       Serial.println("req");
    Serial.println(sensors.getTempCByIndex(0));
    OSSleep(300); 
  }
}

As stated, when run in the loop() routine temperature is perfectly printed.

As a task, "prereq" and "req" are printed but not the temperature. The led in the 3p with a DS18B20 turns on when in loop() mode but not as a task. Also using the long OneWire method confirms the DS18B20

Anything i can do/try? Thanks.

Regards.

@ctank:
I've tried to... try the RTOS but I wasn't able to compile any of the test sketches.
I always get this error:

/home/leo/sketchbook/libraries/ArdOS/kernel.cpp: In function 'void OSSwap()':
/home/leo/sketchbook/libraries/ArdOS/kernel.cpp:363:20: error: local frame unavailable (naked function?)
/home/leo/sketchbook/libraries/ArdOS/kernel.cpp:363: confused by earlier errors, bailing out

I'm using Arduino IDE 1.0.5 with Atmel toolchain 3.4.2 (not the original one that comes with Arduino). I compile on Linux.

EDIT:
if I use the toolchain provided by the IDE, it compiles correctly. So there's something in your kernel code that isn't compatible with the newer toolchains. You should look at this because, as you should know, the IDE toolchain is too old and has a bug for that it cannot compile working firmwares bigger than 128 kB.

It seems that it doesn't want the inline function OSMakeAtomic.
But if I substitute all the calls to OSMakeAtomic with its code, the IDE compiles the examples but simply they don't work at all.... I am able to get a working example only if I use the old toolchain that comes with the Arduino IDE.
May during the time something in the naked ISR management has changed...

Sorry all for this horribly late reply! I've been monitoring the ardos-help account for questions but only recently looked at this forum. It's 1 am now but I will reply to all of you tomorrow.

Sorry again for his late response!

Colin.

Thanks for letting me know that ArdOS does not compile on the newer toolchains. It's probably because several of the functions are declared to be naked (to guarantee stack correctness). I'll need to look into this.

As for Serial shenanigans, try inserting a delay between calls to Serial.println. I'm having some issues with getting the ArdOS to play nice with Serial. ArdOS seems to sometimes cause the serial buffers to overrun. At the moment short of moderating traffic to the Serial libraries, I don't yet have a way to solve this problem.

Colin.

Hi Collin,

Do you have any solution for the naked function problem using the last arduino IDE version?
I want to use it in an arduino course I'm learning but I need to work with the last available IDE.

Thanks in advance.

Claudio

shmusher:
Hi Collin,

Do you have any solution for the naked function problem using the last arduino IDE version?
I want to use it in an arduino course I'm learning but I need to work with the last available IDE.

Thanks in advance.

Claudio

Hi, shmusher,

Had the same error with naked-functions. Try making the variable sreg global (comment/delete all definitions "unsigned char sreg;" inside all the functions in kernel.cpp file and make one at the very beginning). That works for me (Ubuntu 14.04 & Arduino 1:1.0.5+dfsg2-2).

Dear Mrs Dos,

I tried your idea. It allows program to be complied, but program is not running after burning into arduino board. I'm using windows 7, arduino IDE and arduinoMEGA2560 board. Can u please help me with this ?

Thank you.

Pratik Parmar.

Hi,

I am interested in distributed computing and distributed storage,
so that the computation can be offloaded on another processor and
data can be stored on a remote file system.

Can this be implemented as part of the ArdOS?

MrsDos:
Hi, shmusher,

Had the same error with naked-functions. Try making the variable sreg global (comment/delete all definitions "unsigned char sreg;" inside all the functions in kernel.cpp file and make one at the very beginning). That works for me (Ubuntu 14.04 & Arduino 1:1.0.5+dfsg2-2).

thank you soooo much.................. :slight_smile:
it worked for me too. you made my day.