Talks at Meeting Embedded 2019

What could we learn from higher level programmers?

Speaker: Maciej Gajdzica

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.

What can be done?

Speaker: Paul Targosz

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. 

Dealing with measured physical units in modern C++

Speaker: Nikola Jelic

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.

Develop and deploy C/C++ applications to embedded Linux systems with Yocto

Speaker: Diego Rodriguez-Losada & Brennan Ashton

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: Overcoming fragmentation fears

Speaker: Frank Mertens

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 - a cost-benefit comparison

Speaker: Pawel Wisniewski

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.

IoT with Rust and the nRF9160 - more secure and lower power!

Speaker: Jonathan Pallant

Nordic Semi's new nRF9160 device combines a Cortex-M33, RAM, Flash, standard nRF52 style peripherals plus an LTE Cat-M (LTE-M) and Cat-NB1 (NB-IoT) modem, in a very small package. Being a Cortex-M33, it uses the armv8m.main architecture, and includes Arm TrustZone hardware to enforce system security boundaries (e.g. your secure bootloader vs your non-secure application). 42 Technology have successfully built an demo application in the Rust Programming Language which runs on the nRF9160 and can access the Internet through Nordic's LTE driver blob. We believe this allows a whole new class of connected device: a small and low power bare-metal embedded system, but with the memory safety, security and ease of software development you expect from a much larger system running Linux and a Python or C# application. This talk will touch on what we had to change to get Rust running on the new armv8m.main architecture, what TrustZone means for application security, and how we interfaced with Nordic's proprietary binary driver blob in Rust, given only C examples to work from.

Generic programming for the masses

Speaker: Daniel Penning

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.

Rust and the RTFM scheduler: The future of embedded programming

Speaker: Emil Fresk

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!

Embedded Rust and Serde: A Love Story

Speaker: James Munns

For many embedded systems, sending and receiving messages is a core part of their functionality. Whether that means communicating with other embedded systems, phones, PCs, or servers; building efficient and reliable protocols to send and receive data between devices of any class has become an unavoidable challenge. Unfortunately, building protocols like these is a deceptively hard task, with edge cases causing problems like code crashes, security vulnerabilites, and hidden memory and CPU costs that can be a nightmare to debug.

This talk explores ways that the Rust programming language and libraries such as Serde are particularly well suited to quickly building reliable and efficient data protocols across embedded devices of all sizes, all the way from high power Embedded Linux systems, down to tiny bare metal systems. This talk also explores how you can use these components even if your system isn't written in Rust.

For teams that are interested in trying Rust, but aren't ready to start whole projects in it yet, this talk explores why serialization and deserialization is a particularly great first use case to take Rust for a test drive.