Update of FreeRTOS for new 1.05 malloc

I have posted a new version of FreeRTOS as FreeRTOS20130521.zip http://code.google.com/p/rtoslibs/downloads/list.

This version is compatible with the new malloc in Arduino 1.05.


FreeRTOS is a very popular RTOS from Real Time Engineers Ltd.

The FreeRTOS_AVR library supports AVR Arduinos. The FreeRTOS_ARM library supports the Due Arduino, and Teensy 3.0.

FreeRTOS Features:

Large and growing user base and community. Free RTOS kernel - preemptive, cooperative and hybrid configuration options. Designed to be small, simple and easy to use. Queues, binary semaphores, counting semaphores, recursive semaphores and mutexes. Mutexes with priority inheritance. Tutorial books and training to educate engineers.

Hi Thank you very much for your updates. I have a question regarding the library: since I m using the library on Arduino 2009 I realized that the following code (from your example frBlink.ino)

// Sleep for 200 milliseconds.
vTaskDelay((200L * configTICK_RATE_HZ) / 1000L);

doesn t exactly create a delay of 200 ms, but even more.

I looked in the file FreeRTOSConfig.h where all definitions are and discovered that:

#define configTICK_RATE_HZ          ( ( portTickType ) (F_CPU/16384L))

Does it refer to another processor? Or is it compatible with Arduino (Atmega 328P)?!?

Thank you very much Bye

The tick is every 1024 microseconds on a 16 MHz CPU. The delay will be 195 ticks or 199.68 ms.


The Arduino AVR core sets the timer 0 prescale factor to 64. Timer 0 overflows at the frequency of F_CPU/16384L.

The tick for FreeRTOS and millis() happens every 1000000*16384/F_CPU microseconds.

Note that millis() doses not advance every millisecond. For a 16 MHz cpu millis() advances every 1024 microseconds. The counter for millis() advances by two every 41 or 42 ticks.

Here is the code for the timer 0 overflow that occasionally bumps m by an extra count:

	f += FRACT_INC;
	if (f >= FRACT_MAX) {
		f -= FRACT_MAX;
		m += 1;