Go Down

Topic: ChibiOS/RT 2.4.0 RTOS update (Read 1 time) previous topic - next topic


Feb 21, 2012, 04:39 pm Last Edit: Feb 21, 2012, 04:45 pm by fat16lib Reason: 1
I have updated the ChibiOS/RT library to version 2.4.0.

This library is a simple way to use the ChibiOS/RT RTOS on 328 and Mega Arduinos.

The download is ChibiOS20120221.zip at http://code.google.com/p/beta-lib/downloads/list.

The main new thing for AVR is support for pal (digital I/O).  If you want to try this edit halconfig.h and change line 47 to this.
Code: [Select]
#define HAL_USE_PAL                 TRUE
I have not tested pal, just checked that it compiles with the above define.  A lot of edits will be required since the default board is a Olimex AVR-MT-128 proto board.

There are a huge number of internal changes.  The diff between 2.2.8 and 2.4.0 versions of the utility folder in the Arduino library has 4739 lines.

There are a lot of new files.  Most of the new files are for features not supported for AVR



Thanks for your effort porting to ChibiOS, I was searching for something similar, because programming without an RTOS sometimes is not easy (and i don't want to start one more discussion about bare metal programming vs RTOS, it just depends on the complexity, even for such a limited device there is space for a RTOS in my opinion, usefull for some types of requirements). The problem I face in your porting is how to use it. i'm not familiar with ChibiOS, can you give some tips on how to use your port? From what I saw in the readme you are integrating it in the Arduino environment, so the IDE will still be the Arduino even using the ChibiOS (something like the DuinOS)? Does it work with the Arduino 022? or with 1.0? And the diferent folders, I didn't understand well what to change between the supplied folders and the original files from the chibiOS. If you can give some tips on how to do it it will be great!

Best regards



Very nice indeed. Thanx very much.

I've read that the delay function does not work (correctly?) in an interrupt handler routine. Can delay (or standard libs that use delay - like LCD) be used in the threads of ChibiOS?


The Arduino delay function will block all lower priority threads or all threads if used in an interrupt routine.

Arduino delay is just a loop that does not release the CPU:
Code: [Select]

void delay(unsigned long ms)
uint16_t start = (uint16_t)micros();

while (ms > 0) {
if (((uint16_t)micros() - start) >= 1000) {
start += 1000;

You should use ChibiOS thread functions like:

void    chThdSleep (systime_t time)
   Suspends the invoking thread for the specified time.

void    chThdSleepUntil (systime_t time)
   Suspends the invoking thread until the system time arrives to the specified value.

You can use scheduler functions to put a thread to sleep or wake a thread.

You can often use synchronization functions in place of delay.

Documentation is here http://chibios.sourceforge.net/docs/kernel_avr_gcc_rm/group__base.html.


Wow, nice documentation!   The pages are very clear, the tree is great, and the references to the actual code.  Is the underlying structure of those webpages available to other groups?   
Dr. David Harris
OpenLCB Dev Team

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131