Category Archives: Software

Inline AES 256 / CBC Implementation

Today I like to share some encryption code, which can be used in various situations – and is also useful for embedded systems.

It is a unique implementation of the AES 256 / CBC crypto algorithm. The goal of this implementation was neither speed nor size. It was written to inline it into existing code.

The compiler will create a new instance of the algorithm on the fly, at the place where you insert it into the code. Depending of used optimization flags, this inlined code can get very compact.


I had numerous goals and constraints while I created this implementation:

  • Completely inline.
  • Generated by the compiler on the fly.
  • Easy to read and understand.
  • Suitable for embedded processors.
  • No static tables (S-Box) in memory or the binary.
  • Minimal dependencies (just stdint and cstddef headers).
  • Compatible with other AES 256 / CBC implementation.

The following things were not relevant to me:

  • Speed
  • Size
  • Multiple algorithms
  • Error checking of inputs

Requirements and Usage

The requirements are very minimal, all what you need is a C++17 compatible compiler which provides the stdint and cstddef headers for the uint32_t types and the size_t type.

Continue reading Inline AES 256 / CBC Implementation

New Application: Micro Disk

I published a new application to create “Micro Disk” images for embedded projects with very limited resources. This format fits perfectly on SD cards and it can be read with minimal effort.

The application is available as binary for macOS and Windows. The sources are available on GitHub which can be easily compiled for Linux.

The features of the Micro Disk format are:

  • File directory with ASCII file names.
  • Single file list which can store any number of files.
  • For each file, a name, the start block and the size in bytes is stored.
  • All files are stored in sequential blocks which makes reading simple and fast.
  • All files are aligned to the 512 byte blocks for a SD card.

Read more about the application, downloads and all details about the format.

Screenshots of the applications:

More Features Added To “Font To Byte” App

While working on the display driver for the Sharp display, I found some missing features in my “Font to Byte” application. I added this features and released a new version.

  • All bits can be inverted.
  • There is an option to print the converted characters into a useful code chart.

Driver Progress

A first version of the driver is running. It requires only ~160 bytes RAM to run. You can change the font easily, use up to 128 characters and invert any portion of the screen (e.g. for selections).

New Character Map

After converting the font into bytes, you can click the “Print Character Map…” button to generate a nice character map for your font.

New Character Map Button

This is especially useful if you added some special character. With the map you can easily lookup the correct values for the characters.

You can also save the character map as PDF from the print dialog and use the PDF as reference.

Continue reading More Features Added To “Font To Byte” App

Convert Bitmap Fonts for LCD Displays with Style

Update 2015-09-05: Added a example font and Adobe Photoshop template.

Currently I am working on the deluxe version of the data logger. This version has a LCD screen and capacitive buttons to control the software. The Adafruit library for the display is quite large and almost uses the whole RAM, because it is a pixel oriented library. My own implementation is a text only library using 8×8 pixel characters. This simplify everything and reduces the RAM costs.


To convert the bitmap font into bytes, I wrote a small application for OS X (minimum version 10.10). It accepts a PNG image with the characters in it and converts it into bytes with the correct bits set.

FontToBytes Screen 1

First you select the mode on the left side of the application window. In this example the mode is set to “8×8 Fixed Top-Down”. Select the output format in the bottom left corner of the window.

Now drag your font file onto the area on the right side. If the dragged file is accepted, the window turns blue.

Continue reading Convert Bitmap Fonts for LCD Displays with Style

A New Library for Meggy Jr RGB

I planed to create a game as a gift and use the really great Meggy Jr RGB platform for it. See the picture above, it’s a great game machine powered by the ATmega328P (buy it here). You can use the Arduino IDE to program it.

After assembling the device, I played a little bit around with the provided library — but was a bit disappointed by the library. This is a game device after all, but the library lack in my opinion some important things a game library need.

So I wrote a new library from scratch, using the provided schema and documentation (you can see the printed out schema in the background of the picture). Sometimes its better to start from scratch and learn from the mistakes of other libraries.

Today I release the first version of the library at GitHub here: It has a proper API documentation and a few examples. I release this early, but hope to improve the documentation and add examples while I develop the actual game.

Download the release v1.2 as a ZIP

Continue reading A New Library for Meggy Jr RGB