Position-Independent Code with GCC for ARM Cortex-M

Welcome to ‘Alice in Wonderland‘! For a university research project using an ARM Cortex-M33 we are evaluating position-independent code as way to load applications or part of it with a bootloader. It sounds simple: just add -fPIC to the compiler settings and you are done.

Unfortunately, it is not that simple. That option opened up a ‘rabbit hole’ with lots of wonderful, powerful and strange things. Something you might not have been aware of what could be possible with the tools you have at hand today. Leading to the central question: how is position-independent code going to work with an embedded application on an ARM Cortex-M?

Let’s find out! Let’s start a journey through the wonderland…

Continue reading

Placing Code in Sections with managed GNU Linker Scripts

Managed linker scripts are great on one side: the simplify the otherwise complex GNU linker script handling. On the other side it requires knowledge how to tweak them in case ‘non-standard’ behavior is needed.

Continue reading

Using FatFS and MinINI with the NXP LPC55S16 EVK

For a research project we selected the NXP LPC55S16 but because it has due the silicon shortage it is not available probably for the next 52 weeks (yikes!) we can use the EVK Board.

The FatFS file system from Elm Chan is the de-facto file system for many embedded systems. As such it comes integrated with silicon vendor SDKs like the NXP MCUXpresso SDK. The problem is that the SDK only has examples for things on the board, and because that board does not have a SD card socket, no example for using FatFS with an SDK card is provided :-(. So I had to create one, and you can get it from GitHub.

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

Upgrade to a new NXP MCUXpresso SDK

As time flies by, my projects are evolving. My lab projects get used over multiple semesters, and the MCUXpresso projects by default use the SDK version used at that time.

This is great because I do want to have control over what SDK is used. But from time to time it makes sense to upgrade a project to a newer version. In this post I’ll show how an existing project can be upgraded to use a new SDK.

Continue reading

New MCUXpresso IDE v11.3.1

NXP has released an updated version of the Eclipse based MCUXpresso IDE: the V11.3.1 is an update of the v11.3.0 I wrote about it back in January this year.

The release includes new device support, and beside of bug fixes includes a few new things.

Continue reading

Enhancing Binary Utilities in MCUXpresso IDE

The NXP MCUXpresso IDE has a nice context menu for executing different actions on a binary in the Eclipse Project Explorer View:

Binary Utilities

What it makes it even nicer: I can configure and use it to do anything I like. For example I can convert files and copy it in one action.

Continue reading

Touch & Build: Auto-Update of Firmware Date and Time

It is very valuable to have a date and time information in the binary. That way for example using a shell I can check the version of the firmware running on a device, or it can be printed on a console or UART as needed.

Firmware Date and Time

Firmware Date and Time

Continue reading

Error for ‘implicit function declaration’ Warning in C

“A young man is smoking one cigarette after each other without a pause. An elderly woman observes that and says: “Young man, you are smoking like crazy! Don’t you know that there is a warning on each cigarette package that this can kill you?” The young man finishes his cigarette, looks at the elderly person and says: “Yes, I know. But look, I’m a programmer, and it is only a warning.”

I don’t smoke, and I do pay attention to warnings :-). I always try to keep my source code free of compiler warnings. And I always pay special attention to the following on:

implicit declaration of function

implicit declaration of function

Continue reading