Getting Started with NuttX -- LM3S6965-EK (Ubuntu Linux)

This guide is based on NuttX revision 5544 date 20130121, and using an Ubuntu 12.04 (64-bits) development machine. It is not an exhaustive guide, but should be useful for those starting with NuttX on the LM3S6965-EK.

Note that NuttX has a thorough documentation through this website, this wiki, and the README files in the source code. This Guide was strongly based on documentation available at:

Building NuttX

1. The first step is to obtain the code from the Downloads page. When this guide was written, the code was obtained as follows:

svn checkout svn:// nuttx-code
cd nuttx-code/nuttx

2. Configure NuttX for the LM3S6963-EK

We're going to configure NuttX to use the nsh shell.

tools/ lm3s6965-ek/nsh

3. Install the kconfig-frontends package

# Install kconfig-frontends dependencies (the upcoming configure may catch more dependencies)
sudo apt-get install gperf libncurses5-dev
git clone tools
cd tools/kconfig-frontends/
./configure --enable-mconf --disable-gconf --disable-qconf
sudo make install

4. Install the buildroot toolchain

# Install buildroot dependencies (the upcoming configure may catch more dependencies)
sudo apt-get install libgmp-dev libgmp3-dev libmpfr-dev libmpc-dev

The GMP version from the previous packages might not be enough for gcc-4.6.3, it's better to obtain the latest from In my case, this was enough:

mkdir --parents $HOME/temp
cd $HOME/temp
tar xzvf gmp-4.3.2.tar.gz 
cd gmp-4.3.2/
sudo make install
# optional cleanup: rm -rf $HOME/temp/gmp-4.3.2*

Then you're ready to install buildroot.

git clone buildroot
cd buildroot
cp configs/cortexm3-eabi-defconfig-4.6.3 .config
make menuconfig # and just exit

5. Configure NuttX to use buildroot


# Be sure you have: 
#   Build Setup
#     `--> Build Host Platform (Linux)
#   System Type
#     `--> Toolchain Selection (Buildroot (Cygwin or Linux))
#     `--> [ ] OABI (vs EABI)  # De-select
make menuconfig

# Set the environment
export TOOLCHAIN_BIN=<path to buildroot binaries>

6. Build


After you build, you'll have generated a nuttx.bin file.

Installing NuttX

The installation is based on the openocd tool.

1. Connect your LM3S6965-EK to your development PC.

Connect your board to your computer, using both the USB cable and the Ethernet cable.

2. Start the openocd daemon

Install openocd.

sudo apt-get install openocd

There's a helper script and a configuration file available at nuttx/configs/lm3s6965-ek/tools. The configuration file ek-lm3s6965.cfg is based on the already existing files provided by openocd:

  • /usr/share/openocd/scripts/interface/luminary.cfg
  • /usr/share/openocd/scripts/board/ek-lm3s6965.cfg
  • /usr/share/openocd/scripts/target/stellaris.cfg

To start the openocd daemon:

configs/lm3s6965-ek/tools/ $PWD

3. Connecting GDB

For this step you need GDB, it's no particularly important which one you use, whether arm-nuttx-elf-gdb or one provided by a CodeSourcery toolchain like arm-none-eabi-gdb.

(gdb) target remote localhost:3333
(gdb) symbol-file nuttx
(gdb) monitor reset
(gdb) monitor halt
(gdb) load nuttx

4. Using nsh

Now you can connect to your board using a tool like termnet and termnetd. This is my configuration for the USB port in /etc/termnetd.conf

3001:on:/dev/ttyUSB0:B115200   CLOCAL IGNBRK CS8 CREAD;

When you're done configuring termnetd, you can restart the termnetd service to load the new configurations:

sudo service termnetd restart


termnetd localhost 3001

You can then reboot your board and watch it boot until you get your nsh line:

nsh> ls

See Also