# NuttX RTOS

Last Updated: December 6, 2008

# Table of Contents

| Overview. What is NuttX? Look at all those files and features... How can it be a tiny OS?
| Downloads. Where can I get NuttX? What is the current development status?
| Supported Platforms. What target platforms has NuttX been ported to?
| Development Environments. What kinds of host cross-development platforms can be used with NuttX?
| Memory Footprint. Just how big is it? Do I have enough memory to use NuttX?
| Licensing. Are there any licensing restrictions for the use of NuttX? (Almost none) Will there be problems if I link my proprietary code with NuttX? (No)
| Release History What has changed in the last release of NuttX? What unreleased changes are pending in CVS?
| Bugs, Issues, Things-To-Do. Software is never finished nor ever tested well enough. (Do you want to help develop NuttX? If so, send me an email).
| Other Documentation. What other NuttX documentation is available?
| Trademarks. Some of the words used in this document belong to other people.

# Overview

Goals. Nuttx is a real timed embedded operating system (RTOS). Its goals are:

| Small Footprint
| Usable in all but the tightest micro-controller environments, The focus is on the tiny-to-small, deeply embedded environment.
| Rich Feature OS Set

The goal is to provide implementations of most standard POSIX OS interfaces to support a rich, multi-threaded development environment for deeply embedded processors.

NON-GOALS: (1) It is not a goal to provide the rich level of OS features like those provided with Linux. Small footprint is more important than features. Standard compliance is more important than small footprint. (2) There is no MMU-based support for processes. At present, NuttX assumes a flat address space.

| Highly Scalable
| Fully scalable from tiny (8-bit) to moderate embedded (32-bit). Scalability with rich feature set is accomplished with: Many tiny source files, link from static libraries, highly configurable, use of weak symbols when available.
| Standards Compliance

NuttX strives to achieve a high degree of standards compliance. The primary governing standards are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS's are adopted for functionality not available under these standards or for functionality that is not appropriate for the deeply-embedded RTOS (such as `fork()`).

Because of this standards conformance, software developed under other standard OSs (such as Linux) should port easily to NuttX.

| Real-Time
| Fully pre-emptible, fixed priority and round-robin scheduling.
| Totally Open
| Non-restrictive BSD license.

Feature Set. Key features of NuttX include:

| Standards Compliant Core Task Management

- Modular, micro-kernel

- Fully pre-emptible.

- Naturally scalable.

- Highly configurable.

- Easily extensible to new processor architectures, SoC architecture, or board architectures. A Porting Guide is in development.

- FIFO and round-robin scheduling.

- Realtime, deterministic.

- POSIX/ANSI-like task controls, named message queues, counting semaphores, clocks/timers, signals, pthreads, environment variables, filesystem.

- VxWorks-like task management and watchdog timers.

- BSD socket interface.

- Extensions to manage pre-emption.

- Well documented in the NuttX User Guide.

| File system

- Tiny in-memory, root pseudo-file-system.

- Supports character and block drivers.

- Network, USB (device), serial, CAN, driver architecture.

- RAMDISK, pipes, FIFO, `/dev/null`, `/dev/zero` drivers.

- Mount-able volumes. Bind mountpoint, filesystem, and block device driver.

- FAT12/16/32 filesystem support.

- Generic driver for SPI-based MMC/SD cards.

- ROMFS filesystem support.

| C Library

- Fully integrated into the OS.

| Networking

- TCP/IP, UDP, ICMP stacks.

- Small footprint (based on uIP).

- BSD compatible socket layer.

- Networking utilities (DHCP, SMTP, TELNET, TFTP, HTTP)

| USB Device Support

- Gadget-like architecture for USB device controller drivers and device-dependent USB class drivers.

- USB device controller drivers available for the NXP LPC214x and TI DM320.

- Device-dependent USB class drivers available for USB serial and for USB mass storage.

- Built-in USB trace functionality for USB debug.

| Graphics Support

- Framebuffer drivers.

- NX: A graphics library, tiny windowing system and tiny font support. Documented in the NX Graphics Subsystem manual.

NuttX Add-Ons. The following packages are available to extend the basic NuttX feature set:

| NuttShell (NSH)

- A small, scalable, bash-like shell for NuttX with rich feature set and small footprint. See the NuttShell User Guide.

| Pascal Compiler with NuttX runtime P-Code interpreter add-on

- The Pascal add-on is available for download from the SourceForge website.

Look at all those files and features... How can it be a tiny OS?. The NuttX feature list (above) is fairly long and if you look at the NuttX source tree, you will see that there are hundreds of source files comprising NuttX. How can NuttX be a tiny OS with all of that?

| Lots of Features -- More can be smaller!

The philosophy behind that NuttX is that lots of features are great... BUT also that if you don't use those features, then you should not have to pay a penalty for the unused features. And, with NuttX, you don't! If you don't use a feature, it will not be included in the final executable binary. You only have to pay the penalty of increased footprint for the features that you actually use.

