Tag: mcu

  • MCU Peripheral Forwarding

    PC applications that interact with MCUs are used by developers for a number of reasons, such as data visualization, monitoring during testing campaigns, and command and control via a GUI. In this article, we’ll explore mapping an MCU’s peripherals to your personal computer to simplify development of PC applications built for embedded systems.

  • Asynchronous Rust on Cortex-M Microcontrollers

    In this article, we explore the inner workings of Futures, cooperative scheduling, and Async Rust executors, highlighting their significance in optimizing resource utilization. Moreover, we introduce the Rust Embassy project, an innovative framework designed to unlock the power of asynchronous programming on microcontrollers.

  • Selecting Your Next Project's MCU

    Selecting the best chip can be tedious work but the best chip can save you a lot of time and money, and might even be faster! So should you spend time finding the best? I have some words on the topic.

  • Profiling newlib-nano's memcpy

    This article takes a look at one of the commonly used functions provided by the Newlib C library: memcpy. We’ll examine the default nano implementation and the performance implications, comparing it against the faster non-default implementation.

  • The Best and Worst MCU SDKs

    In this post, I download SDKs for 10 popular Cortex-M4 microcontrollers, and evaluate how straightforward it is to get a simple example compiling. I include some step by step instructions to get started, a rating out of 10, and a few comments.

  • Faster Debugging with Watchpoints

    In this post we will explore how to save time debugging by making the most of watchpoints. We will walk through a few classic use cases of watchpoints by debugging an example application with GDB. Then, we will dive into how watchpoints are implemented for ARM Cortex-M based MCUs with the Data Watchpoint & Trace (DWT) unit and explore some advanced features.

  • Secure firmware updates with code signing

    In this post, we explain why firmware signing is important, how it works, and what algorithm should be used to implement it. We also detail a full implementation built with open source, cross platform libraries.

  • Step-through debugging with no debugger on Cortex-M

    This week we explore how to debug running systems with ARM Cortex-M’s DebugMonitor exception handler. We cover how to configure the MCU to operate in this mode and walk through an example of installing breakpoints and single-stepping on a running device!

  • How do breakpoints even work?

    In this article, we will discuss the basic types of breakpoints (hardware and software) and how they are utilized by the GNU Project Debugger, GDB. We will then explore how to configure hardware breakpoints on an ARM Cortex-M MCU using the Flash Patch and Breakpoint Unit (FPB) and examine a real-world configuration with an example application.

  • Building a Tiny CLI Shell for Tiny Firmware

    In this post, we go over why an embedded firmware should include a command-line shell interface, common use cases for it, how to build and extend one, and cover common issues that developers run into while build and maintaining one. The shell we will build will work over a UART serial port, which should make it applicable to most embedded systems.

  • Profiling Firmware on Cortex-M

    In this post, we explore different techniques that can be used to profile firmware applications running on ARM Cortex-M microcontrollers. To profile our Mandelbrot application on STM32, we start with a naive debugger-based sampling method, and eventually discover ITM, DWT cycle counters, and more!

  • Better Firmware with LLVM/Clang

    In this article, I hope I can convince you that adding a Clang build target to your project can be a relatively simple and useful endeavor. We will cover how to take advantage of some of the rich features shipped with the toolchain and identify some memory leaks and mutex deadlocks in an example project at compile time! We will also walk through a step-by-step example of updating a GCC based ARM Cortex-M project to cross-compile with LLVM/Clang.

  • Cortex-M MCU Emulation with Renode

    In this post, I walk through setting up the Renode emulator and running a firmware in it for STM32. Using that setup, we’ll debug our firmware, run it through integrated tests, and shorten the iteration cycle of development.

  • How to debug a HardFault on an ARM Cortex-M MCU

    In this article, we explain how to debug faults on ARM Cortex-M based devices. In the process, we learn about fault registers, how to automate fault analysis, and figure out ways to recover from some faults without rebooting the MCU. We include practical examples, with a step by step walk-through on how to investigate them.

  • ARM Cortex-M RTOS Context Switching

    In this article we will explore how context switching works on ARM Cortex-M MCUs. We will discuss how the hardware was designed to support this operation, features that impact the context switching implementation such as the Floating Point Unit (FPU), and common pitfalls seen when porting an RTOS to a platform. We will also walk through a practical example of analyzing the FreeRTOS context switcher, xPortPendSVHandler, utilizing gdb to strengthen our understanding.

  • A Practical guide to ARM Cortex-M Exception Handling

    In this article we will dive into the details of how the ARM Cortex-M exception model supports the handling of asynchronous events. We will walk through different exception types supported, terminology (i.e. NVIC, ISR, Priority), the configuration registers used & common settings, advanced topics to be aware of regarding exceptions and a few examples written in C.