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

ARM SWO ITM Console Bidirectional Standard I/O Retargeting

The ARM Cortex M architecture has many features which are underused, probably simply because engineers are not aware of it. SWO (Single Wire Output) is a single trace pin of the ARM Cortex-M CoreSight debug block. trace pin uses the ITM (Instruction Trace Macrocell) on ARM Cortex. It provides a serial output channel, at a high speed higher than the usual UART, because it is clocked at half or a quarter of the core clock frequency, depending on the core and implementation.

As such, it is an ideal high speed output channel to send text or data to the host. This is how it is usually used, but what is unknown to many: it can be used in a bidirectional way with the help of the debugger.

The topic of this article: how to redirect standard I/O like printf() or scanf() using the SWO ITM console: means both sending *and* receiving data over the SWO debug channel: that way I can use it as a kind of UART with a single pin only.

Continue reading

Standalone SWO

SWO (Single Wire Output) in ARM cores is probably one of the most under-used features. Which is surprising, because SWO can be very useful. In a nut shell: SWO is a single wire output pin/signal channel which can provide lots of different data, like PC sampling for coverage information, interrupt tracing data or ‘uart-like’ text packets.

SWO output from application
Continue reading

Visual Studio Code for C/C++ with ARM Cortex-M: Part 4 – Debug

The previous parts were about installation, project setup and building. This one is about debugging an ARM Cortex-M Microcontroller with Visual Studio Code:

Cortex-M4 (NXP K22FN512) Debugging with Visual Studio Code
Continue reading

Visual Studio Code for C/C++ with ARM Cortex-M: Part 3 – Build

This is the third part in a series to get up and running using the Microsoft Visual Studio Code for embedded development on ARM Cortex-M. So far we have installed the needed tools, created a project and are able to build it from the command line. Now it is about how execute directly scripts or the build from the IDE.

Building with a Visual Studio Code Task
Continue reading

Visual Studio Code for C/C++ with ARM Cortex-M: Part 1 – Installation

For a few months I’m learning and using Rust. I’m still learning, but I’m very impressed by the powerful and cool programming language, the vibrant ecosystem, the advanced concepts behind it and by the tools. With learning Rust I have been using the Visual Studio Code IDE and it works great for Rust. But I was wondering: could I use it for my ‘usual’ C/C++ development on ARM Cortex-M devices too? The answer is a clear ‘yes’, and this mini series of articles should get you up and running too.

Continue reading

New MCU-Link Debug Probe from NXP

The NXP MCUXpressso IDE Release V11.2.1 gave a hint about a coming new debug probe, the MCU-Link which is available now:

MCU-Link debugging the LPC845-BRK Board

MCU-Link in 3D printed enclosure debugging the LPC845-BRK Board

Continue reading

OpenPnP Solder Dispenser Sneak Preview

Many of you are aware of that DIY Pick&Place machine build documented in “Building a DIY SMT Pick&Place Machine with OpenPnP and Smoothieboard (NXP LPC1769)“.

That machine has now been modified to dispense solder paste. I did not had time yet to describe the build, but as I have received recently many questions: here are some pre-information about the build:

Solder Paste Dispenser

Solder Paste Dispenser

Continue reading

Tutorial: First Steps with Embedded Artists NXP i.MX RT1052 OEM Module

Not ready for the complexity of a full blown Embedded Linux, but need that extra compute performance? Need an ARM Cortex-M7 running at 600 MHz module on a half-sized business card, ready to be integrated? Here we go: the Embedded Artists i.MX RT1052 OEM module:

Embedded Artists NXP i.MX RT1052 OEM Module

Embedded Artists NXP i.MX RT1052 OEM Module

Compute modules are very common in the Embedded Linux space, for example see this Toradex module. The reason is simple: these high-performance boards simplify the design, as I don’t have to care about the BGA packages and the external SDRAM and FLASH devices: everything is on a module I can easily integrate into my base board.

Continue reading

Tutorial: Catching Rogue Memory Accesses with ARM Watchpoint Comparators and Instruction Trace

In my “Tutorial: Catching Rogue Memory Accesses with Eclipse and GDB Watchpoints” I have used Eclipse/CDT and GDB watchpoints.  I used a conditional watchpoint, but this comes with a performance hit. In this article I show how to use the ARM Cortex trace hardware to catch specific writes to a memory location. Without severe performance degradation. But for this I need a little helper: the DEADBEEF catcher!

0xdeadbeef catcher

0xdeadbeef catcher

Continue reading