Catchpoints: Unlimited Number of FLASH Breakpoints with GDB

Embedded hardware comes with limitations, and one if it is the given number of hardware breakpoints. Depending on your MCU, 4 or only 2 hardware breakpoints are available, making debugging and stepping in read-only memory (FLASH) a challenge.

Debugging NXP LPC845 with unlimited FLASH Breakpoints using MCU-Link

Did you know that one can have ‘unlimited’ number of breakpoints in FLASH, with the help of GDB? This is very useful for extended debugging, or if you want to use breakpoints for testing?

Continue reading

Creating a GNU Assembly-Only Project

Sometimes it makes sense to write everything in assembly, even these days. For example if using a tiny microcontroller. Or just if one just don’t need all the productivity of the C/C++ tools. And it is a good educational experience: getting hands-on on the lower levels.

Debugging an Assembly-Only Project
Continue reading

Booting J-Link as CMSIS-DAP Debug Probe

Mostly unnoticed (at least for myself), SEGGER has enabled some of the J-Link debug probes to support the CMSIS-DAP debug protocol.

SEGGER J-Link as CMSIS-DAP Debug Probe

This greatly enhances the use of J-Link debug probes for CMSIS-DAP based tools.

Continue reading

Building a Triumvirate: From Eclipse CDT to CMake, CMD and Visual Studio Code

A Triumvirate is or Triarchy is built by three individuals which lead or rule something. In this article I want to rule a project with Eclipse CDT, Visual Studio Code and with building it from the command line for automated builds.

So what if I have an Eclipse project (say MCUXpresso IDE and SDK), and want to build it on a build server, and and I want to use the same time the project with Eclipse IDE and Visual Studio code?

Key to this is CMake: I’m keeping the Eclipse CDT features, adding CMake with Make and Ninja to the fix, and have it ‘ruled’ by three different ’emperor’: Eclipse, Visual Studio Code and from a shell console:

MCUXpresso SDK CDT project with CMake for Eclipse, Visual Studio Code and Command Line Building
Continue reading

Added Heap Memory Monitoring and Tracking to FreeRTOS V10.5

We all should know it: dynamic memory usage can be dangerous. There can be memory fragmentation, use-after-free, out-of-memory and memory leaks. While I do prefer static memory allocation for embedded systems, using a dynamic memory allocation in some applications is not avoidable or just makes sense.

In one of my lecture modules we develop a ‘Boulder’ game, where the player has to collect underground diamonds and avoid moving monsters:

LPC845-BRK with OLED using dynamic memory allocation

I’ll show you have FreeRTOS memory usage can be tracked and monitored.

Continue reading

RP2040 with PIO and DMA to address WS2812B LEDs

I love the WS2812B (aka SK6812) addressable LEDs: they are inexpensive and available in different packages. I have used them in different projects, including the MetaClockClock one. I used the NXP Kinetis for these projects, but because they are not available any more, for a new project we had to choose a new microcontroller, with the Raspberry Pi Pico RP2040 as the winner.

Raspberry Pi Pico RP2040 driving WS2812B with PIO and DMA
Continue reading

Using a Watchdog Timer with an RTOS

When something goes wrong in an embedded system, a watchdog timer is the last line of defense against a blocked or malfunctioning system. A watchdog is a special timer which needs to be ‘kicked’ in a special way, otherwise the timer will run out and reset the system.

For example, a watchdog is an important safety feature in the E-Vehicle charging controller with Raspberry Pi Pico-W RP2040:

EVCC Controller
Continue reading

BLE with WiFi and FreeRTOS on Raspberry Pi Pico-W

The Raspberry Pi Pico RP2040 is a very versatile microcontroller. It is not the least expensive or the most powerful microcontroller, but it is one which is available and has an excellent software and tool ecosystem.

This article shows how to use the Raspberry Pi Pico-W with BLE and optional WiFi, running with FreeRTOS.

Continue reading

Avoiding Stack Overflows: Application Monitoring the Stack Usage

One of the biggest fears of embedded systems developers are stack overflows. FreeRTOS includes a cool feature to monitor and catch task stack overflows. But what about the MSP (Main Stack Pointer) on ARM, or the interrupt stack? What if not using an RTOS and running a bare-metal application?

Checking stack size used

There is a simple way monitoring stack usage at runtime, and for this I want to share the routines and what is now available inside the McuArm module.

Continue reading

Adding the Picolib C/C++ Standard Library to an existing GNU ARM Embedded Toolchain

It looks like my previous article “Which Embedded GCC Standard Library? newlib, newlib-nano, …” stirred up something: I saw and knew about the Picolib created and maintained by Keith Packard, but never had the time to try it out. With the university grading mostly over, I have put aside a few hours to try it out. And the result is very interesting:

Footprint of different embedded libraries

Continue reading