Using a variety of technologies, NuttX can scale from the very tiny to the moderate-size system. I have executed NuttX with some simple applications in as little as 32Kb total memory (code and data). On the other hand, typical, richly featured NuttX builds require more like 64Kb (and if all of the features are used, this can push 100Kb).

| Many, many files -- More really is smaller!

One may be intimidated by the size NuttX source tree. There are hundreds of source files! How can that be a tiny OS? Actually, the large number of files is one of the tricks to keep NuttX small and as scalable as possible. Most files contain only a single function. Sometimes just one tiny function with only a few lines of code. Why?

- Static Libraries. Because in the NuttX build processed, objects are compiled and saved into static libraries (archives). Then, when the file executable is linked, only the object files that are needed are extracted from the archive and added to the final executable. By having many, many tiny source files, you can assure that no code that you do not execute is ever included in the link. And by having many, tiny source files you have better granularity -- if you don't use that tiny function of even just a few lines of code, it will not be included in the binary.

| Other Tricks

As mentioned above, the use of many, tiny source files and linking from static libraries keeps the size of NuttX down. Other tricks used in NuttX include:

- Configuration Files. Before you build NuttX, you must provide a configuration file that specifies what features you plan to use and which features you do not. This configuration file contains a long list of settings that control what is built into NuttX and what is not. There are hundreds of such settings (see the NuttX Porting Guide for a partial list that excludes platform specific settings). These many, many configuration options allow NuttX to be highly tuned to meet size requirements. The downside to all of these configuration options is that it greatly complicates the maintenance of NuttX -- but that is my problem, not yours.
- Weak Symbols The GNU toolchain supports weak symbols and these also help to keep the size of NuttX down. Weak symbols prevent object files from being drawn into the link even if they are accessed from source code. Careful use of weak symbols is another trick for keep unused code out of the final binary.

# Downloads

nuttx-0.4.0. The 32nd release of NuttX (nuttx-0.4.10) is available for download from the SourceForge website. The change log associated with the release is available here. Unreleased changes after this release are available in CVS. These unreleased changes are listed here.

This release adds graphics support and a tiny windowing subsystem. That new graphics subystem is documented in a user manual. No other substantial changes were made.

The version number was bumped up to 0.4.0 in part to reflect the new graphics subsystem, but also to recognize the NuttX is approaching complete functionality. In the 0.3.x versions, network support was added, Pascal P-code runtime support was added, FAT and ROMFS filesystems were added, MMC/SD and USB device support were added. There were also numerous extensions to the NuttShell, NuttX APIs, and architecture ports.

These changes were verified only on the NuttX simulation platform with X11 windows simulating a device framebuffer. Please report any errors to me.

# Supported Platforms

| Linux User Mode
| A user-mode port of NuttX to the x86 Linux/Cygwin platform is available. The purpose of this port is primarily to support OS feature development. STATUS: Does not support interrupts but is otherwise fully functional.
| ARM7TDMI.
| TI TMS320C5471 (also called C5471 or TMS320DA180 or DA180). NuttX operates on the ARM7 of this dual core processor. This port uses the Spectrum Digital evaluation board with a GNU arm-elf toolchain* under Linux or Cygwin. STATUS: This port is complete, verified, and included in the initial NuttX release.

NXP LPC214x. Support is provided for the NXP LPC214x family of processors. In particular, support is provided for the mcu123.com lpc214x evaluation board (LPC2148). This port also used the GNU arm-elf toolchain* under Linux or Cygwin.

STATUS: This port boots and passes the OS test (examples/ostest). The port is complete and verified. As of NuttX 0.3.17, the port includes: timer interrupts, serial console, USB driver, and SPI-based MMC/SD card support. A verified NuttShell (NSH) configuration is also available.

STMicro STR71x. Support is provided for the STMicro STR71x family of processors. In particular, support is provided for the Olimex STR-P711 evaluation board. This port also used the GNU arm-elf toolchain* under Linux or Cygwin.

STATUS: Coding is complete on the basic port (boot logic, system time, serial console), but no testing has been performed due to some problems I am having with my JTAG wiggler and OpenOCD on Linux.

| ARM926EJS.

TI TMS320DM320 (also called DM320). NuttX operates on the ARM9 of this dual core processor. This port uses the Neuros OSD with a GNU arm-elf toolchain* under Linux or Cygwin.

STATUS: The basic port (timer interrupts, serial ports, network, framebuffer, etc.) is complete. All implemented features have been verified with the exception of the USB device-side driver; that implementation is complete but completely untested.

| 8052 Microcontroller

PJRC 87C52 Development Board. This port uses the PJRC 87C52 development system and the SDCC toolchain under Linux or Cygwin.

