Unknown's avatar

About Erich Styger

Embedded is my passion....

Data Converter for MCUXpresso Energy Measurement Data

The combination of the NXP MCUXpresso IDE with the NXP MCU-Link Pro debug probe implements a nifty power and energy measurement tool (see New “MCU-Link Pro”: Debug Probe with Energy Measurement). The eclipse based IDE provides a dedicated view to inspect the data collected. It can export and import data, but it is in a binary format. In this article I present a way to export and then convert the data into .csv or any other format for processing or visualizing it in different ways.

Exporting data to gnuplot and csvplot

Using an open source command line tool, the binary data gets converted into a csv format, which then can be consumed by many tools, e.g. gnuplot.

Continue reading

LinkServer Scripting, and how to Recover MCUs with a Script

The MCU-Link is an inexpensive CMSIS-DAP debug probe from NXP. It can be used as a GDB server debug probe, and as such it includes scripting support. This scripting can be very useful in some cases where the MCU cannot be accessed by a normal debug session. This happens for example if students are not pay attention what binary they flash to which device, causing an MCU to potentially get ‘bricked’.

NXP MCU-Link debug probe connected to Sumo Robot
Continue reading

GNU Linker Wizardry: Wrapping printf() with Timestamps

If one is using a dedicated logger module like the McuLog, then you don’t have to worry or care about timestamp support. But if your application is using normal printf() calls for for logging purpose, you will face issues to adding timestamps to it. You might consider to change all prinft() calls. This might be a lot of work, or not possible in all cases if you cannot change the source code.

But there is a really cool feature of the GNU linker to solve that problem. It allows to ‘wrap’ around any symbol or function, including the ones in the standard library. That way I can add my mode to the printf() code as a wrapper, for example adding a timestamp for every call.

In the example below you can see this in action:

printf() calls with added timestamps

In this article I’ll show how you can wrap any function with custom code.

Continue reading

LittleFS File System with MCU Internal FLASH Memory

In many of my embedded projects I need persistent data or storage for settings. If using an SD card, then FatFS is usually my choice for the file system. But if using an external FLASH memory device, then my preferred choice is usually LittleFS: it is a little fail-safe filesystem, designed for micro-controllers, which I’m using with external flash memory devices.

In the case where there is enough MCU flash, or if there is no external FLASH device available in a design, it can use the MCU internal FLASH as storage storage too. This is the topic of this article:

LittleFS File System Data
Continue reading

‘Nicer Coding’: Ligatures with Eclipse and Visual Studio Code

The choice of IDE is sometimes given by the available tools at hand. And sometimes it is a preference of the look and feel. Or maybe just what one is used to use. And sometimes small changes can make a big difference too.

For example, when I’m starring at my code for hours, a nice font can make all the difference. A cool and nice feature of fonts are ‘Ligatures‘. Maybe you can you can spot them in the following screenshot?

Eclipse with Ligatures
Continue reading

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

LinkServer for Microcontrollers

GDB is the de-facto debugging engine and debug connection for micro-controllers these days: it is versatile and with its client-server architecture very flexible and powerful, and pretty much every debug probe and vendor (PEMICRO, SEGGER, OpenOCD, pyOCD, …) offers it. But a GDB server or command line implementation was not available for the NXP LinkServer family of debug probes (LPC-Link, MCU-Link, MCU-Link Pro). This has changed now: LinkServer is available as command line tool and can be used as GDB Server:

LinkServer as GDB Server with Eclipse

With the new LinkServer package I do not only get a gdb server implementation: I have now a command line tool I can use for automation and all kind of different things: programming boards, erasing flash, and so on.

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