Categories
Uncategorized

Microcontroller (MCU) or Microprocessor (MPU)?

As technology advances, there are two basic processing platforms for implementing embedded systems. The first is the Microcontroller Unit (MCU). These devices have varying amounts of integrated Flash (<= 2MB) and RAM (<= 1MB), and are designed to run bare-metal code or a real-time operating system (RTOS), like FreeRTOS. The second is the Linux-capable Microprocessor Unit (MPU). An example of an MCU based system is most Arduinos, and an example of an MPU based system is the Raspberry PI. An MPU typically does not have embedded Flash and RAM — at least on the same die. The fundamental difference between MCU/RTOS and MPU/Linux systems is the memory architecture and the amount of memory in the system.

Categories
Uncategorized

Getting started with Embedded Linux

Recently I was asked by a developer, who has done windows development for 10 years, how to get started with Embedded Linux. Embedded Linux covers a lot of ground and includes a broad range of components/skills to put together an entire system. Below are a few suggestions.

Categories
Uncategorized

Git, Versioning, and Branching for Embedded Linux Development

When building a product using Linux, versioning and branching of your software is an important consideration. Everyone’s needs are different depending on the size of the team, culture, and testing requirements, so there is no one size that fits all. However, after working on a number of different projects for a dozen or so different companies, there are several practices that are often used.

Categories
Uncategorized

Separation of Source and Build Directories

As we work with larger and more complex systems (i.e. Linux), more and more of our time is spent on integration and pulling different pieces together.  We often need to debug or understand code we did not write — especially in build systems.  To work effectively in this scenario you must be able to quickly search through a lot of source code.  Therefore, we are always looking for ways to make this more efficient.

Categories
Uncategorized

Understanding the NXP i.MX6UL Pin Mux (Part 2)

In the previous post, it was noted that bit 30 needs to be set in the i.MX6UL pad config if you want to read the state of a GPIO output. Digging into this a bit more, we find the following text in the Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt file:

SION(1 << 30): Software Input On Field.
Force the selected mux mode input path no matter of MUX_MODE functionality. By default the input path is determined by functionality of the selected mux mode (regular).

Categories
Uncategorized

Understanding the NXP i.MX6UL Pin Mux

(note, the article is also applicable to the i.MX6ULL as these processors are very similar)

The NXP i.MX6UL application processor has a very flexible pin multiplexer, that is somewhat difficult to understand at first glance.  Most times when we’re configuring the pin mux in Linux, we modify Device Tree files, so perhaps that is the place to start.  The pin mux options for the i.MX6UL are defined in the arch/arm/boot/dts/imx6ul-pinfunc.h file.  The arguments to the macros in this file are defined as:

/*
 * The pin function ID is a tuple of
 * <mux_reg conf_reg input_reg mux_mode input_val>
 */
Categories
Uncategorized

Why Git?

Some time back, I gave a presentation that included an overview of the Git version control system.  I still occasionally get asked why Git should be used instead of Subversion, as it seems harder at first.  Most developers don’t really understand Git until they have used it for awhile, and then they will have an “aha moment.”  There are 3 features of Git that are especially interesting to me:

  1. many repositories (vs. one large repository)
  2. distributed development
  3. cheap branches
Categories
Uncategorized

Using Go in place of a Spreadsheet

Recently I needed to calculate NAND partition tables for a project where we will be supporting a number of different flash parts from 500MB to 2GB.  I first tried this in a spreadsheet, but found it difficult to work easily with hex numbers and do the calculations I needed.  I then looked into options for formatting text in columns from a program and found the nice text/tabwriter Go library.  With a few lines of code, I was then able to get the below output, which is quite easy to read.  The only tricky part was figuring out that for right justified data, you need to:

  1. not use tabs for the padding character
  2. add a trailing \t in the input data
Categories
Uncategorized

Using Docker for OE/Yocto builds

Why Docker?  When using OE to build software for products, we often run into the scenario where software needs to be built using the same version of OpenEmbedded over the course of several years.  Production builds need to be predictable.  We’ve also observed that old versions of OE often break as new Linux distros come out.  This is just the result of the complexity of building tool chains.  Additionally, for predictable builds you really don’t want to be changing the build OS.  This requirement automatically rules out Arch Linux, Debian Unstable, Gentoo, etc as production build machines.  Additionally, having developers debug OE build issues on varying workstation distributions is frustrating and time consuming.

Categories
Uncategorized

Go Language for Embedded ARM Linux Systems

In the quest for technologies that work well for embedded Linux systems, I recently gave Go another try.  The last time I tried this was very early on and there were some floating point issues on ARM that appear to be fixed now.  Having spent a few days porting an existing application to Go, there is a lot to like about Go.

Categories
Uncategorized

OpenEmbedded / Yocto Usage Survey

Recently, I sent a survey to the OpenEmbedded and Yocto mail lists asking a series of questions about how they use OE.  38 people responded.  The average number of years using OE is 4.8 years.

Categories
Uncategorized

Best practices for using CMake in OpenEmbedded/Yocto

I’ve already written about using autotools and qmake in OE.  With recent projects, we’re using CMake to build most C/C++ components.  Like any good tool, CMake has a learning curve, but it seems to do its job quite well.  Below are examples of a CMake build file, and corresponding OE recipe.

Categories
Uncategorized

Library sizes for C vs C++ in an embedded Linux system

Is the size of the libraries required for C++ (vs C) a concern in Embedded Linux systems?  Most Embedded Linux systems likely include some C++ code, so this is probably not even a decision we need to make in many cases.  However, often there is a need for a small initramfs that is used as part of the boot process (perhaps for software updates) before switching to the main root file system.  In this case, it makes sense to keep the initramfs as small as possible, and we might be concerned here with the size of C++ libraries.

Categories
Uncategorized

Why systemd in Embedded Linux Systems?

Recently I was asked why use systemd vs sysvinit in embedded systems?  There are many discussions on this, and really most of the reasons people use it for servers and desktops are also valid for embedded systems.  Lennart Poettering’s articles explain very well why you might want to consider systemd.  A few things that rank high on my list:

Categories
Uncategorized

Setting up an OpenEmbedded Package Feed Server

With the BEC OE build template, you can easily set up an opkg feed server that serves up packages from your build directory.  This allows you to easily install new packages during development, without generating and reflashing an entire image.  To use:

On workstation:

  • edit local.sh, and define MACHINE_IP to point to your target machine, and re-run “source envsetup.sh”.  Alternatively, you can export the MACHINE_IP variable in your environment.
  • run: oe_setup_feed_server
  • run: oe_feed_server

On target system:

  • opkg update
  • opkg install <some package>

Opkg will install dependencies, so if you have a complex package, this is so much easier than copying over an opkg file manually, and figuring out you need 6 other packages as dependencies.