Moderator

Multipilot32 needs a Real Time OS. Which one?

3689389185?profile=original

Dear Friends,

after some time of evaluation of software architecture for Multipilot32 I decide to put on it a Real Time Operating Systems.

Instead of choose FreeRtos or other clone . I found this interesting operating system that yet support HAL .

Above there's an introduction of Chibi OS , what do you think about ? My idea is to rewrite the lib of our Arducopter project using a professional approach with a Realtime Kernel on low level OS call.

A video of Chibios User that develop his quadcopter ... :)

I'm waiting your feedback :)

This is official Discussion Thread : http://www.virtualrobotix.com/forum/topics/multipilot32-need-a-rt-os-what

Chibios Introduction :

This document will help you understand what ChibiOS/RT has to offer in a world with so many similar products.

Why another RTOS:

The first question to be answered is: there was really the need for yet another RTOS? There are several reasons:

  • The ChibiOS/RT ancestor has been created more than 15 years ago and while it had far less features than the current product it was complete and functioning. ChibiOS/RT is just a new (and silly) name given to something created when there were not many free RTOSs around (actually none, at least none in my knowledge, there was no widespread Internet at that time).
  • When, after a while, I needed a RTOS again, none of the existing FOSS projects met my expectations or my ideas of how a RTOS should be. I decided that work on that old project was a better idea than contribute to, or fork, something else.
  • I wanted another toy.

How is different ?

Well, there are some design choices that should be explained and contribute to make ChibiOS/RT a peculiar design. Nothing really new in itself but the whole is interesting.

Not Just a scheduler.

While the ChibiOS/RT kernel can be used even alone, see the General Architecture document, the RTOS also offers other subsystems:

  • Support for startup and board initialization.
  • An HAL abstracting many common device drivers, see the Features Matrix.
  • Integration with other open source projects like File Systems, Networking Stacks etc.

ChibiOS/RT is meant to be a whole operating system not just a scheduler.

Static Design.

Everything in the kernel is static, nowhere memory is allocated or freed, there are three allocator subsystems but those are optional and not part of core OS, dynamic services are built as a layer on top of the fully static kernel.
Safety is something you design in, not something you can add later, using memory allocation in the kernel is unnecessary and relying on that is just asking for trouble.

No Internals structure and tables.

The kernel has no internal tables, there is nothing that must be configured at compile time or that can overflow at run time, no upper bounds, the internal structures are all dynamic even if all the objects are statically allocated.

No error Condition.

System APIs have no error conditions, all the previous points are finalized to this objective. Everything you can invoke in the kernel is designed to not fail unless you pass garbage as parameters, stray pointers for examples. The APIs are not slowed down by parameter checks, parameter checks (and consistency checks) do exist but only when the related debug switches are activated.
All the static core APIs always succeed if correct parameters are passed. Exception to this rule are the optional dynamic APIs that, of course, can report memory exhausted.

Very Simple API.

Each API function should have the parameters you would expect for that function and do just one thing with no options.

Fast and Compact.

Note, first “fast” then “compact”, the focus is on speed and execution efficiency and then on code size. This does not mean that the OS is large, the kernel size with all the subsystems activated weighs around 5.5KiB (STM32, Cortex-M3), see the section ”Performance and Testing Data” for more details about performance and footprint.
It would be possible to make something even smaller but:

  1. It would be pointless, it is already really small.
  2. I would not trade efficiency or features in order to save few bytes.

Test and Metric.

