Building NuttX for ZKit-ARM-1769

The ZKit-ARM-1769 board comes with a pre-compiled NuttX library. This library is sufficient most application development requirements. But advanced users might want to fine tune NuttX, to their project requirements. This article shows how to build NuttX applications from source for the ZKit-ARM-1769.

Toolchain

The GCC ARM toolchain is provided as part of the BSP. The toolchain has to be installed before compiling the NuttX source code.

Getting NuttX

Create a folder called nuttx-dev for NuttX development.

$ mkdir nuttx-dev

Download the following files from the NuttX SourceForge Download page, to the nuttx-dev folder.

  • nuttx-6.27.tar.gz - contains NuttX RTOS

  • apps-6.27.tar.gz - contains sample applications

Extract the tar balls as shown below. nuttx-6.27 and apps-6.27 folder should be inside the same directory, in our case nuttx-dev.

$ tar --gunzip -x -f nuttx-6.27.tar.gz
$ tar --gunzip -x -f apps-6.27.tar.gz
$ mv nuttx-6.27 nuttx
$ mv apps-6.27 apps

After unpacking the apps tarball, you will have two directories side by side like this:

           nuttx-dev
               |
        +------+------+
        |             |
      nuttx/        apps/

This is important because the NuttX build for specific application will expect to find the apps directory in that (default) location.

Configuring NuttX

The folder configs/zkit-arm-1769 corresponds to our target board. Within each board folder, board specific code is located within src. Pre-canned NuttX configurations to run test applications is available under the following sub-folders.

  • hello - Hello world application

  • nsh - NuttShell application

NuttX can be built for a specific test application by selecting one of the above pre-canned configurations. A script called configure.sh is available for this purpose, under nuttx/tools. The script has to be invoked with the board name and test application name as argument, as shown below.

# Make sure you are in nuttx-dev/nuttx
$ pushd tools
$ ./configure.sh zkit-arm-1769/hello
$ popd

Building NuttX

While invoking make, we will have to tell NuttX to use the CodeSourcery toolchain, by setting CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL to y, and disable the Buildroot toolchain, by setting CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT to n.

Invoke make, to build NuttX for the selected target board
application. Here we have configured NuttX for pre-canned hello application.

$ make CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL=y CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=n

Finally, we get nuttx.hex, that can be flashed on to the board.