What is the hard programming language

Real-time software: embedded programming and operating systems

What does professional embedded software development look like today?
A quick introduction to the world of real-time operating systems and embedded software programming in EC and EC ++.

On the basis of the software architecture refined in software design, you as a software developer implement (program) it in a structured, procedural, object-based or object-oriented manner with the programming language C or C ++.

You adhere to the architecture and design specifications as well as the programming guidelines and confirm this through reviews or static code analysis tools. MISRA C and MISRA C ++ are sets of rules for programming safety-critical software from the automotive sector. These coding rules also apply as a reference in other areas, such as medical technology.

Coding of embedded and real-time software with Embedded C and Embedded C ++

Embedded C (EC) and Embedded C ++ (EC ++) are not stand-alone standards, but merely describe the use of the programming languages ​​C and C ++ for coding embedded and real-time software.

Real time means determinism (predictability). You differentiate between hard and soft real-time. With hard real-time, you guarantee compliance with your time specifications (including deadlines, response times) in 100% of all cases, unlike in soft real-time. There you will develop real-time strategies to meet real-time requirements.

In embedded programming and real-time programming, as a software developer, you know exactly what you are programming and how: Where is a variable and what is the real-time behavior of the software? You know the consequences for your target with your tool chain (compiler, linker, locator) at the machine code level (assembler code).

As an embedded and real-time software developer, you use programming constructs from the C and C ++ programming languages ​​that support typical quality features, such as low resource requirements, high performance, guaranteed response times, functional safety and reliability, and avoid the use of constructs that counteract this are.

Hardware-related programming

With hardware-related programming, you access the peripheral registers of the hardware directly with Embedded C and Embedded C ++ (driver programming). You will also master the special features of interrupt programming.

Real-time operating systems (RTOS)

With simple and sequential software, you program the runtime architecture in an endless loop (while (1) or a "super loop" or "main loop"). If the software is more complex and you reach the limits of the manageability of the control of the software process through an endless loop, then the use of an embedded operating system is recommended.

To do this, you divide the software into individual functions (so-called tasks), identify (quasi-) parallel execution paths, define repetition times, timeout times and data dependencies for your software functions (tasks).

The advantage of an operating system is that operating system services are available for all control, communication and monitoring functions. For example, when defining each task, you can determine when it has to be processed and whether it is processed in good time (automatic monitoring of the task timeout).

As a software developer or software architect, you select the appropriate operating system on the basis of the system requirements, operating system selection criteria (e.g. single-core RTOS or multicore RTOS, with or without memory protection service, etc.) and an operating system overview. They differentiate between the embedded operating system and the real-time operating system.

Operating system examples

Embedded Linux, RT Linux, Linux Kernel, FreeRTOS and CMSIS-RTOS as the arm operating system.

What's the best operating system?

The best operating system results from the requirements of your application. Not every operating system is automatically real-time capable. You can also choose to design and program your own operating system or mini-operating system yourself.

Use of the operating system

When using the operating system, you as a software developer successfully face the challenges if you know the basics, components, definitions, tasks, functions and the application use of the following operating system mechanisms:

Process management, task management, thread management, scheduling procedures (cooperative scheduling, preemptive, time-based, time-triggered, priority-based, time-slice, round-robin, earliest-deadline-first EDF), synchronization (event, signal ), Resource management (binary semaphores, counting semaphores, mutex, critical section), interrupt management, time management, internal communication (message queue, mailbox, shared memory, pipe, socket, message-based), memory management and I / O Management (input / output management).

Image: Task states and their transitions in the operating system

Multicore in hardware and microcontroller architectures

In modern hardware and microcontroller architectures, the topic of multicore or multiprocessor (homogeneous and heterogeneous) is becoming more and more important. For most embedded and real-time software developers, this represents a completely new challenge. As a software developer, you know what you need to do when programming in C and in C ++ together with one or more operating systems on a multicore platform or multiprocessor -Platform must be observed.

In addition, you can use modern debug and trace methods to optimize your software in a targeted manner in the shortest possible time.

Real-time operating systems and embedded software programming are among the important disciplines that embedded developers should master in the age of IoT. Use the know-how from our training offers to learn more about it.

Additional information

MicroConsult training & coaching on embedded and real-time programming

MicroConsult expertise in embedded and real-time software development

Published by

Ingo Pohle

Ingo Pohle is co-founder and managing director of MicroConsult GmbH and an internationally recognized specialist for embedded solutions, with a wealth of experience in the use of embedded microcontrollers, bus systems and RTOS. View all posts by Ingo Pohle

Posted by the author Ingo PohleCategories Embedded and real-time software developmentTags EC, real-time, real-time operating system, real-time programming, real-time system, embedded-C, embedded programming, embedded software, hardware-related programming, RTOS