I think it is nice to know how an OS is tested and how it performs before committing to use it. Test results on all the supported platforms and performance metrics are included in each ChibiOS/RT release. The test code is released as well, all the included demos are capable of executing the test suite and the OS benchmarks. See the section ”Performance and Testing Data” for more details about performance and footprint.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Moderator

    Dear Friends,

    today i add advanced docs for developing Library on MP32 Board. This docs are about micro STM32 and Hardware interface. Schematics and pin connections.

    So I'm working on some tutorial about the first program using VROS and a tutorial for developing your fist C++ library.

    This is the link : http://www.virtualrobotix.com/forum/topics/multipilot32-advanced-sdk

    Regards

    Roberto Navoni

  • I'd like to point out that the communication architecture of ROS is unsuitable for directly interfacing a microcontroller board via serial, which will be likely the link of choice (ethernet maybe as well, but you don't want for sure to go down the road implementing a full-scale ROS protocol on a micro).

    Since this is a common challenge to interface a UNIX multi-process system to an autopilot, we have developed the MAVLink protocol to address this issue, which ArduPilotMega is already using:

    http://pixhawk.ethz.ch/wiki/software/mavlink/start

     

    Now there is a lightweight middleware (with a much smaller footprint than ROS for small-scale platforms such as the Gumstix Overo):

    https://github.com/pixhawk/mavconn

     

    But you can also interface ROS to it:

    https://github.com/pixhawk/mavlink-ros-pkg

     

    I just wanted to point out that a fully scalable architecture is already out there to connect ArduPilotMega with Unix processes and/or ROS.

  • Moderator

    ----------------------------------------------------------------------------
    --- Test Case 11.13 (Benchmark, RAM footprint)
    --- System: 360 bytes
    --- Thread: 68 bytes
    --- Timer : 20 bytes
    --- Semaph: 12 bytes
    --- EventS: 4 bytes
    --- EventL: 12 bytes
    --- Mutex : 16 bytes
    --- CondV.: 8 bytes
    --- Queue : 32 bytes
    --- MailB.: 40 bytes
    --- Result: SUCCESS
    ----------------------------------------------------------------------------

    Final result: SUCCESS
  • Moderator

    ----------------------------------------------------------------------------
    --- Test Case 11.5 (Benchmark, threads, full cycle)
    --- Score : 159688 threads/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.6 (Benchmark, threads, create only)
    --- Score : 235607 threads/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
    --- Score : 66657 reschedules/S, 399942 ctxswc/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.8 (Benchmark, round robin context switching)
    --- Score : 502496 ctxswc/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.9 (Benchmark, I/O Queues throughput)
    --- Score : 544424 bytes/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.10 (Benchmark, virtual timers set/reset)
    --- Score : 744704 timers/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.11 (Benchmark, semaphores wait/signal)
    --- Score : 887188 wait+signal/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.12 (Benchmark, mutexes lock/unlock)
    --- Score : 653320 lock+unlock/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.13 (Benchmark, RAM footprint)
    --- System: 360 bytes
    --- Thread: 68 bytes
    --- Timer : 20 bytes
    --- Semaph: 12 bytes
    --- EventS: 4 bytes
    --- EventL: 12 bytes
    --- Mutex : 16 bytes
    --- CondV.: 8 bytes
    --- Queue : 32
  • Moderator
    ---------------------------------------------------------------------------
    --- Test Case 7.1 (Heap, allocation and fragmentation test)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 8.1 (Memory Pools, queue/dequeue)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 9.1 (Dynamic APIs, threads creation from heap)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 9.2 (Dynamic APIs, threads creation from memory pool)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 9.3 (Dynamic APIs, registry and references)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 10.1 (Queues, input queues)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 10.2 (Queues, output queues)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.1 (Benchmark, messages #1)
    --- Score : 266140 msgs/S, 532280 ctxswc/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.2 (Benchmark, messages #2)
    --- Score : 215141 msgs/S, 430282 ctxswc/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.3 (Benchmark, messages #3)
    --- Score : 215141 msgs/S, 430282 ctxswc/S
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 11.4 (Benchmark, context switch)
    --- Score : 933224 ctxswc/S
    --- Result: SUCCESS
    ---------------------------------
  • Moderator

    ----------------------------------------------------------------------------
    --- Test Case 3.2 (Mutexes, priority inheritance, simple case)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.3 (Mutexes, priority inheritance, complex case)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.4 (Mutexes, priority return)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.5 (Mutexes, status)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.6 (CondVar, signal test)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.7 (CondVar, broadcast test)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.8 (CondVar, boost test)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 4.1 (Messages, loop)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 5.1 (Mailboxes, queuing and timeouts)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 6.1 (Events, registration and dispatch)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 6.2 (Events, wait and broadcast)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 6.3 (Events, timeouts)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test C
  • Moderator

    First Test of ChibiOS on Multipilot32 .. Its Work FINE !!!! , I'm implemented the Multipilot32 as supported board for that ChiboOS :)

    þHELLO WORLD!!

    *** ChibiOS/RT test suite
    ***
    *** Kernel:       2.2.0
    *** GCC Version:  4.4.1
    *** Architecture: ARMv7-M
    *** Core Variant: Cortex-M3
    *** Platform:     STM32 Performance Line High Density
    *** Test Board:   Multipilot32

    ----------------------------------------------------------------------------
    --- Test Case 1.1 (Threads, enqueuing test #1)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 1.2 (Threads, enqueuing test #2)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 1.3 (Threads, priority change)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 1.4 (Threads, delays)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 2.1 (Semaphores, enqueuing)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 2.2 (Semaphores, timeout)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 2.3 (Semaphores, atomic signal-wait)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 2.4 (Binary Semaphores, functionality)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.1 (Mutexes, priority enqueuing test)
    --- Result: SUCCESS
    ----------------------------------------------------------------------------
    --- Test Case 3.2 (Mutexes, priority inheritance, simple case)

  • Moderator

    Some People ask me why i think that we need a Realtime OS in our project. I try to fix some idea in this thread. What do you think ? VROS 0.1 is Alive .. on Multipilot32 :)

    http://www.virtualrobotix.com/forum/topics/vros-01-white-paper?xg_s...

    Regards

    Roberto

     

  • Moderator

    Hi Sandro,

    actualy ChibiOS don't support MultiCore , but i think that his creator can work on it. I forget to tell you that ChibiOS is MADE IN ITALY as ST Micro controller :)

  • Developer

    Hey Roberto,

    I think an OS and it's hardware abstraction should help you to take advantage of ARM multicore too.

    But ChibiOS, currently, only supports single core MCUs, due it have no multicore kernel. :(

This reply was deleted.