Tuesday, April 22, 2014

AutoBuild is a build automation tool for Visual Studio

Updated to version

AutoBuild is a build automation tool written using PowerShell on PSake.

It is usefull to automate the Visual Studio processes of:
  • Build
  • Clean
  • UnitTest
  • Release binary
  • Release source
  • Version number updating
It can be configured using the AutoBuilder.config.ps1 file.

You can find the tool code, and a sample project in the download link below. The sample configuration file is pretty explicative, you will find instruction on how it works as self-contained comments.


  • fixed a problem with Windows 10 and robocopy parameter, added the .vs exclusion to src file release
  • fixed the AssemblyInfo.cs version update method
  • improved the release folder management, now release are organized in subfolder; added some usefull build scripts
  • add remove building folders (bin and obj); added the build debug and release facility; improved the version numbering update method
  • first release


  • read risk disclaimer
  • excuse my bad english

Saturday, April 5, 2014

SD card logger library with log rotation that fits on ATmega8

This library implements an SD card Data Logger that runs on ATmega.
It has a small footprint, so it can be loaded on an ATmega8, leaving space for user code.
It supports SD and microSD cards formatted with FAT16.
It also features log rotation.

The "Petit FAT File System Module" by ChaN (http://elm-chan.org/fsw/ff/00index_p.html) it is used to write on SD card. I've used the Petit library because i would like to build a small footprint logger. Even if it has a few limitations, those can be circumvented.

We had to format the card we would like to use with FAT16, and then load it with a predefined number of empty files of a know dimension. Once we have files on the card, we can write on those files.
You can create empty files by using the python helper provided in code.
Firmware side we will setup the file dimension, and file number. File dimension, can not be greater than 2^16 bytes because a uint16_t type variable it is used to store this information, also max number of files it is limited to 256, becayse a uint8_t variable it is used.

Given the number of files used by the logger and every file size, we just have to record the last written position and the file number we are using to implements the log rotation. When a file is filled up with logged data, it skips to the next one, if the file is the last one, we go back to first.
Note that Petit FAT File System Module write files using blocks, so the "seek to position" can be used only on the block dimension. Typically a block is 512 bytes.

Power loss failure are managed by recording to eeprom the above parameters every 60 seconds (you can setup this timing option in code). When power get's back, the logger will use the last file and position recorded.
File write failure will cause the file to skip to the next log file.

The sample code provided just logs time + a string.
Date and time are obtain using a DS1307 chip. In the code you can also find a python helper to configure date and time through UART.

The SD card board, is an ebay cheap one, it basically just has voltage regulation to prevent the SD card to be damaged.

You can find schematics below:

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 8MHz.


  • read risk disclaimer
  • excuse my bad english