Newer
Older
<table width ="100%">
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i>
</font></big></h1>
<p>Last Updated: December 1, 2011</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<h1>Table of Contents</h1>
</td>
</tr>
</table>
<a href="#Introduction">1.0 Introduction</a><br>
<a href="#DirectoryStructure">2.0 Directory Structure</a>
<ul>
<a href="#DirStructDocumentation">2.1 Documentation</a></br>
<a href="#DirStructArch">2.2 arch/</a>
<a href="#archdirectorystructure">2.2.1 Subdirectory Structure</a><br>
<a href="#summaryofarchfiles">2.2.2 Summary of Files</a><br>
<a href="#supportedarchitectures">2.2.3 Supported Architectures</a>
<a href="#DirStructBinFmt">2.3 binfmt/</a><br>
<a href="#DirStructConfigs">2.4 configs/</a>
<a href="#configsdirectorystructure">2.4.1 Subdirectory Structure</a><br>
<a href="#summaryofconfigfiles">2.4.2 Summary of Files</a>
<a href="#boardlogic">2.4.2.1 Board Specific Logic</a><br>
<a href="#boardconfigsubdirs">2.4.2.2 Board Specific Configuration Sub-Directories</a>
<a href="#supportedboards">2.4.3 Supported Boards</a>
<a href="#DirStructDrivers">2.5 nuttx/drivers/</a><br>
<a href="#DirStructFs">2.6 nuttx/fs/</a><br>
<a href="#DirStructGraphics">2.7 nuttx/graphics/</a><br>
<a href="#DirStructInclude">2.8 nuttx/include/</a><br>
<a href="#DirStructLib">2.9 nuttx/lib/</a><br>
<a href="#DirStructLibXX">2.10 nuttx/libxx/</a><br>
<a href="#DirStructMm">2.11 nuttx/mm/</a><br>
<a href="#DirStructNet">2.12 nuttx/net</a><br>
<a href="#DirStructSched">2.13 nuttx/sched/</a><br>
<a href="#DirStructSyscall">2.14 nuttx/syscall/</a><br>
<a href="#DirStructTools">2.15 nuttx/tools/</a><br>
<a href="#DirStructNetUtils">2.17 apps/netutils</a><br>
<a href="#DirStructNshLib">2.18 apps/nshlib</a><br>
</ul>
<a href="#configandbuild">3.0 Configuring and Building</a>
<a href="#configuringnuttx">3.1 Configuring NuttX</a><br>
<a href="#buildingnuttx">3.2 Building NuttX</a>
<a href="#imports">4.1 APIs Exported by Architecture-Specific Logic to NuttX</a>
<ul>
<a href="#upinitialize">4.1.1 <code>up_initialize()</code></a><br>
<a href="#upidle">4.1.2 <code>up_idle()</code></a><br>
<a href="#upinitialstate">4.1.3 <code>up_initial_state()</code></a><br>
<a href="#upcreatestack">4.1.4 <code>up_create_stack()</code></a><br>
<a href="#upusestack">4.1.5 <code>up_use_stack()</code></a><br>
<a href="#upreleasestack">4.1.6 <code>up_release_stack()</code></a><br>
<a href="#upunblocktask">4.1.7 <code>up_unblock_task()</code></a><br>
<a href="#upblocktask">4.1.8 <code>up_block_task()</code></a><br>
<a href="#upreleasepending">4.1.9 <code>up_release_pending()</code></a><br>
<a href="#upreprioritizertr">4.1.10 <code>up_reprioritize_rtr()</code></a><br>
<a href="#_exit">4.1.11 <code>_exit()</code></a><br>
<a href="#upassert">4.1.12 <code>up_assert()</code></a><br>
<a href="#upschedulesigaction">4.1.13 <code>up_schedule_sigaction()</code></a><br>
<a href="#upallocateheap">4.1.14 <code>up_allocate_heap()</code></a><br>
<a href="#upinterruptcontext">4.1.15 <code>up_interrupt_context()</code></a><br>
<a href="#updisableirq">4.1.16 <code>up_disable_irq()</code></a><br>
<a href="#upenableirq">4.1.17 <code>up_enable_irq()</code></a><br>
<a href="#upprioritizeirq">4.1.18 <code>up_prioritize_irq()</code></a></br>
<a href="#upputc">4.1.19 <code>up_putc()</code></a></br>
<a href="#systemtime">4.1.20 System Time and Clock</a>
</ul>
<a href="#exports">4.2 APIs Exported by NuttX to Architecture-Specific Logic</a>
<ul>
<a href="#osstart">4.2.1 <code>os_start()</code></a><br>
<a href="#listmgmt">4.2.2 OS List Management APIs</a><br>
<a href="#schedprocesstimer">4.2.3 <code>sched_process_timer()</code></a><br>
<a href="#irqdispatch">4.2.4 <code>irq_dispatch()</code></a>
</ul>
<a href="#demandpaging">4.3 On-Demand Paging</a><br>
<a href="#ledsupport">4.4 LED Support</a>
<ul>
<a href="#ledheaders">4.3.1 Header Files</a><br>
<a href="#leddefinitions">4.3.2 LED Definitions</a><br>
<a href="#ledapis">4.3.3 Common LED interfaces</a>
</ul>
<a href="#NxFileSystem">5.0 NuttX File System</a><br>
<a href="#DeviceDrivers">6.0 NuttX Device Drivers</a>
<ul>
<a href="#chardrivers">6.1 Character Device Drivers</a><br>
<a href="#blockdrivers">6.2 Block Device Drivers</a><br>
<a href="#blockdrivers">6.3 Specialized Device Drivers</a>
<ul>
<a href="#ethdrivers">6.3.1 Ethernet Device Drivers</a><br>
<a href="#spidrivers">6.3.2 SPI Device Drivers</a><br>
<a href="#i2cdrivers">6.3.3 I2C Device Drivers</a><br>
<a href="#serialdrivers">6.3.4 Serial Device Drivers</a><br>
<a href="#fbdrivers">6.3.5 Frame Buffer Drivers</a><br>
<a href="#lcddrivers">6.3.6 LCD Drivers</a><br>
<a href="#mtddrivers">6.3.7 Memory Technology Device Drivers</a><br>
<a href="#sdiodrivers">6.3.8 SDIO Device Drivers</a><br>
<a href="#usbhostdrivers">6.3.9 USB Host-Side Drivers</a><br>
<a href="#usbdevdrivers">6.3.10 USB Device-Side Drivers</a><br>
<a href="#analogdrivers">6.3.11 Analog (ADC/DAC) Drivers</a>
<a href="#pwrmgmt">6.4 Power Management</a>
<ul>
<a href="#pmoverview">6.4.1 Overview</a><br>
<a href="#pminterfaces">6.4.2 Interfaces</a><br>
<a href="#pmcallbacks">6.4.3 Callbacks</a>
</ul>
<a href="#apndxconfigs">Appendix A: NuttX Configuration Settings</a><br>
<a href="#apndxtrademarks">Appendix B: Trademarks</a>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<h1>1.0 <a name="Introduction">Introduction</a></h1>
</td>
</tr>
</table>
This document provides and overview of the NuttX build and configuration
logic and provides hints for the incorporation of new processor/board architectures
See also <code>arch/README.txt</code> and <code>configs/README.txt</code>.
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<h1>2.0 <a name="DirectoryStructure">Directory Structure</a></h1>
</td>
</tr>
</table>
<p>
<b>Directory Structure</b>.
The general directly layout for NuttX is very similar to the directory structure
of the Linux kernel -- at least at the most superficial layers.
At the top level is the main makefile and a series of sub-directories identified
below and discussed in the following paragraphs:
</p>
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|- nuttx
| |-- <a href="#topmakefile">Makefile</a>
| |-- <a href="#DirStructDocumentation">Documentation</a>
| | `-- <i>(documentation files)</i>/
| |-- <a href="#DirStructArch">arch</a>/
| | |-- <i><arch-name></i>/
| | | |-- include/
| | | | |--<i><chip-name></i>/
| | | | | `-- <i>(chip-specific header files)</i>
| | | | |--<i><other-chips></i>/
| | | | `-- <i>(architecture-specific header files)</i>
| | | `-- src/
| | | |--<i><chip-name></i>/
| | | | `-- <i>(chip-specific source files)</i>
| | | |--<i><other-chips></i>/
| | | `-- <i>(architecture-specific source files)</i>
| | `-- <i><other-architecture directories></i>/
| |-- <a href="#DirStructBinFmt">binfmt</a>/
| | |-- Makefile
| | |-- <i>(binfmt-specific sub-directories)</i>/
| | | `-- <i>(binfmt-specific source files)</i>
| | `-- <i>(common binfmt source files)</i>
| |-- <a href="#DirStructConfigs">configs</a>/
| | |-- <i><board-name></i>/
| | | |-- include/
| | | | `-- <i>(other board-specific header files)</i>
| | | |-- src/
| | | | `-- <i>(board-specific source files)</i>
| | | |---<i><config-name></i>/
| | | | `-- <i>(board configuration-specific source files)</i>
| | | `---<i>(other configuration sub-directories for this board)</i>/
| | `-- <i><(other board directories)></i>/
| |-- <a href="#DirStructDrivers">drivers</a>/
| | |-- Makefile
| | |-- <i>(driver-specific sub-directories)/</i>
| | | `-- <i>(driver-specific source files)</i>
| | `-- <i>(common driver source files)</i>
| |-- <a href="#DirStructFs">fs</a>/
| | |-- Makefile
| | |-- <i>(file system-specific sub-directories)</i>/
| | | `-- <i>(file system-specific source files)</i>
| | `-- <i>(common file system source files)</i>
| |-- <a href="#DirStructGraphics">graphics</a>/
| | |-- Makefile
| | |-- <i>(feature-specific sub-directories)</i>/
| | | `-- <i>(feature-specific source files library source files)</i>
| | `-- <i>(common graphics-related source files)</i>
| |-- <a href="#DirStructInclude">include</a>/
| | |-- <i>(standard header files)</i>
| | |-- <i>(standard include sub-directories)</i>
| | | `-- <i>(more standard header files)</i>
| | |-- <i>(non-standard include sub-directories)</i>
| | `-- <i>(non-standard header files)</i>
| |-- <a href="#DirStructLib">lib</a>/
| | |-- Makefile
| | `-- <i>(lib source files)</i>
| |-- <a href="#DirStructLibXX">libxx</a>/
| | |-- Makefile
| | `-- <i>(libxx management source files)</i>
| |-- <a href="#DirStructMm">mm</a>/
| | |-- Makefile
| | `-- <i>(memory management source files)</i>
| |-- <a href="#DirStructNet">net</a>/
| | |-- Makefile
| | |-- uip/
| | | `-- <i>(uip source files)</i>
| | `-- <i>(BSD socket source files)</i>
| |-- <a href="#DirStructSched">sched</a>/
| | |-- Makefile
| | `-- <i>(sched source files)</i>
| |-- <a href="#DirStructSysCall">syscall</a>/
| | |-- Makefile
| | `-- <i>(syscall source files)</i>
| `-- <a href="#DirStructTools">tools</a>/
| `-- <i>(miscellaneous scripts and programs)</i>
`- apps
|-- <a href="#DirStructNetUtils">netutils</a>/
| |-- Makefile
| |-- <i>(network feature sub-directories)</i>/
| | `-- <i>(network feature source files)</i>
| `-- <i>(netutils common files)</i>
|-- <a href="#DirStructNshLib">nshlib</a>/
| |-- Makefile
| `-- <i>NuttShell (NSH) files</i>
|-- <i>(Board-specific applications)</i>/
| |-- Makefile
| |-- <i>(Board-specific application sub-directories)</i>/
| | `-- <i>(Board-specific application source files)</i>
| `-- <i>(Board-specific common files)</i>
`-- <a href="#DirStructExamples">examples</a>/
`-- <i>(example)</i>/
|-- Makefile
`-- <i>(example source files)</i>
<p>
<b>Configuration Files</b>.
The NuttX configuration consists of:
</p>
<ul>
<li>
<i>Processor architecture specific files</i>.
These are the files contained in the <code>arch/</code><i><arch-name></i><code>/</code> directory
and are discussed in a paragraph <a href="#archdirectorystructure">below</a>.
</li>
<li>
<i>Chip/SoC specific files</i>.
Each processor processor architecture is embedded in chip or <i>System-on-a-Chip</i> (SoC) architecture.
The full chip architecture includes the processor architecture plus chip-specific interrupt logic,
clocking logic, general purpose I/O (GIO) logic, and specialized, internal peripherals (such as UARTs, USB, etc.).
<p>
These chip-specific files are contained within chip-specific sub-directories in the
<code>arch/</code><i><arch-name></i><code>/</code> directory and are selected via
the <code>CONFIG_ARCH_name</code> selection.
</p>
</li>
<li>
In order to be usable, the chip must be contained in a board environment.
The board configuration defines additional properties of the board including such things as
peripheral LEDs, external peripherals (such as network, USB, etc.).
<p>
These board-specific configuration files can be found in the
<code>configs/</code><i><board-name></i><code>/</code> sub-directories and are discussed
<p>
General documentation for the NuttX OS resides in this directory.
</p>
<h2>2.2 <a name="DirStructArch">nuttx/arch</a></h2>
<h3><a name="archdirectorystructure">2.2.1 Subdirectory Structure</a></h3>
<p>
This directory contains several sub-directories, each containing
architecture-specific logic.
The task of porting NuttX to a new processor consists of
add a new subdirectory under <code>arch/</code> containing logic specific
to the new architecture.
The complete board port in is defined by the architecture-specific code in this
directory (plus the board-specific configurations in the <code>config/</code>
subdirectory).
Each architecture must provide a subdirectory, <i><arch-name></i>
under <code>arch/</code> with the following characteristics:
<i><arch-name></i>/
|-- include/
| |--<i><chip-name></i>/
| | `-- <i>(chip-specific header files)</i>
| |--<i><other-chips></i>/
| |-- arch.h
| |-- irq.h
| |-- types.h
`-- src/
|--<i><chip-name></i>/
| `-- <i>(chip-specific source files)</i>
|--<i><other-chips></i>/
|-- Makefile
`-- <i>(architecture-specific source files)</i>
<h3><a name="summaryofarchfiles">2.2.2 Summary of Files</a></h3>
<li>
<code>include/</code><i><chip-name></i><code>/</code>
This sub-directory contains chip-specific header files.
</li>
<li>
<code>include/arch.h</code>:
This is a hook for any architecture specific definitions that may
be needed by the system. It is included by <code>include/nuttx/arch.h</code>.
</li>
<li>
<code>include/types.h</code>:
This provides architecture/toolchain-specific definitions for
standard types. This file should <code>typedef</code>:
<ul><code>
patacongo
committed
_int8_t, _uint8_t, _int16_t, _uint16_t, _int32_t, _uint32_t_t
patacongo
committed
<p>and if the architecture supports 24- or 64-bit integers</p>
patacongo
committed
_int24_t, _uint24_t, int64_t, uint64_t
patacongo
committed
NOTE that these type names have a leading underscore character. This
file will be included(indirectly) by include/stdint.h and typedef'ed to
the final name without the underscore character. This roundabout way of
doings things allows the stdint.h to be removed from the include/
directory in the event that the user prefers to use the definitions
provided by their toolchain header files
</p>
<p>
And finally
</p>
<ul><code>
irqstate_t
</code></ul>
<p>
Must be defined to the be the size required to hold the interrupt
enable/disable state.
</p>
<p>
This file will be included by include/sys/types.h and be made
available to all files.
</p>
</li>
<li>
<code>include/irq.h</code>:
This file needs to define some architecture specific functions (usually
inline if the compiler supports inlining) and some structures. These include:
<ul>
<li>
<code>struct xcptcontext</code>:
This structures represents the saved context of a thread.
</li>
<li>
<code>irqstate_t irqsave(void)</code>:
Used to disable all interrupts.
</li>
<li>
Used to restore interrupt enables to the same state as before <code>irqsave()</code> was called.
</li>
</ul>
<p>
This file must also define <code>NR_IRQS</code>, the total number of IRQs supported
by the board.
</p>
</li>
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<li>
<code>include/syscall.h</code>:
This file needs to define some architecture specific functions (usually
inline if the compiler supports inlining) to support software interrupts
or <i>syscall</i>s that can be used all from user-mode applications into
kernel-mode NuttX functions.
This directory must always be provided to prevent compilation errors.
However, it need only contain valid function declarations if the architecture
supports the <code>CONFIG_NUTTX_KERNEL</code> configuration.
<ul>
<li>
<code>uintptr_t sys_call0(unsigned int nbr)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with no (additional) parameters.
</li>
<li>
<code>uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with one (additional) parameter.
</li>
<li>
<code>uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1, uintptr_t parm2)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with two (additional) parameters.
</li>
<li>
<code>uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with three (additional) parameters.
</li>
<li>
<code>uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with four (additional) parameters.
</li>
<li>
<code>uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with five (additional) parameters.
</li>
<li>
<code>uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6)</code>:
<code>nbr</code> is one of the system call numbers that can be found in <code>include/sys/syscall.h</code>.
This function will perform a system call with six (additional) parameters.
</li>
</ul>
<p>
This file must also define <code>NR_IRQS</code>, the total number of IRQs supported
by the board.
</p>
</li>
<li>
<code>src/</code><i><chip-name></i><code>/</code>
This sub-directory contains chip-specific source files.
</li>
<li>
<code>src/Makefile</code>:
This makefile will be executed to build the targets <code>src/libup.a</code> and
<code>src/up_head.o</code>. The <code>up_head.o</code> file holds the entry point into the system
(power-on reset entry point, for example). It will be used in
the final link with <code>libup.a</code> and other system archives to generate the
final executable.
</li>
<li>
<i>(architecture-specific source files)</i>.
The file <code>include/nuttx/arch.h</code> identifies all of the APIs that must
be provided by the architecture specific logic. (It also includes
<code>arch/</code><i><arch-name></i><code>/arch.h</code> as described above).
</li>
</ul>
<h3><a name="supportedarchitectures">2.2.3 Supported Architectures</a></h3>
All processor architecture-specific directories are maintained in sub-directories of
the <code>arch/</code> directory.
Different chips or SoC's may implement the same processor core.
Chip-specific logic can be found in sub-directories under the architecture
directory.
Current architecture/chip directories are summarized below:
</p>
<ul>
<li><code>arch/sim</code>:
A user-mode port of NuttX to the x86 Linux platform is available.
The purpose of this port is primarily to support OS feature development.
This port does not support interrupts or a real timer (and hence no
round robin scheduler) Otherwise, it is complete.
<p>NOTE: This target will not run on Cygwin probably for many reasons but
first off because it uses some of the same symbols as does cygwind.dll.
</p>
<li><code>arch/arm</code>:
This directory holds common ARM architectures. At present, this includes
the following subdirectories:
<ul>
<li><code>arch/arm/include</code> and <code>arch/arm/src/common</code>:
Common ARM logic.
</li>
<li><code>arch/arm/include/c5471</code> and <code>arch/arm/src/c5471</code>:
TI TMS320C5471 (also called TMS320DM180 or just C5471).
NuttX operates on the ARM7 of this dual core processor.
This port is complete, verified, and included in the NuttX release 0.1.1.
</li>
<li><code>arch/arm/include/dm320</code> and <code>arch/arm/src/dm320</code>:
TI TMS320DM320 (also called just DM320).
NuttX operates on the ARM9EJS of this dual core processor.
This port complete, verified, and included in the NuttX release 0.2.1.
</li>
patacongo
committed
<li><code>arch/arm/include/lpc214x</code> and <code>arch/arm/src/lpc214x</code>:
These directories provide support for NXP LPC214x family of
processors.
STATUS: This port boots and passes the OS test (apps/examples/ostest).
patacongo
committed
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 configuration is also available.
patacongo
committed
</li>
<li><code>configs/mcu123-lpc214x</code>:
The mcu123.com lpc214x development board.
This is a work in progress.
<li><code>arch/m68322</code>
8051 Microcontroller. This port is not quite ready for prime time.
<li><code>arch/z16f</code>:
Zilog z16f Microcontroller.
This port uses the Zilog z16f2800100zcog Development Kit.
This directory holds 8-bit ZiLOG architectures. At present, this includes the
Zilog z80, ez80Acclaim! and z8Encore! Microcontrollers.
<ul>
<li><code>arch/z80/include</code> and <code>arch/z80/src/common</code>:
Common logic.
</li>
<li><code>arch/z80/include/z80</code> and <code>arch/z80/src/z80</code>:
The Z80 port was released in nuttx-0.3.6 has been verified using only a
z80 instruction simulator.
The set simulator can be found in the NuttX SVN at
http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/misc/sims/z80sim.
This port also uses the SDCC toolchain (http://sdcc.sourceforge.net/")
<li><code>arch/z80/include/ez80</code> and <code>arch/z80/src/ez80</code>:
The ez80Acclaim! port uses the ZiLOG ez80f0910200kitg development kit, eZ80F091 part,
with the Zilog ZDS-II Windows command line tools.
The development environment is Cygwin under WinXP.
This is a work in progress. Verified ez80 support will be announced in a future NuttX release.
</li>
<li><code>arch/z80/include/z8</code> and <code>arch/z80/src/z8</code>:
The Z8Encore! port uses either the ZiLOG z8encore000zco development kit, Z8F6403 part,
or the z8f64200100kit development kit, Z8F6423 part with the Zilog ZDS-II Windows command line
The initial release, verified only on the ZDS-II ez8 simulator, was released in nuttx-0.3.9.
</ul>
<p>
<b>Deprecated Architecture Directories</b>.
The following architecture directories are deprecated. They have been
replaced by the logic in <code>arm/arm</code> and will deleted when
<code>arch/arm</code> is fully verified.
</p>
<ul>
<li><code>arch/c5471</code>:
Replaced with <code>arch/arm/include/c5471</code> and
</li>
<li><code>arch/dm320</code>:
Replaced with <code>arch/arm/include/dm320</code> and
</ul>
<p>
Other ports for the for the TI TMS320DM270 and for MIPS are in various states
of progress
</p>
<h2>2.3 <a name="DirStructBinFmt">nuttx/binfmt</a></h2>
<p>
The <code>binfmt/</code> subdirectory contains logic for loading binaries in the file
system into memory in a form that can be used to execute them.
</p>
<h2>2.4 <a name="DirStructConfigs">nuttx/configs</a></h2>
<p>
The <code>configs/</code> subdirectory contains configuration data for each board.
These board-specific configurations plus the architecture-specific configurations in
the <code>arch/</code> subdirectory complete define a customized port of NuttX.
</p>
<h3><a name="configsdirectorystructure">2.4.1 Subdirectory Structure</a></h3>
<p>
The configs directory contains board specific configuration files. Each board must
provide a subdirectory <board-name> under <code>configs/</code> with the following characteristics:
</p>
<ul><pre>
<i><board-name></i>
|-- include/
| |-- board.h
| `-- <i>(board-specific header files)</i>
|-- src/
| |-- Makefile
| `-- <i>(board-specific source files)</i>
|-- <i><config1-dir></i>
| |-- Make.defs
| |-- defconfig
| `-- setenv.sh
|-- <i><config2-dir></i>
| |-- Make.defs
| |-- defconfig
| `-- setenv.sh
| ...
`-- <i>(other board-specific configuration sub-directories)</i>/
</pre>
<p><small>
<sup>1</sup>Optional
</small></p>
</ul>
<h3><a name="summaryofconfigfiles">2.4.2 Summary of Files</a></h3>
<h4><a name="boardlogic">2.4.2.1 Board Specific Logic</a></h4>
<ul>
<li>
<code>include/</code>:
This directory contains board specific header files.
This directory will be linked as <code>include/arch/board</code> at configuration time
and can be included via <code>#include <arch/board/header.h></code>.
These header file can only be included by files in <code>arch/</code><i><arch-name></i><code>/include/</code>
and <code>arch/</code><i><arch-name></i><code>/src/</code>.
<li>
<code>src/</code>:
This directory contains board specific drivers.
This directory will be linked as <config>arch/</code><i><arch-name></i><code>/src/board</code> at configuration
time and will be integrated into the build system.
</li>
<li>
<code>src/Makefile</code>:
This makefile will be invoked to build the board specific drivers.
It must support the following targets: <code>libext$(LIBEXT)</code>, <code>clean</code>, and <code>distclean</code>.
</li>
<h4><a name="boardconfigsubdirs">2.4.2.2 Board Specific Configuration Sub-Directories</a></h4>
<p>
The <code>configs/</code><i><board-name></i><code>/</code> sub-directory holds all of the
files that are necessary to configure NuttX for the particular board.
A board may have various different configurations using the common source files.
Each board configuration is described by three files: <code>Make.defs</code>, <code>defconfig</code>, and <code>setenv.sh</code>.
Typically, each set of configuration files is retained in a separate configuration sub-directory
(<i><config1-dir></i>, <i><config2-dir></i>, .. in the above diagram).
The procedure for configuring NuttX is described <a href="#configuringnuttx">below</a>,
This paragraph will describe the contents of these configuration files.
</p>
<ul>
<li>
<code>Make.defs</code>: This makefile fragment provides architecture and
tool-specific build options. It will be included by all other
makefiles in the build (once it is installed). This make fragment
should define:
<ul>
<li>Tools: CC, LD, AR, NM, OBJCOPY, OBJDUMP</li>
<li>Tool options: CFLAGS, LDFLAGS</li>
<li>COMPILE, ASSEMBLE, ARCHIVE, CLEAN, and MKDEP macros</li>
</ul>
<p>
When this makefile fragment runs, it will be passed TOPDIR which
is the path to the root directory of the build. This makefile
fragment may include ${TOPDIR}/.config to perform configuration
specific settings. For example, the CFLAGS will most likely be
different if CONFIG_DEBUG=y.
</li>
<li>
<p>
<code>defconfig</code>: This is a configuration file similar to the Linux
configuration file. In contains variable/value pairs like:
</p>
<ul>
<li><code>CONFIG_VARIABLE</code>=value</li>
</ul>
<p>
This configuration file will be used at build time:
</p>
<li>As a makefile fragment included in other makefiles, and</li>
<li>to generate <code>include/nuttx/config.h</code> which is included by
most C files in the system.</li>
</ol></p>
</li>
<li>
<p>
<code>appconfig</code>: This is another configuration file that is specific to the
application. This file is copied into the application build directory
when NuttX is configured. See <code>../apps/README.txt</code> for further details.
</p>
</li>
<li>
<p>
<code>setenv.sh</code>: This is a script that you can include that will be installed at
the top level of the directory structure and can be sourced to set any
necessary environment variables.
You will most likely have to customize the default <code>setenv.sh</code> script in order
for it to work correctly in your environment.
</li>
</ul>
<h3><a name="supportedboards">2.4.3 Supported Boards</a></h3>
<p>
All of the specific boards supported by NuttX are identified below.
These are the specific <i><board-name></i>'s that may be used to configure NuttX
<ul>
<li><code>configs/avr32dev1</code>:
This is a port of NuttX to the Atmel AVR32DEV1 board. That board is
based on the Atmel AT32UC3B0256 MCU and uses a specially patched
version of the GNU toolchain: The patches provide support for the
AVR32 family. That patched GNU toolchain is available only from the
Atmel website. STATUS: This port is functional but very basic. There
are configurations for NSH and the OS test.
</li>
<li><code>configs/c5471evm</code>:
This is a port to the Spectrum Digital C5471 evaluation board. The
C5471 is a dual core processor from TI with an ARM7TDMI general purpose
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
processor and a c54 DSP. It is also known as TMS320DA180 or just DA180.
NuttX runs on the ARM core and is built with with a GNU arm-elf toolchain
under Linux or Cygwin. This port is complete and verified.
</li>
<li><code>configs/demo9s12ne64</code>:
Feescale DMO9S12NE64 board based on the MC9S12NE64 hcs12 cpu. This
port uses the m9s12x GCC toolchain. STATUS: (Still) under development; it
is code complete but has not yet been verified.
</li>
<li><code>configs/detron</code>:
This is a NuttX port to the Detron LPC1768 board from Decio Renno
(<a href="http://www.detroneletronica.com.br/">Detron Electronica</a>)
</li>
<li><code>configs/ea3131</code>:
Embedded Artists EA3131 Development bard. This board is based on the
an NXP LPC3131 MCU. This OS is built with the arm-elf toolchain.
STATUS: This port is complete and mature.
</li>
<li><code>configs/eagle100</code>:
Micromint Eagle-100 Development board. This board is based on the
an ARM Cortex-M3 MCU, the Luminary LM3S6918. This OS is built with the
arm-elf toolchain. STATUS: This port is complete and mature.
patacongo
committed
</li>
<li><code>configs/ez80f0910200kitg</code>
ez80Acclaim! Microcontroller. This port use the Zilog ez80f0910200kitg
development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
tools. The development environment is Cygwin under WinXP.
</li>
<li><code>configs/ez80f910200zco</code>:
ez80Acclaim! Microcontroller. This port use the Zilog ez80f0910200zco
development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
tools. The development environment is Cygwin under WinXP.
</li>
<li><code>configs/lm3s6965-ek</code>:
Stellaris LM3S6965 Evaluation Kit. This board is based on the
an ARM Cortex-M3 MCU, the Luminary/TI LM3S6965. This OS is built with the
arm-elf toolchain. STATUS: This port is complete and mature.
</li>
<li><code>configs/lm3s8962-ek</code>:
Stellaris LMS38962 Evaluation Kit. STATUS: contributed.
</li>
<li><code>configs/lpcxpresso-lpc1768</code>:
Embedded Artists base board with NXP LPCExpresso LPC1768. This board
is based on the NXP LPC1768. The Code Red toolchain is used by default.
STATUS: Under development.
</li>
This is a partial port for the venerable m68322evb board from Motorola.
This port was never completed and there are no plans to complete.
It will probably just be removed from the source tree at some point.
</li>
<li><code>configs/mbed</code>:
The configurations in this directory support the mbed board (http://mbed.org)
that features the NXP LPC1768 microcontroller. This OS is also built
with the arm-elf toolchain. STATUS: Contributed.
<li><code>configs/mcu123-lpc214x</code>:
patacongo
committed
This port is for the NXP LPC2148 as provided on the mcu123.com
lpc214x development board.
This OS is also built with the arm-elf toolchain* under Linux or Cygwin.
The port supports serial, timer0, spi, and usb.
patacongo
committed
</li>
<li><code>configs/mx1ads</code>:
This is a port to the Motorola MX1ADS development board. That board
is based on the Freescale i.MX1 processor. The i.MX1 is an ARM920T.
STATUS: This port is nearly code complete but was never fully
integrated due to tool-related issues.
</li>
<li><code>configs/ne64badge</code>:
Future Electronics Group NE64 /PoE Badge board based on the
MC9S12NE64 hcs12 cpu. This port uses the m9s12x GCC toolchain.
STATUS: Under development. The port is code-complete but has
not yet been fully tested.
</li>
<li><code>configs/ntosd-dm320</code>:
This port uses the Neuros OSD with a GNU arm-elf toolchain* under Linux or Cygwin.
See <a href="http://wiki.neurostechnology.com/index.php/Developer_Welcome">Neuros Wiki</a>
NuttX operates on the ARM9EJS of this dual core processor.
STATUS: This port is code complete, verified, and included in the
patacongo
committed
NuttX 0.2.1 release.
</li>
<li><code>configs/nucleus2g</code>:
This port uses the Nucleus 2G board (with Babel CAN board).
This board features an NXP LPC1768 processor.
See the <a href="http://www.2g-eng.com/">2G Engineering</a> website for more information about the Nucleus 2G.
</li>
<li><code>configs/olimex-lpc1766stk</code>:
This port uses the Olimex LPC1766-STK board and a GNU GCC toolchain under
Linux or Cygwin. STATUS: Complete and mature.
</li>
<li><code>configs/olimex-lpc2378</code>:
This port uses the Olimex-lpc2378 board and a GNU arm-elf toolchain under
Linux or Cygwin. STATUS: ostest and NSH configurations available.
<li><code>configs/olimex-strp711</code>:
This port uses the Olimex STR-P711 board arm-elf toolchain* under Linux or Cygwin.
See the <a href="http://www.olimex.com/dev/str-p711.html">Olimex</a> web site
STATUS: Configurations for the basic OS test and NSH are complete and verified.
</li>
<li><code>configs/pcblogic-pic32mx</code>:
This is the port of NuttX to the PIC32MX board from PCB Logic Design Co.
This board features the MicroChip PIC32MX460F512L.
The board is a very simple -- little more than a carrier for the PIC32
MCU plus voltage regulation, debug interface, and an OTG connector.
STATUS: Code complete but testing has been stalled due to tool related problems
(PICkit 2 does not work with the PIC32).
patacongo
committed
</li>
<li><code>configs/pjrc-8051</code>:
8051 Microcontroller. This port uses the PJRC 87C52 development system
and the <a href="http://sdcc.sourceforge.net/">SDCC</a> toolchain under Linux or Cygwin.
<li><code>configs/qemu-i486</code>:
Port of NuttX to QEMU in i486 mode. This port will also run on real i486
hardwared (Google the Bifferboard).
</li>
<li><code>configs/rgmp</code>:
RGMP stands for RTOS and GPOS on Multi-Processor. RGMP is a project for
running GPOS and RTOS simultaneously on multi-processor platforms. You can
port your favorite RTOS to RGMP together with an unmodified Linux to form a
hybrid operating system. This makes your application able to use both RTOS
and GPOS features.
See the <a href="http://rgmp.sourceforge.net/wiki/index.php/Main_Page">RGMP Wiki</a> for further information about RGMP.
</li>
<li><code>configs/sam3u-ek</code>:
The port of NuttX to the Atmel SAM3U-EK development board.
Renesas M16C processor on the Renesas SKP16C26 StarterKit. This port
uses the GNU m32c toolchain. STATUS: The port is complete but untested
due to issues with compiler internal errors.
</li>
<li><code>configs/stm3210e-eval</code>:
STMicro STM3210E-EVAL development board based on the STMicro STM32F103ZET6
microcontroller (ARM Cortex-M3). This port uses the GNU Cortex-M3
toolchain.
</li>
<li><code>configs/sim</code>:
A user-mode port of NuttX to the x86 Linux platform is available.
The purpose of this port is primarily to support OS feature development.
This port does not support interrupts or a real timer (and hence no
round robin scheduler) Otherwise, it is complete.
</li>
<li><code>configs/us7032evb1</code>:
This is a port of the Hitachi SH-1 on the Hitachi SH-1/US7032EVB1 board.
patacongo
committed
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 limited 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.
<li><code>configs/vsn</code>:
ISOTEL NetClamps VSN V1.2 ready2go sensor network platform based on the
STMicro STM32F103RET6. Contributed by Uros Platise.
See the <a href="http://isotel.eu/NetClamps/">Isotel</a> web site for further information
about the NetClamps board.
</li>
TRS80 Model 3. This port uses a vintage computer based on the Z80.
An emulator for this computer is available to run TRS80 programs on a
This port use the Zilog z16f2800100zcog development kit and the
Zilog ZDS-II Windows command line tools.
The development environment is Cygwin under WinXP.
<li><code>configs/z80sim</code>:
z80 Microcontroller. This port uses a Z80 instruction set simulator.
That simulator can be found in the NuttX SVN
<a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/misc/sims/z80sim">here</a>.
This port also the <a href="http://sdcc.sourceforge.net/">SDCC</a> toolchain
z8Encore! Microcontroller. This port use the Zilog z8encore000zco
development kit, Z8F6403 part, and the Zilog ZDS-II Windows command line
tools. The development environment is Cygwin under WinXP.
</li>
<li><code>configs/z8encore000zco</code>
z8Encore! Microcontroller. This port use the Zilog z8f64200100kit
development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line
tools. The development environment is Cygwin under WinXP.
</li>
<li><code>configs/z8f64200100kit</code>:
z8Encore! Microcontroller. This port use the Zilog z8f64200100kit
development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line
tools. The development environment is Cygwin under WinXP.
</li>
</ul>
<p><small><blockquote>
* A customized version of the <a href="http://www.buildroot.org">buildroot</a>
is available to build these toolchains under Linux or Cygwin.
</blockquote></small></p>