As Embedded developers we are used to small systems responsible for a single task with limited number of secondary features. We don't need any fancy architecture for this, our code don't need to be that easy to read and we could find bugs manually. But with increasing capabilities of MCU's we are making more and more complex systems this way and these issues suddenly becomes showstoppers. We dont have proper guidelines to handle code quality in embedded except some very basic rules. Also as a community we don't share thoughts on this topic that much, we would rather talk about hardware, performance or syntax. Higher level programmers are dealing with architecture and code quality for years. We could borrow some concepts from them.
When I started to use C++ for Bare Metal I learned techniques like TMP to optimize code. Over the time i had own ideas and helpful solutions. Now I get asked at Usergroups how i handle specific problems and why I used templates for even simple solutions. This talk will show techniques that are not common in the industry but can help to write better code.
Since almost all embedded devices interact with the physical world, the reoccurring problem is how to deal with the various values from the physical world. One sensor may measure the current in miliamperes, while another may measure it in microamperes. There are also different measurement systems, such as metric and imperial (e.g. galons and litres, metres and yards, etc.), but there are also units which overlap with others (e.g. litres and metres cubed, Kelvin and Celsius). Even worse, we must ensure that all arithmetic operations with physical values must be valid (e.g. we can’t add Volts and Kelvins, but we can multiply them). Thankfully, modern C++ offers a lot of built-in language functionalities to make this job easy, transparent and surprisingly optimal in the run time.
The presentation will cover the problem from a real IoT project perspective, as well as the refactoring costs and long-term gains with this approach. If you deal with telemetry data on specific device or in the cloud, you may find this insightful.
This talk will introduce the embedded Linux landscape, and specifically the Yocto project, explaining how customized Linux images are generated, how to create layers with bitbake recipes and use the Yocto SDKs, with special focus on C and C++ applications. It will be described how to deploy to production systems and possible strategies for over-the-air updates. Some hints about binary management using Conan and Artifactory will be summarized, and the presentation will finish with a short demo.
Heap memory management becoming more and more crucial with increased smartness and connectness of embedded devices. This talk will look at the basic design drivers of standard libc memory allocators and discuss its impact on performance. An alternative approach to free store memory management will be shown, which is solely based on mmap(2) and does outperform traditional sbrk(2) based memory allocator by the factor of 2-3 in single thread applications and does scale an order of magnitude better in multi-threaded applications. An overview of the current state of desktop-based memory allocators will be given and what the limitations of these alloctors are in terms of thread scalability, safety and cache-friendliness. To round things up common approaches to deploy custom memory managers in C and C++ will be shown.
Callbacks are typically used, when one part of the software is waiting for another. They can be implemented in several different ways.
They can be realized, among others, as Function Pointer, C++ Interface and Lambda. During this session, you will see different approaches and how they compare against each other. Besides implementation comparison, execution time and memory consumption (RAM, ROM) will be discussed.
In Generic Programming you develop types and algorithms in a way, that they are reusable in diffent situations.
For example, this allows a search algorithm expert to program a certain sort function in a generic way. This function can then be used by other programmers for their specific types and use cases.
In most cases, expert-written functions will have substantially lower bugs and perform much better than ordinary implementations written on-the-run. Generic programming allows the encapsulation of knowledge.
C++ supports generic programming with templates. Unfortunately, up until now, there was no mechanism to formulate requirements for template types. A search algorithm may require that you have declared an operator '<' for the type you want to sort. Missing this requirement could easily yield a 100-line cryptic error page. This made it really hard to use generic functions in a productive way.
Fortunately, C++20 finally rectifies this situation. So called "concepts" now allow the generic function writer to explicitly state all requirements. A user not fullfilling one of the requirements will get a precise error message and can easily adapt.
This talk will tell you, why generic programming is so badly needed in embedded systems development.
The usual exclusive design criteria efficiency, reusability and stability get resolved together.
C++20 concepts syntax and usage is introduced.
The use of embedded systems continue to grow at an immense rate with 3 billion+ Cortex-M ARM chips shipped and it just increasing! However, someone has to write the programs that run on all these chips, where the trifecta of ergonomics, ease of use and safe utilization of resources often comes as a wish from the programmer, while in many applications an MCU hanging or crashing is simply not allowed. Thus far we have had C/C++ as the champions, where safer abstractions has started to come, especially with C++, however both lacks in is the ergonomics, ease of use and safe utilization of resources.
This talk aims to show that with Rust and the Real Time For the Masses (RTFM) scheduler we get this trifecta of properties, where it will start with an introduction to Rust and RTFM, and how the underlying system works, both from (simple) theory of Stack Resource Policy and a user’s perspective. It will then continue with how resources, memory safety, deadlock-free and data-race free execution can be guaranteed at compile time, keeping the generated binary minimal without losing expressivity!
ARM has shipped 100+ billion cores since 1991 - let's build the next 100+ billion on a strong foundation with ease of use and safe programs!