Question

I have an AT90USB162 AVR chip which I want to run a multitasking RTOS, so I am evaluating possible RTOS for using with my AVR chip. Which multitasking RTOS's are supported by AVR? Maybe QNX? (Is it possible to run a QNX kernel on an AVR microchip?).

Thanks in advance.

Was it helpful?

Solution

The Atmel AT90USB162 is an 8-bit AVR RISC-based microcontroller -- QNX would be a stretch, and AVR is not in their BSP directory

Micrium supports AVR with uC/OS-II

FreeRTOS also supports AVR

OTHER TIPS

When you say "RTOS", I presume you mean pre-emptive multi-tasking? I'm guessing (since this is an 8-bit AVR) you don't need a filesystem, network stack, etc.?

If you're looking for a tiny, pre-emptive multi-tasking kernel, you might want to check out the Quantum Platform - I've used it on very resource-constrained platforms like AVR & MSP430. Co-workers have used it on 8-bit 8051 and HC11 variants as well.

The QP's preemptive kernel (QK) is a run-to-completion kernel, which reduces its stack (RAM) requirements and makes context switching less resource-intensive (no TCBs, less context to save & restore).

There is a QP/C variant, which is "small", and a QP-nano variant, which is "tiny". Since those terms are absolutely meaningless without numbers, the QP-nano page has a comparison of kernel types & their typical sizes. For example (minimum figures provided): typical RTOS, 10K ROM, 10K RAM; QP/C - 8K ROM, 1K RAM; QP-nano - 2K ROM, 100 bytes of RAM.

The good thing is that all the code is available so you can download & try it & see for yourself.

QNX - not a chance! QNX is a relatively large and sophisticated OS for 32bit devices with MMU, providing not only kernel level scheduling but also file systems, fault-tolerant networking, POSIX API, GUI etc. Its most significant feature is its support for memory protection - each thread runs in its own virtual memory segment, so only runs on devices with appropriate hardware support.

What features do you want from your OS? On an 8 bit device it is only reasonable to expect basic priority based pre-emptive scheduling and IPC. Other services such as networking, filesystem, USB etc. are usually add-ons from the RTOS vendor or must be integrated yourself from third-party code.

The obvious choice if you want to spend no money is FreeRTOS. It is competent, though in some ways unconventional architecturally, even if fairly conventional at the API level. In my tests on ARM it had slower context switch times that other kernels I compared it with others I tested, but that may not be the case on AVR, and would only be an issue if you require real-time response times in order of a few microseconds. AVR has a rather large register set, so context switches are typically expensive in any case.

Atmel have a list of third-party support including RTOS at http://www.atmel.com/products/AVR/thirdparty.asp#. They list the following:

  • CMX Systems, Inc: CMX-RTX, CMX-Tiny+ (Add-ons: CMX-MicroNet, CMX-FFS)
  • FreeRTOS.org: FreeRTOS
  • Micriµm, Inc: µC/ OS-II
  • Nut/OS: RTOS and TCP/IP stack with a Posix-like API.
  • SEGGER: embOS

I have personal experience of CMX-Tiny+ (on dsPIC), embOS (on ARM), and FreeRTOS (on ARM), and uC/OS-II. They are all competent, uC-OS-II has the minor restriction of only allowing a single task at each priority level (no round-robin scheduling), but consequently probably faster context switches. In the case of embOS I have, successfully integrated third-party file-system and USB code, though the vendor has their own add-ons for these as well.

Though not a direct answer to your question, being 8 bit controller with limited resource, think of the advantage before committing to an OS Layer, the advantage of an OS layer will be beneficiary only when the project has to handle major subsystems that are tedious to code and maintain ex. file system, graphics, audio, networking, etc.

Since most of the suppliers provide integrated development environment and standard libraries and more over you can write code with high level languages like C, C++, for simple controls task sticking to your own frame work will be much more manageable

Athomthreads is a lightweight RTOS supported by AVR. It supports:

  • Preemptive scheduler with 255 priority levels
  • Round-robin at same priority level
  • Semaphore
  • Mutex
  • Message Queue
  • Timers

It is open source and has about 1k lines of code. By comparision, the demo project for AVR build with Eclipse produces a .bin file of 96 to 127 kb. Of course FreeRTOS has more features (like memory management, including dynamic memory) and better security. But if you only need multi-threading atomthreads is nice.

Here is a comprehensive comparison between multiple RTOSs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top