Working with Strings in Embedded C++
This article discusses the use of strings in embedded systems. It explains how the need for and use of strings in embedded systems has changed with the advent of cheaper, full graphic displays and the growth of the ‘Internet of Things’ (IoT). The article also covers character literals, C-Strings and string literals, and the difference in memory models between them. It also highlights the safety and security issues that arise from using strings in embedded systems. Finally, it explains how C++11 introduced a Raw string literal type that is useful for storing file paths or regular expressions.
C to C++: Bridging the Gap from C Structures to Classes
In our last post, C to C++: Proven Techniques for Embedded Systems Transformation, we started to discuss the different ways that C++ can be used to write embedded software. You saw that there is no reason to be overwhelmed by trying to adopt complex topics like metaprogramming out of the gate. An important concept to understand is that you can make the transition gradually into C++ while still receiving the many benefits that C++ has to offer.
One of the first...
Cracking the (embedded) Coding Interview
You never forget the day you land your first job.
The thrill of receiving that call from your recruiter to tell you that you bagged your dream role! The relief when you finally see the offer letter you’ve been working towards for years. The pride in your parents' voices when you call home and say “Hey look Ma, I’ve made it!”
But before that, there’s the grueling screening process to get through. Tech interviews often last up to three months and companies can have five...
Visual Studio Code Extensions for Embedded Software Development
Visual Studio Code has become one of the most popular IDEs in the world. To date, software developers have downloaded it more than 40 million times! I suspect you’ve at least heard of it, if not already attempting to use it. Visual Studio Code allows developers to easily customize their development environment which can help them accelerate development, minimize bugs, and make developing software overall much better.
One challenge with Visual Studio Code is that embedded software...
C to C++: 3 Proven Techniques for Embedded Systems Transformation
For 50 years, the C programming language has dominated the embedded software industry. Even today, more than 80% of embedded projects are using C; however, over the last few years, many teams have begun transitioning from C to C++. C++ offers embedded developers a robust, modern set of tools that can be used to write flexible, scalable, and reusable applications. As embedded applications become more complex and connected, teams need a more modern language to help them deal with the software...
A Beginner's Guide to Embedded Systems
I was in my Junior year of college when I first learned about embedded systems. Sure, I’d heard about this mystical world of sensors and IoT, the same way I’d heard about thermonuclear astrophysics; But, the phrase “embedded systems” didn’t really mean anything to me. This, here, is a guide for people like teenage me. We’re going to learn what an embedded system actually is, and why working on embedded software is the coolest thing you could ever do!
What's an embedded...C to C++: 3 Reasons to Migrate
I’ve recently written several blogs that have set the stage with a simple premise: The C programming language no longer provides embedded software developers the tools they need to develop embedded software throughout the full software stack. Now, don’t get me wrong, C is a powerhouse, with over 80% of developers still using it; however, as embedded systems have reached unprecedented levels of complexity, C might not be the right tool for the job.
In this post, I’m kicking...
Review: Hands-On RTOS with Microcontrollers
Full disclosure: I was given a free copy of this book for evaluation.
Hands-On RTOS with Microcontrollers: Building real-time embedded systems using FreeRTOS, STM32 MCUs, and SEGGER debug tools by Brian Amos is an outstanding book. It lives up to its name, extremely hands-on and practical, taking you from knowing nothing about RTOS's (Real-Time Operating Systems) up to building real multithreaded embedded system applications running on real hardware.
It uses the ST Micro
Scorchers, Part 3: Bare-Metal Concurrency With Double-Buffering and the Revolving Fireplace
This is a short article about one technique for communicating between asynchronous processes on bare-metal embedded systems.
Q: Why did the multithreaded chicken cross the road?
A: to To other side. get the
There are many reasons why concurrency is
Bellegram, a wireless DIY doorbell that sends you a Telegram message
A wireless button that uses the M5 STAMP PICO and Mongoose to send a Telegram message when pressed. The code is written in C
Getting Started With CUDA C on an Nvidia Jetson: A Meaningful Algorithm
In this blog post, I demonstrate a use case and corresponding GPU implementation where meaningful performance gains are realized and observed. Specifically, I implement a "blurring" algorithm on a large 1000x1000 pixel image. I show that the GPU-based implementation is 1000x faster than the CPU-based implementation.
NULL pointer protection with ARM Cortex-M MPU
This post explains how you can set up the ARM Cortex-M MPU (Memory Protection Unit) to protect thy code from dragons, demons, core dumps, and numberless other foul creatures awaiting thee after thou dereference the NULL pointer.
Embedded Developers, Ditch Your IDEs – Here’s Why!
Ditching your Integrated Development Environment (IDE) temporarily can be a transformative learning experience in embedded development. This post invites you to explore the underpinnings of IDEs by delving into alternative tools and processes like Makefile, CMake, Vim, GDB, and OpenOCD. Understanding these tools can demystify the background operations of IDEs, revealing the intricacies of compiling, linking, and debugging. This journey into the “under the hood” aspects of development is not just about learning new tools, but also about gaining a deeper appreciation for the convenience and efficiency that IDEs provide. By stepping out of your comfort zone and experimenting with these alternatives, you can sharpen your skills, enhance your knowledge, and possibly discover a more tailored and streamlined development experience. Whether you're a novice or a seasoned developer, this exploration promises insights and revelations that can elevate your embedded development journey.
ANCS and HID: Controlling Your iPhone From Zephyr
In this blog post, we see how certain BLE services can be used to control an iPhone from a Nordic nRF52840 using The Zephyr Project. Specifically, we see how to control certain multimedia functionality using the HID service. Finally, we learn how to use the ANCS client library provided by Nordic in The Zephyr Project to accept or decline an incoming call.
When a Mongoose met a MicroPython, part II
In the first part of this blog, we introduced this little framework to integrate MicroPython and Cesanta's Mongoose; where Mongoose runs when called by MicroPython and is able to run Python functions as callbacks for the events you decide in your event handler. Now we add MQTT to the equation, so we can subscribe to topics and publish messages right from MicroPython.
Why Should Unit Tests Feel Like Simulations?
Unit tests are designed to test units of software, but what exactly is a unit of software? It can be a function or a method, a class, or even an entire module.
If you're just starting with unit testing, chances are you're testing the implementation of a function or a method. Consequently, if the implementation changes, you must update your tests as well, which can render the entire process pointless. This is often the case with small pieces of code, particularly in embedded development,...
There are 10 kinds of people in the world
It is useful, in embedded software, to be able to specify values in binary. The C language lacks this facility. In this blog we look at how to fix that.
Assembly language is best - except when it isn’t
A look at why writing in C often produces more efficient code than hand-written assembly language.
Handling Translations in an Embedded Project
A brief walkthrough on how to handle human language translations in a low level C application. Some options are listed, each with advantages and disadvantages laid out.
Bellegram, a wireless DIY doorbell that sends you a Telegram message
A wireless button that uses the M5 STAMP PICO and Mongoose to send a Telegram message when pressed. The code is written in C
ANCS and HID: Controlling Your iPhone From Zephyr
In this blog post, we see how certain BLE services can be used to control an iPhone from a Nordic nRF52840 using The Zephyr Project. Specifically, we see how to control certain multimedia functionality using the HID service. Finally, we learn how to use the ANCS client library provided by Nordic in The Zephyr Project to accept or decline an incoming call.
Getting Started With CUDA C on an Nvidia Jetson: GPU Architecture
In the previous blog post (Getting Started With CUDA C on Jetson Nvidia: Hello CUDA World!) I showed how to develop applications targeted at a GPU on a Nvidia Jetson Nano. As we observed in that blog post, performing a calculation on a 1-D array on a GPU had no performance benefit compared to a traditional CPU implementation, even on an array with many elements. In this blog post, we will learn about the GPU architecture to better explain the behavior and to understand the applications where a GPU shines (hint: it has to do with graphics).
New book on Elliptic Curve Cryptography
New book on Elliptic Curve Cryptography now online. Deep discount for early purchase. Will really appreciate comments on how to improve the book because physical printing won't happen for a few more months. Check it out here: http://mng.bz/D9NA
When a Mongoose met a MicroPython, part II
In the first part of this blog, we introduced this little framework to integrate MicroPython and Cesanta's Mongoose; where Mongoose runs when called by MicroPython and is able to run Python functions as callbacks for the events you decide in your event handler. Now we add MQTT to the equation, so we can subscribe to topics and publish messages right from MicroPython.
Assembly language is best - except when it isn’t
A look at why writing in C often produces more efficient code than hand-written assembly language.
Small or fast?
Developers of software for desktop computers take code optimization for granted. Embedded developers typically need to pay much more attention to the details
C++ Assertion? Well Yes, But Actually No.
Assertions are a double-edged sword - on one side you enforce program correctness catching bugs close to their origin, on the other your application is subject to run-time error, like any interpreted language. This article explores what C++ can offer to get the advantages of assertions, without risking the crashes by moving contract checking at compile time.