NXP MCU-Link for Rust with probe-rs

The Rust programming language is making its way into the embedded world, and getting more and more popular and not only at the Lucerne University. With Rust, the probe-rs is one of the popular debug choices, as it nicely comes with cargo. On the hardware side, the NXP MCU-Link is $15 debug probe hardware I use for many targets. Why not using the MCU-Link with probe-rs and Rust?

MCU-Link Board Top Side
MCU-Link Board Top Side
Continue reading

How to make sure no floating point code is used

Float and double data types area a bad choice for embedded applications. At least in most applications, and can or should be avoided, even with hardware FPU support present.

But how can I be sure that no floating point operations are used?

wrapping float and double runtime routines

This article describes how to configure the GNU toolchain, so that no float or double operations are used, with the example of ARM Cortex-M. What I do? ‘Poisoning’ (!!!) the source code, force the gcc compiler to use software floating point operations and then catch them with the GNU linker :-).

Continue reading

Binary, do you use Hard-Float or Soft-Float?

Many cost-sensitive ARM Cortex-M devices like the M0+ do not have a hardware floating point unit, and some like the M4 only has an optional single-precision floating point unit (FPU). As outlined in “Be aware: Floating Point Operations on ARM Cortex-M4F“, using floating point operations without a hardware unit can be costly.

Looking at the disassembly for sure will tell you if the hardware is handling the float or double operation or not:

Disassembly showing runtime routines

But who wants check the all the disassembly? With the GNU tools there is an easier way: readelf.

Continue reading

‘Experience Energy’ at the Verkehrshaus: The ‘House of Energy’ Construction Kit

The ‘Verkehrshaus der Schweiz‘, the ‘Swiss Museum of Transport’ is Switzerland’s most popular museum.

In April 2023, it opened up a new building and the ‘Experience Energy!’ exhibition. For the opening event we created a unique construction kit to explore energy: from harvesting to storing and up to distributing and using energy.

“House of Energy” at the Swiss Museum of Transport in Lucerne
Continue reading

Power Measurement with INA260 Sensor

For a research project and demonstrator at HSLU university I have to measure voltage a DC voltage and current. For this I’m planning to use the Texas Instrument Texas Instruments INA260, so I had to quickly develop a software driver for it.

TI INA260 Power Sensor Breakout Board
Continue reading

Modern On-Target Embedded System Testing with CMake and CTest

One key element of a CI/CD pipeline is the automatic testing phase: whenever I check in new source code or manually trigger it, I can run a test suite to make sure that the changes do not break anything. For this, I have to run automated tests. For an an embedded target, it means that I have to run some tests on the board itself too.

CTest with VS Code
Continue reading

GNU Coverage (gcov) for an Embedded Target with VS Code

An important part of every CI/CD pipeline is having a testing phase. In this article I show how to use GNU gcov (coverage) with an embedded target, using Visual Studio Code as front end:

GNU gcov with VS Code

With this, I can run the code on the embedded target which stores the coverage data on the host.

Continue reading

“No Kit Selected”: Fixing VS Code CMake Kit Assignment

One important thing in using VS Code and CMake projects is that one needs to have a CMake kit assigned to the project. But after a restart of VS Code or if I re-load a project, VS Code has lost the previously assigned CMake kit:

VS Code has forgotten about the previously assigned CMake Kit?

This is very annoying, but luckily I have found a fix for this.

Continue reading

Implementing File I/O Semihosting for the RP2040 and VS Code

I’m working recently on a new lecture module using the Raspberry Pi Pico (RP2040) board, which highlights several aspects of modern software engineering, including DevOps and CI/CD. An important part of any CI/CD pipeline is testing. For a host application, one could pass arguments to the application, e.g. ‘myapp --test=module1‘, or let it read such information from a configuration file which describes the tests. Or write GNU gcov data to a file to collect coverage information.

Unfortunately, a normal embedded application has no argv[], and many system have no file system. A solution to this problem would be using semihosting with file I/O. Unfortunately for the Raspberry Pi Pico SDK 1.5.1 for the RP2040, there is no semihosting file I/O implemented :-(.

I have now implemented and added file I/O to the SDK, making it possible for the RP2040 to access and use files on the host, among other things. This greatly extends the capabilities of the device, and is very useful for testing, including gathering test coverage information.

RP2040 writing files on the host with semihosting
Continue reading