STATUS: This port is complete but not stable with timer interrupts enabled. There seems to be some issue when the stack pointer enters into the indirect IRAM address space during interrupt handling. This architecture has not been built in some time will likely have some compilation problems because of SDCC compiler differences.

| Renesas/Hitachi SuperH

SH-1 SH7032. This port uses the Hitachi SH-1 Low-Cost Evaluation Board (SH1_LCEVB1), US7032EVB, with a GNU arm-elf toolchain* under Linux or Cygwin.

STATUS: This port is available as of release 0.3.18 of NuttX. The port is basically complete and many examples run correctly. However, there are remaining instabilities that make the port un-usable. The nature of these is not understood; the behavior is that certain SH-1 instructions stop working as advertised. This could be a silicon problem, some pipeline issue that is not handled properly by the gcc 3.4.5 toolchain (which has very limit SH-1 support to begin with), or perhaps with the CMON debugger. At any rate, I have exhausted all of the energy that I am willing to put into this cool old processor for the time being.

| Zilog Z16F
| Zilog z16f Microncontroller. This port use the Zilog z16f2800100zcog development kit and the Zilog ZDS-II Windows command line tools. The development environment is Cygwin under WinXP. STATUS: The initial release of support for the z16f was made available in NuttX version 0.3.7.
| Zilog eZ80 Acclaim!
| Zilog eZ80Acclaim! Microncontroller. This port uses the ZiLOG ez80f0910200kitg development kit, eZ80F091 part and the Zilog ZDS-II Windows command line tools. The development environment is Cygwin under WinXP. STATUS: This is a work in progress. Verified ez80 support will be announced in a future NuttX release.
| Zilog Z8Encore!

Zilog Z8Encore! Microncontroller. This port uses the either:

- Zilog z8encore000zco development kit, Z8F6403 part, or
- Zilog z8f64200100kit development kit, Z8F6423 part

and the Zilog ZDS-II Windows command line tools. The development environment is Cygwin under WinXP.

STATUS: This release has been verified only on the ZiLOG ZDS-II Z8Encore! chip simulation as of nuttx-0.3.9.

| Zilog Z80
| Z80 Instruction Set Simulator. This port uses the SDCC toolchain under Linux or Cygwin (verified using version 2.6.0). This port has been verified using only a Z80 instruction simulator. That simulator can be found in the NuttX CVS here. STATUS: This port is complete and stable to the extent that it can be tested using an instruction set simulator.
| Other ports
| There are partial ports for the TI TMS320DM270 and for MIPS.

> * A highly modified buildroot is available that may be used to build a NuttX-compatible ELF toolchain under Linux or Cygwin. Configurations are available in that buildroot to support ARM, m68k, m68hc11, m68hc12, and SuperH ports.

# Development Environments

| Linux + GNU make + GCC/binutils

The is the most natural development environment for NuttX. Any version of the GCC/binutils toolchain may be used. There is a highly modified buildroot available for download from the NuttX SourceForge page. This download may be used to build a NuttX-compatible ELF toolchain under Linux or Cygwin. That toolchain will support ARM, m68k, m68hc11, m68hc12, and SuperH ports. The buildroot CVS may be accessed in the NuttX CVS.

| Linux + GNU make + SDCC
| Also very usable is the Linux environment using the SDCC compiler. The SDCC compiler provides support for the 8051/2, z80, hc08, and other microcontrollers. The SDCC-based logic is less well exercised and you will likely find some compilation issues if you use parts of NuttX with SDCC that have not been well-tested.
| Cygwin + GNU make + GCC/binutils
| This combination works well too. It works just as well as the native Linux environment except that compilation and build times are a little longer. The custom NuttX buildroot referenced above may be build in the Cygwin environment as well.
| Cygwin + GNU make + SDCC
| I have never tried this combination, but it would probably work just fine.
| Cygwin + GNU make + Windows Native Toolchain

This is a tougher environment. In this case, the Windows native toolchain is unaware of the the Cygwin sandbox and, instead, operates in the native Windows environment. The primary difficulties with this are:

- Paths. Full paths for the native toolchain must follow Windows standards. For example, the path `/home/my\ name/nuttx/include` my have to be converted to something like `'C:\cygwin\home\my name\nuttx\include'` to be usable by the toolchain.

Fortunately, this conversion is done simply using the `cygpath` utility.

- Symbolic Links NuttX depends on symbolic links to install platform-specific directories in the build system. On Linux, true symbolic links are used. On Cygwin, emulated symbolic links are used. Unfortunately, for native Windows applications that operate outside of the Cygwin sandbox, these symbolic links cannot be used.

The NuttX make system works around this limitation by copying the platform specific directories in place. These copied directories make work a little more complex, but otherwise work well.

At present, on the Zilog Z16F port uses a native Windows toolchain (the Zilog ZDS-II toolchain). </p. </td>

