Table of Contents
Running NuttX on Sparrow
This is a tutorial on how to run the NuttX ROTS on the Sparrow platform.
NuttX
Nuttx is a RTOS with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 32-bit micro controller environments, the primary governing standards in NuttX are POSIX and ANSI.
Nuttx is very flexible when it comes to communication protocols. It supports a wide range of protocols from low power ones like 6LoWPAN for radio network drivers (IEEE 802.15.4 MAC and generic packet radios), Radio Network Drivers: IEEE 802.15.4 MAC, Generic Packet Radio, Bluetooth LE. But also more advanced protocols like IEEE 802.11 FullMac, IPv4, IPv6, TCP/IP, UDP, ARP, ICMP, ICMPv6, IGMPv2 (client) stacks.
Memory allocation on this RTOS is grouped into standard heap memory allocation, granule allocator, shared memory, and dynamically sized, per-process heaps. Depending on what platform you chose to run Nuttx, you can adapt this memory allocator to use the appropriate amount of memory.
This RTOS is made to be portable and works with most of the ARM processors, 8-bit Atmel architecture and more. It also has a large number of drivers already implemented, but it has not yet fully been ported to the Sparrow's microcontroller, ATmega128RFA1.
When it comes to multi-threading and scheduling, Nuttx is the most advanced one, having implemented a few scheduling algorithms like FIFO, round-robin, and “sporadic” scheduling.
NuttX uses a flash-aware file system which handles all the operations with the memory and makes it transparent to the user. It is a filesystem that has been designed to work primary with small, serial NOR type flash parts that are 1M byte to 16M byte in size (though this is not a limitation). The filesystem operates by segmenting the flash (or flash partition) into “logical sectors” of equal size and then managing them (allocating, mapping, chaining, releasing, etc.) to build files and directories.
Nuttx also provides an optional small, scalable, bash-like shell with rich feature set and small footprint used for debugging, configuration and launching applications.
Setup
- Install Packets
sudo apt-get install build-essential git texinfo libgmp-dev libmpfr-dev libmpc-dev libncurses5-dev bison flex gettext gperf libtool autoconf pkg-config libftdi-dev libusb-1.0-0-dev zlib1g zlib1g-dev python-yaml gcc-avr avr-libc avrdude
- Install NuttX Tools
clone tools repo: https://github.com/jodersky/nuttx/tree/master/misc/tools cd tools/kconfig-frontends ./configure --enable-mconf LD_RUN_PATH=/usr/local/lib make make install
- Get NuttX for Sparrow
git clone git@bitbucket.org:vanbarbascu/nuttx_sparrow.git cd nuttx_sparrow
- Configure and Build
LD_LIBRARY_PATH=/usr/local/lib/ tools/configure.sh -l -a apps sparrow_4.1/nsh make
- Flash to board
tools/flash.sh --port /dev/ttyUSB0
Connecting to the serial port gives us the NuttxShell.
screen /dev/ttyUSB0