In real time systems using an RTOS, what how would the RTOS handle an idle period? Would it run nop instructions at the lowest frequency supported by a Dynamic Voltage Scaling capable processor? or would it turn to a sleep state? Can anyone refer me to actual practical implementations. Thanks
I have been using FemtoOS in few projects and it works very well.
There has been discussion related to this question here: link
Extracts: The Linux Journal article that is referred to is here: link
I think that the 8052 and the M68HC12 ports are especially bad choices to characterize NuttX because they both have some issues, and NuttX is now at version 5.16 with 63 releases.
Extensive NuttX documentation is available here: link .
The issues with the hcs12 and 8051 parts are as follows:
8051/80c52: This architecture is really RTOS hostile. It has a tiny hardware stack (128 bytes on the 8051, 256 on the 80c52) at a dedicated memory location (address 0). To switch tasks, you have to copy the whole stack of the task to be blocked from its dedicated address to some save location, and then copy the whole stack of the task to be started from its save location to the dedicated stack location. YECH!
And since, the stack is so tiny. It is very, very easy to overrun the stack -- especially during interrupt handling.
The NuttX 8051 port is complete and functional (at least the last time I used it). But in order to make it useful, you would probably have to copy the whole stack on each interrupt as well to keep it from overflowing. Basically, I lost interest at that point but if some one were really motivated to use the 8051, it is doable (if perhaps not well-advised).
What was good about the 8051 port is that it was a great exercise in getting NuttX into a very small memory location. The 8051 port runs in 32Kb of RAM -- that includes the RTOS, libc, compiler libraries, a substantial test program, .data/.bss, and and heap. And with a little memory to spare!
hcs12: This is a project that I work on in my spare time when I am not doing anything else. It is just not finished and not ready for prime time yet.
With regard to comparison to other RTOSs, I really don't have any good, authoratative answers because I don't use other RTOSs. But here is my naive understanding:
FreeRTOS has tons of downloads and a really tiny footprint of about 4Kb. It is the RTOS of choice for the really small MCUs. A FreeRTOS port is bundled by silicon vendors with just about every MCU. So it is the default RTOS choice.
There are dozens of competitors with FreeRTOS out there. ChiBIOS comes to mind immediately. These are all tiny schedulers of varying types.
In order to do a real comparison, one thing we need to do first is to define what we mean by an RTOS: Is it just a scheduler? Or is it an integrated set of standard OS features -- like scheduler, filesystem, device drivers, memory management, networking, etc. Most operating system, Linux for example, are full development environments, not just schedulers. NuttX is a full operating system is the same sense as Linux. Here are a couple of others:
RTEMS: I've worked with this one. It has been around forever and should be very stable. It is big; think >100kb. I think it aims a little above the MCU market.
uCOS: Never used it, but this the RTOS under several popular bootloaders, isn't it? My impression is that is it similar to RTEMS, but I don't really know what I am talking about.
How would I compare NuttX to those: Well, it is a lot smaller. The starting footprint is around 20Kb. A full featured configation is some 10-20Kb more. Another difference from these RTOSs is that NuttX is very standards oriented. You can think of NuttX as a tiny, Linux work-alike. Most code that compiles and runs on Linux will also run on NuttX (some system code like networking code or daemons might need some tweaking).
I think RTEMS is more focused on micro-processors; NuttX is more focused on micro-controllers.