FunkOS Port to Coldfire V2

Recently I started working on selecting an RTOS for using in my projects. Given that there are many candidate solutions it was not straight forward to find an applicable RTOS.

I needed a free to use RTOS. I cannot afford to pay anything yet 🙂 If I had to pay I would go for uC/OS-III. I have the book for uC/OS-II and I consider the code, functionality and extensions pretty good.

So I started looking around. I tried FreeRTOS where I know more people are using it. I also looked at picoOS, uexec, FemptoOS, XMKrtos . Looking at these I liked picoOS and XMKrtos. Both seemed to be lacking further development.

picoOS was officially declared frozen, given that there was not much contribution by the community. I can understand this as this is an issue with open source in general. You may need to have a significant traction in order for people to contribute back modules or enchancements. I liked its thorough documentation, but the fact that the code was concentrated on a big file(s) that was not easy to follow the structure was something that bothered me.

uexec and FemptoOS had the same philosophy of large files containing the full RTOS and for me the code was again not easily readable (not necessarily from the code structure, but comments or spaces seperation etc). For me it is important to look at the code immediately be able to navigate; It should be a joy to look at the code. When you have a problem it is there were you would look for! This is the spirit of open source… usually you do not expect much support, but you contribute back your improvements. In theory at least.

XMKrtos seemed pretty attractive, but I never actually tried it.

A combination of initial targets architectures (8-bit processors), licensing, code readability and other factors moved me on.

I was not pleased too much with FreeRTOS at the time although I believe it is a good implementation. Then I went through FunkOS.

Normally because of its name, I would not trust such a system for RTOS. Certainly you don’t want to have a funky RTOS, right? Well I started digging into the code and I was shocked. The way it was written was very close to my programming attitude. It was very easy to read and follow. It had also a C++ verion of it as well. And it had also a small manual. Documentation (doxygen) is not as good as picoOS, but I this can be fixed. I plan to add missing parts over time.

So jumped on FunkOS. E, hmmm. Wait a minute I did not have a port for my controller. I use the coldfire V2 family, usually MCF5225x or MCF52233 (I have a demo board), but there are not many ports in general of these controllers. So I started working on my port. Delving on the issue, I discovered that FreeRTOS has better and safer handling on some points (FunkOS was based on FreeRTOS according to its author).

Yesterday I saw another interesting project the ChibiOS/RT. As I have started working with FunkOS, I did not divert to check this one.

Now let’s see some benchmarks. I first run FunkOS on my Demo board with MCF52233. As it was my first attempt to evaluate the RTOS I had only 3 tasks:

  1. Idle Task (Priority 0, Lowest)
  2. LED Alive (Priority 1)
  3. Second LED flash, triggered by a LED Alive semaphore and a timer wait [sleep delay]; (Priority 1)
  4. One IRQ (Systick).
  •  Each task has 256 bytes stack.
  • The core (system) clock runs at 50MHz.
  • Simple stack check: FunkOS original routine. Safer but slow.
  • Fast stack check: Own faster routine. May not accuretely provide always correct information (depending on stack data). Did work well for its purpose on this example.
  • Stack usage: Idle task 68 bytes, other tasks 100 bytes.
  • Flash footprint: 9K
  • RAM footprint: 1K (includes stacks)
  • Systick execution time: 14uS without stack check, 110uS with simple stack check, 22uS with fast stack check.
 

Register Save-Restore
 

1.5uS
 

Task Switch
 

3.2uS
 

SysTick (inc. task switch) with no stack check
 

14uS
 

SysTick (inc. task switch) with simple stack check
 

45us
 

SysTick (inc. task switch) with fast stack check
 

22uS

 

Did the modifications and run the same kernel on my new Perseus development board on MCF52258. My LEDs are flashing…

Happy New Year 2015!!!

 

 

Perseus Prototype

I started working on my first Prototype of Perseus (V0.81) board. A development platform I am building which combines the power of Coldfire MCU along with the capabilities of a Spartan6 FPGA.

Here are my first photos during the board assembly and test.

First assembled the switching power supplies (input 9V-18V ac/dc).

Then added the microcontroller (Coldfire MCF52258).

Perseus_MCU

Then added the FTDI USB to serial converter.

Perseus_USB

The MCU was tested along with a port of FunkOS R3 RTOS.

Assembling all the parts the board was concluded with the FPGA and its SDRAM.

Perseus_FPGA

The live board running the FunkOS flashed the LEDs passing the basic burn in test of the components (no critical errors).

Perseus_Live

Hardware was complete… almost; he he no FPGA code yet.

And more important: much firmware to write for controlling all these peripherals (USB, ethernet, SD card etc).