Category Archives: Useful tools

Eclipse with avr eclipse plugin

Eclipse can be used for Arduino and avr embedded development with avr-gcc. There is a nice plugin for it: http://avr-eclipse.sourceforge.net/

The plugin parses the output of some command line program to provide some properties and settings in eclipse. When the system local is not english, this cannot be parsed correctly. The simple fix is to run eclipse with the english locale.

Just create a script with:

#!/bin/bash
LC_MESSAGES=C eclipse

valgrind error – profiling timer expired

Nothing new and nothing surprising, but it still was painful to find out:
Do not use valgrind or helgrind in combination with the c++ compiler options -p and -pg for profiling.

This gave me some strange behavior of my app with sleeps not sleeping. I only had a crashing application, no clue what might be wrong with my code and the error message “Profiling timer expired”.

Just switch off the profiling options and everything was find, except the errors that I wanted valgrind to find for me.

G-code from svg files

Again I spent some time searching for free tools to improve my cnc toolchain. I stumbled upon two simple but helpful flash programs for handling g-code files:

  1. Makercam (http://www.makercam.com/)
    This tool loads svg files and generates g-code toolpaths from it. I can create programs for drilling, pockets, outlines and follow path operations. There are only two things to keep in mind when using it:

    • The svg file may only contain a single path. However this is not a big problem, because you can create such svg files easily using inkscape. Just combine all paths and then save it.
    • Makercam assumes a resolution of 72 dpi when importing a svg file. Inkscape produces files, that have 90 dpi. To fix this open the preferences of Makercam and replace 72 by 90 dpi before loading any svg.
  2. G-code viewer (http://www.buildlog.net/gview/index.html)
    This tool offers a quick way to inspect your g-code files before sending them to a cnc mill. Just drag the g-code file onto the browser window. All rendering is done locally without transferring your file to a server.

Measuring execution times in .NET

C#

var watch = Stopwatch.StartNew();
// the code that you want to measure comes here
watch.Stop();
var elapsedMs = watch.ElapsedMilliseconds;

Taken from: http://stackoverflow.com/questions/14019510/calculate-the-execution-time-of-a-method

Merge multiple pdfs into a single file

Ubuntu brings a nice package called “pdftk” for editing pdfs using the command line. This command joins multiple pdfs into a single pdf:

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

Here is another way to join pdf files, that only requires ghostscript:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=123.pdf 1.pdf 2.pdf 3.pdf