The timer is the first time FreeRTOS has used a ‘daemon task’ – a task which is providing services to applications – as until now every thing has been built into the kernel.
“The major difference in 7.0 is the introduction of a new software timer implementation,” FreeRTOS creator Richard Barry told Electronics Weekly. “. FreeRTOS tries to do things in an efficient way and this timer I am very happy with from an efficiency point of view. It doesn’t use any CPU time unless there is actual processing to be done.”
Rather than polling the timers or checking them in an interrupt, he explained, the timer enters the blocked state using standard kernel features until a timer actually expires.
“This allows timer call-backs to be executed in a task context, rather than an interrupt context, and does not consume any processing time or generate any run time overhead unless a timer has actually expired,” said Real Time Engineers, the firm that owns the FreeRTOS brand.
When FreeRTOS is ported, it is ported to a particular processor plus a particular compiler within a tool chain, and a ‘demo’ is produced alongside the combination.
Demos in this case are “a pre-configured project that you can just open which targets a particular tool and target board so you have an already-running example”, said Barry.
The new port is for Texas Instruments’ 20bit MSP430X with TI’s Code Composer Studio tools including their Eclipse-based integrated development environment (IDE).
Of the two new demos, one is for the MSP430X/Code Composer combination, and the other is for STMicroelectronics’ ARM Cortex-M3-based STM32 microcontrollers with Atollic’s TrueStudio tools.
FreeRTOS is in its eighth year, and has a reasonable claim to being a, if not the, de-facto standard cross-platform RTOS – it was downloaded 80,000 times last year and at the last count is has been ported to over 50 combinations of 27 processor families and 17 tool chains.
Small footprint was always the main design goal of FreeRTOS, which is aimed at low-cost 32bit microcontrollers – Cortex-M3, Renesas RX, microchip PIC32, and ColdFire, for example.
“Not at Pentium and that sort of thing, although it will actually run on a Pentium in 16bit mode,” said Barry.
As a rough guide, it suits 32bit processors with 32kbyte to around 1Mbyte of flash.
“When you get into systems with a lot more flash and a lot more RAM, and you want a free system, you are into Linux,” said Barry.
The final size depends on the microcontroller architecture, the efficiency of the compiler, and RTOS options selected.
According to Barry, it will be 5-9kbyte on a Cortex-M3, and the kernel seldom is bigger than 9kbyte.
“It will runs on 16bit and 8bit cores as well, although you have to question the use of an RTOS on an 8bit microcontroller,” he said.
That said, there is a port for 8052s, which are 8bit.
“The 8052 port is for clones of the 8052 like the very quick ones from Silicon Labs with lots of RAM and lots of peripherals. These are really 8052 emulators,” said Barry.
FreeRTOS is ‘moderated open-source’ as Barry puts it.
“Code contributed back is kept separately,” he said. “Keeping contributed code separately, although publicly available, is a mechanism for knowing the official version has no third party IP issues.”
The RTOS is completely free to download and use, including in commercial applications, and the terms of the open-source licence allow adopters to maintain proprietary control of the code they write around the kernel.
“One of the critical points as an open-source project is that you don’t have to open-source the whole project, just the kernel,” said Barry. “You can optionally take out a commercial licence if you want which gives you commercial support, indemnity, and additional components – like TCP/IP and USB stacks.”
“It is the same as FreeRTOS. It is just that the licence terms are different. ” said Barry.