Why and how to enable ARM Thumb-2 instruction set in Yocto

The ARM Thumb-2 instruction set is not a new thing. In fact it was announced already in 2003. Yet, the standard ARM instruction set is often still used because it is the default option, while Thumb-2 could be a better alternative. This post explains why the Thumb-2 can be a better option for many applications and also how to configure it in Yocto build system for Linux kernel, system libraries, utilities and user binaries. Continue reading “Why and how to enable ARM Thumb-2 instruction set in Yocto”

Access hardware from userspace with mmap – Atmel SAMA5D3x programming mode case study

I was working with a device that used Atmel SAMA5D3x MCU. Sometimes the devices needed to be re-flashed which required putting the MCU to programming mode. However, the device enclosure needed to be opened and also a jumper wire was needed to do this. Then I realized that it would be possible to enter the programming mode directly from Linux by manipulating boot sequence controller registers in the MCU. Writing a dedicated device driver for this seemed like an overkill so I wrote a simple utility application with mmap instead.

Continue reading “Access hardware from userspace with mmap – Atmel SAMA5D3x programming mode case study”

Using local MQTT broker for cloud and interprocess communication

Recently I was working on an embedded Linux IoT device that communicated with cloud using MQTT protocol. The software in the device was divided into multiple applications that also required interprocess communication. We ended up using MQTT also for the local communication, and it turned out to be a good decision. Continue reading “Using local MQTT broker for cloud and interprocess communication”

Improved git CLI with git-completion and git-prompt

Git-completion and git-prompt are scripts that provide versatile completion support as well as visualization of current branch and status when working from the command line. Even though I work with git daily I hadn’t bumped into these scripts until quite recently. They have proven to be very useful, so I decided to share this tip. Continue reading “Improved git CLI with git-completion and git-prompt”

How to use TPM for encryptions

Trusted platform module (TPM) is a secure element that can be used to securely generate and store keys. It has many possible uses, one of which is encryption of sensitive data. This article describes how to use TPM on Linux environment to encrypt different types of data, how to encrypt filesystem partitions and how to bind the encryption with device state.

Continue reading “How to use TPM for encryptions”

Free books for Linux kernel enthusiasts

In the true open-source spirit, the authors of some great Linux kernel books have decided to make these books freely available for everyone. They are good material for anyone interested in the Linux kernel, and also a good reference for professionals working with the kernel. At least I have personally found these books very useful.

Continue reading “Free books for Linux kernel enthusiasts”

The missing rootwait

Rootwait is a Linux kernel command line parameter that makes the kernel wait (indefinitely) for a root device to show up. This can be useful for devices that are detected asynchronously such as USB or MMC medias. This post, however, is not really about rootwait. Instead, it is about something that every programmer have and will encounter.
Continue reading “The missing rootwait”

How to create master boot record (MBR) file on Linux

Usually when working with USB thumb drives, memory cards and hard drives, the partitioning can be easily done just by plugging them to a Linux (or Windows) PC and using a partitioning application such as fdisk. However, with embedded devices it is sometimes more practical to write the partition table to a file instead of directly writing it to the memory device. This can be the case with embedded MMC (eMMC) memories which are soldered directly to the device and cannot be connected to a PC for partitioning.

Continue reading “How to create master boot record (MBR) file on Linux”