Tag: programming

Nuttx on Linux

Posted by April 2, 2014

If you are also working with Nuttx, you will love the “sim” configuration. It will allow running a minimal version of Nuttx as a regular program on a linux machine (assuming 86x_64).

Before getting the sources and building anything you will need the 32-bit version of the GCC and the following libraries that can be installed like this:

sudo apt-get install -y gcc-multilib libc6-dev-i386 lib32z1-dev

After installing there is a final thing you need to fix on your own (see this launchpad ticket)

sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include

Now get the Nuttx sources using git like this:

git clone http://git.code.sf.net/p/nuttx/git nuttx.git

First thing after getting the sources is to run the configure script (a bit different from the well known ./configure) to setup the build directory for the target hardware. In our case the target will be the native machine for which the “sim” configuration has been created (see nuttx/configs/sim).

To configure the build setup for target “sim” with “nsh” as the application to run on start, run:

cd nuttx.git/nuttx/tools
./configure.sh sim/nsh
cd ..

Last step before building is the configure the image. This is done by calling

make menuconfig

There is at least one setting that needs to be enabled:

– System Type —> [*] Build 32-bit simulation on 64-bit machine

You are now ready to build the image

make

If there was no problem during the build you will find a “nuttx” file in the same directory. Just run it and you will see the NSH prompt.

./nuttx

lzoDSO – todo for today: timer driver

Posted by June 11, 2013

Will work on the timer driver code (legacy and fresh one) to allow selection of the actual hardware timer to use (the on-chip ones that are part of the ATmega series micro controllers).

When things are working, I’ll be able to finally enable the test signal output on the front panel controller board of the lzoDSO.

lzoDSO – legacy firmware … evolving

Posted by May 22, 2013

oscilloscopeYeah! We have finally managed to fix some stupid things, related the the firmware used for our lzoDSO scope. There where files missing (which had been referenced by the Makefile but where outside of the projects repository) and loads of files in either the wrong place or simply cruft.

The files have now been added (which should allow anyone to build the firmware) and things have been cleaned up slightly. There is still much work, so be sure you will find spots in the source that have a smell. I have also documented the fuse-bits that are configured in the micro controller used.

Ah .. note, after having the missing files in the project, these “sub-projects” have their own dependency which is CppUTest in that case (this is a dependency to be proud of I think). So make sure you have CppUTest on your machine and your users environment set up with the corresponding variables (see the Software page in the lzoDSO wiki for details on how to setup the build environment).

test-driven development for embedded systems


Found a nice article at embedded.com on how mocking can help build more robust and clear code. The article talks about development using C/C++ and the Unity unit testing framework which I have been using for quiet a while (thanks to the book “Test-Driven Development for Embedded C” by James Grenning).