Advertisement

RTOS memory utilization

September 02, 2015

Colin Walls-September 02, 2015

Data size issues
Apart from a baseline amount of storage for variables, the RAM requirements of an RTOS can similarly be affected by a number of factors:

Compiler optimization
As with code, compiler optimization affects data size. Packed (compressed) data is smaller, but takes more instructions, and hence more time, to access.

RTOS objects
The number of RTOS objects (tasks, mailboxes, semaphores etc.) used by the application will affect the RTOS RAM usage, as each object needs some RAM space.

Stacks
Normally, the operating system has a stack and every task has its own stack; these must all be stored in RAM. Allocation of this space may be done differently in each RTOS, but it can never be ignored.

Dynamic memory
If dynamic (partition/block) memory allocation is available with an RTOS and used by the application, space for memory pools needs to be accommodated.

Static and dynamic RTOS configuration
Early RTOS products required configuration to be performed at build time – i.e. statically. As the technology progressed, the facility to create (and destroy) RTOS objects dynamically became commonplace. It is now quite uncommon to find an RTOS that permits static configuration. The impact on memory utilization of these options is interesting.

A statically configured RTOS holds most the data about RTOS objects in ROM. Some information needs to be copied to RAM, as it will be changed during execution, but needs to be initialized. Other objects need extra RAM space at run time.

A dynamically configured RTOS keeps all object data in RAM – none in ROM at all. However, there is a significant hit on ROM space, as there will be extra service calls to perform object creation and destruction.

Realistic answers
It should now be clear why it is unreasonable to expect a straight and simple answer to the question “How big is the xyz RTOS?” Realistically, the best response that might be expected is something like this:

“Nucleus RTOS running on an ARM Cortex A8 in ARM mode yields a ROM size of 12-30 K and RAM of 500 bytes. The low end ROM size includes the essential services; the high value includes all services. The runtime library is excluded. Building the RTOS for Thumb-2 mode reduces the ROM size by more than a third.”

Colin Walls has over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, Colin is an embedded software technologist with Mentor Embedded [the Mentor Graphics Embedded Software Division], and is based in the UK. His regular blog is located at: http://blogs.mentor.com/colinwalls. He may be reached by email at colin_walls@mentor.com

 

< Previous
Page 2 of 2
Next >

Loading comments...