| Other Environments?

The primary environmental dependency of NuttX are (1) GNU make, (2) bash scripting, and (3) Linux utilities (such as sed). If you have other platforms that support GNU make or make utilities that are compatible with GNU make, then it is very likely that NuttX would work in that environment as well (with some porting effort). If GNU make is not supported, then some significant modification of the Make system would be required.

# Memory Footprint

C5471 (ARM7) The build for this ARM7 target that includes most of the OS features and a broad range of OS tests. The size of this executable as given by the Linux `size` command is (3/9/07):

       text    data     bss     dec     hex filename
      53272     428    3568   57268    dfb4 nuttx

DM320 (ARM9) This build for the ARM9 target includes a significant subset of OS features, a filesystem, Ethernet driver, full TCP/IP, UDP and (minimal) ICMP stacks (via uIP) and a small network test application: (11/8/07, configuration netconfig, examples/nettest)

       text    data     bss     dec     hex filename
      49472     296    3972   53740    d1ec nuttx

Another build for the ARM9 target includes a minimal OS feature set, Ethernet driver, full TCP/IP and (minimal) ICMP stacks, and a small webserver: (11/20/07, configuration uipconfig, examples/uip)

       text    data     bss     dec     hex filename
      52040      72    4148   56260    dbc4 nuttx

87C52 A reduced functionality OS test for the 8052 target requires only about 18-19Kb:

    Stack starts at: 0x21 (sp set to 0x20) with 223 bytes available.

    Other memory:
       Name             Start    End      Size     Max
       ---------------- -------- -------- -------- --------
       PAGED EXT. RAM                         0      256
       EXTERNAL RAM     0x0100   0x02fd     510     7936
       ROM/EPROM/FLASH  0x2100   0x6e55   19798    24384

# Licensing

NuttX is available under the highly permissive BSD license. Other than some fine print that you agree to respect the copyright you should feel absolutely free to use NuttX in any environment and without any concern for jeopardizing any proprietary software that you may link with it.

# Release History

The current NuttX Change Log is available in CVS here. ChangeLog snapshots associated with the current release are available below.

| Change Logs for All NuttX Releases
| ChangeLog for Current Releases
| Unreleased Changes

ChangeLog for Current Release

    nuttx-0.4.0 2008-12-06 Gregory Nutt <spudmonkey@racsa.co.cr>
    	* Initial release of a tiny windowing system for NuttX
    	* Add fixed precision sin() and cos() (not well tested at initial check-in)
    	* Add an X11-based simulated framebuffer driver
    	* The simulated target now has an option (CONFIG_SIM_WALLTIME) that will let the simulation
    	  run in more-or-less realtime.
    	* Added more more extensive window support:  frames, toolbars, etc.
    	* Added support for bitmap fonts
    	* Integrated the new font support with a font test in examples/nx
    	* Add documentation for NX graphics subsystem

    pascal-0.1.2 2008-02-10 Gregory Nutt <spudmonkey@racsa.co.cr>

    	* Add logic to build and link with the ZDS-II toolchain
    	  use with the z16f.
    	* Make sure that POFF header structures are aligned
    	* Standardized POFF file format to big-endian
    	* Break up large switch statements to lower complexity
    	  and eliminate a compiler bug
    	* Changes so that runtime compiles with SDCC.

    buildroot-0.1.2 2007-11-06 <spudmonkey@racsa.co.cr>

    	* Support for m68k-elf and m68hc11 toolchain
    	* Add patch to build older binutils with newer Texinfo version
    	* Add support for SH-1 toolchain

Unreleased Changes

    nuttx-0.4.1 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>

    pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>

    buildroot-0.1.3 2008-xx-xx <spudmonkey@racsa.co.cr>

    	* Add support for H8/300 toolchain

# Bugs, Issues, Things-To-Do

The current list of NuttX Things-To-Do in CVS here. A snapshot of the To-Do list associated with the current release are available here.

# Other Documentation

| User Guide
| Porting Guide
| NuttShell (NSH)
| NX Graphics Subsystem
| Change Log
| To-Do List

# Trademarks

- ARM, ARM7 ARM7TDMI, ARM9, ARM926EJS are trademarks of Advanced RISC Machines, Limited.
- Cygwin is a trademark of Red Hat, Incorporated.
- Linux is a registered trademark of Linus Torvalds.
- LPC2148 is a trademark of NXP Semiconductors.
- TI is a tradename of Texas Instruments Incorporated.
- UNIX is a registered trademark of The Open Group.
- VxWorks is a registered trademark of Wind River Systems, Incorporated.
- ZDS, ZNEO, Z16F, Z80, and Zilog are a registered trademark of Zilog, Inc.

NOTE: NuttX is not licensed to use the POSIX trademark. NuttX uses the POSIX standard as a development guideline only.