What's Hot in 2015: Real-time frameworks, agile modeling, and code generation

December 1, 2014 OpenSystems Media

In 2015, just as in every year before, we will need to develop more embedded code with less people in less time. The only way to achieve this is to increase programmers' productivity. And the only known way to boost productivity is to increase the level of abstraction and automate the coding process as much as possible. We also need to start reusing entire software architectures, not just individual pieces of code.

Real-time frameworks

Embedded software will increasingly be based on generic, real-time, event-driven frameworks, which will augment and eventually displace the traditional Real-Time Operating Systems (RTOS).

The software developers for the desktop, the web, or mobile devices have already moved to frameworks (.NET, Cocoa, Android, Qt, etc.), far beyond the raw APIs of the underlying operating systems. In contrast, the dominating approach in the embedded space is still based on the venerable RTOS (or the "superloop" at the lowest end). The main difference is that when you use an RTOS, you write the main body of the application (such as the thread routines for all your tasks) and you call the RTOS services (e.g., a semaphore or a time delay). When you use a framework, you reuse the main body and write the code that it calls. In other words, the control resides in the framework, not in your code, so the control is inverted compared to an application based on an RTOS.

The advantage is that a framework offers a much higher level of architectural reuse and provides architectural integrity (often based on proven design patterns) to the application. Typically also, a framework encapsulates the difficult or dangerous aspects of your application domain. For example, an event-driven framework based on active objects (actors) inherently supports and automatically enforces the best practices of concurrent programming such as: keeping the thread's data local and bound to the thread itself, asynchronous inter-thread communication without blocking, and using state machines instead of the customary "spaghetti code." In contrast, raw RTOS-based threading lets you do anything and offers no help or automation for the best practices.

Many embedded software engineers might not realize that event-driven, frameworks based on active objects and state machines can be actually smaller than a conventional RTOS. For example, the open source QP active object frameworks from Quantum Leaps require only 3-4KB of ROM and significantly less RAM than a bare-bones RTOS kernel.

Agile modeling and code generation

Real-time frameworks based on hierarchical state machines will also be the key enabler for a wider adoption of modeling and automatic code generation. Of course, big and "high-ceremony" modeling tools have been tried and failed to penetrate the embedded market beyond a few percentage points. The main reason is the poor ROI (return on investment) of such tools.

However, a new class of agile tools will simplify modeling by skipping indirection layers of platform-independent models (PIMs), model transformations, action languages, etc. and will allow you to work directly with files, state machines, events, and actions expressed directly in C or C++. Obviously, such tools will be far less ambitious and lower level than "high-ceremony" tools of the past. But "lower-level" is not necessarily pejorative. In fact, the "lower-level" nature of the C programming language is the main reason for its popularity in embedded programming. We will see more innovation in the area of "low-level" and low-cost modeling and code generating tools (such as the free QM modeling tool from Quantum Leaps). This innovation will eventually bring us "modeling and code generation for the masses."

Quantum Leaps, LLC

www.state-machine.com

Quantum Leaps, LLC (Quantum Leaps, LLC)
Previous Article
Leverage Yocto/OpenEmbedded for your embedded software deployment

Developing an application and storing it on the device's ROM is no longer a simple deployment process on cu...

Next Article
Multicore goes mainstream

Since its initial release in 1991, Linux has grown to become one of the most popular operating systems (OSs...

×

Stay updated on Developer Tools & Operating Systems with the Dev Tools and OS edition of our Embedded Daily newsletter

Subscribed! Look for 1st copy soon.
Error - something went wrong!