NuttX RTOS Porting GuideLast Updated: May 25, 2011 |
Table of Contents |
up_initialize()
up_idle()
up_initial_state()
up_create_stack()
up_use_stack()
up_release_stack()
up_unblock_task()
up_block_task()
up_release_pending()
up_reprioritize_rtr()
_exit()
up_assert()
up_schedule_sigaction()
up_allocate_heap()
up_interrupt_context()
up_disable_irq()
up_enable_irq()
up_prioritize_irq()
4.1.19 up_putc()
4.1.20 System Time and Clock
os_start()
sched_process_timer()
irq_dispatch()
1.0 Introduction |
Overview This document provides and overview of the NuttX build and configuration logic and provides hints for the incorporation of new processor/board architectures into the build.
See also arch/README.txt
and configs/README.txt
.
2.0 Directory Structure |
Directory Structure. 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:
. |- nuttx | |-- Makefile | |-- Documentation | | `-- (documentation files)/ | |-- arch/ | | |-- <arch-name>/ | | | |-- include/ | | | | |--<chip-name>/ | | | | | `-- (chip-specific header files) | | | | |--<other-chips>/ | | | | `-- (architecture-specific header files) | | | `-- src/ | | | |--<chip-name>/ | | | | `-- (chip-specific source files) | | | |--<other-chips>/ | | | `-- (architecture-specific source files) | | `-- <other-architecture directories>/ | |-- binfmt/ | | |-- Makefile | | |-- (binfmt-specific sub-directories)/ | | | `-- (binfmt-specific source files) | | `-- (common binfmt source files) | |-- configs/ | | |-- <board-name>/ | | | |-- include/ | | | | `-- (other board-specific header files) | | | |-- src/ | | | | `-- (board-specific source files) | | | |---<config-name>/ | | | | `-- (board configuration-specific source files) | | | `---(other configuration sub-directories for this board)/ | | `-- <(other board directories)>/ | |-- drivers/ | | |-- Makefile | | |-- (driver-specific sub-directories)/ | | | `-- (driver-specific source files) | | `-- (common driver source files) | |-- fs/ | | |-- Makefile | | |-- (file system-specific sub-directories)/ | | | `-- (file system-specific source files) | | `-- (common file system source files) | |-- graphics/ | | |-- Makefile | | |-- (feature-specific sub-directories)/ | | | `-- (feature-specific source files library source files) | | `-- (common graphics-related source files) | |-- include/ | | |-- (standard header files) | | |-- (standard include sub-directories) | | | `-- (more standard header files) | | |-- (non-standard include sub-directories) | | `-- (non-standard header files) | |-- lib/ | | |-- Makefile | | `-- (lib source files) | |-- libxx/ | | |-- Makefile | | `-- (libxx management source files) | |-- mm/ | | |-- Makefile | | `-- (memory management source files) | |-- net/ | | |-- Makefile | | |-- uip/ | | | `-- (uip source files) | | `-- (BSD socket source files) | |-- sched/ | | |-- Makefile | | `-- (sched source files) | |-- syscall/ | | |-- Makefile | | `-- (syscall source files) | `-- tools/ | `-- (miscellaneous scripts and programs) `- apps |-- netutils/ | |-- Makefile | |-- (network feature sub-directories)/ | | `-- (network feature source files) | `-- (netutils common files) |-- nshlib/ | |-- Makefile | `-- NuttShell (NSH) files |-- (Board-specific applications)/ | |-- Makefile | |-- (Board-specific application sub-directories)/ | | `-- (Board-specific application source files) | `-- (Board-specific common files) `-- examples/ `-- (example)/ |-- Makefile `-- (example source files)
Configuration Files. The NuttX configuration consists of:
arch/
<arch-name>/
directory
and are discussed in a paragraph below.
These chip-specific files are contained within chip-specific sub-directories in the
arch/
<arch-name>/
directory and are selected via
the CONFIG_ARCH_name
selection.
These board-specific configuration files can be found in the
configs/
<board-name>/
sub-directories and are discussed
in a paragraph below.
General documentation for the NuttX OS resides in this directory.
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 arch/
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 config/
subdirectory).
Each architecture must provide a subdirectory, <arch-name>
under arch/
with the following characteristics:
<arch-name>/ |-- include/ | |--<chip-name>/ | | `-- (chip-specific header files) | |--<other-chips>/ | |-- arch.h | |-- irq.h | |-- types.h | |-- limits.h | `-- syscall.h `-- src/ |--<chip-name>/ | `-- (chip-specific source files) |--<other-chips>/ |-- Makefile `-- (architecture-specific source files)
include/
<chip-name>/
This sub-directory contains chip-specific header files.
include/arch.h
:
This is a hook for any architecture specific definitions that may
be needed by the system. It is included by include/nuttx/arch.h
.
include/types.h
:
This provides architecture/toolchain-specific definitions for
standard types. This file should typedef
:
_int8_t, _uint8_t, _int16_t, _uint16_t, _int32_t, _uint32_t_t
and if the architecture supports 24- or 64-bit integers
_int24_t, _uint24_t, int64_t, uint64_t
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
And finally
irqstate_t
Must be defined to the be the size required to hold the interrupt enable/disable state.
This file will be included by include/sys/types.h and be made available to all files.
include/irq.h
:
This file needs to define some architecture specific functions (usually
inline if the compiler supports inlining) and some structures. These include:
struct xcptcontext
:
This structures represents the saved context of a thread.
irqstate_t irqsave(void)
:
Used to disable all interrupts.
void irqrestore(irqstate_t flags)
:
Used to restore interrupt enables to the same state as before irqsave()
was called.
This file must also define NR_IRQS
, the total number of IRQs supported
by the board.
include/syscall.h
:
This file needs to define some architecture specific functions (usually
inline if the compiler supports inlining) to support software interrupts
or syscalls 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 CONFIG_NUTTX_KERNEL
configuration.
uintptr_t sys_call0(unsigned int nbr)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with no (additional) parameters.
uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with one (additional) parameter.
uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1, uintptr_t parm2)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with two (additional) parameters.
uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with three (additional) parameters.
uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with four (additional) parameters.
uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with five (additional) parameters.
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)
:
nbr
is one of the system call numbers that can be found in include/sys/syscall.h
.
This function will perform a system call with six (additional) parameters.
This file must also define NR_IRQS
, the total number of IRQs supported
by the board.
src/
<chip-name>/
This sub-directory contains chip-specific source files.
src/Makefile
:
This makefile will be executed to build the targets src/libup.a
and
src/up_head.o
. The up_head.o
file holds the entry point into the system
(power-on reset entry point, for example). It will be used in
the final link with libup.a
and other system archives to generate the
final executable.
include/nuttx/arch.h
identifies all of the APIs that must
be provided by the architecture specific logic. (It also includes
arch/
<arch-name>/arch.h
as described above).
Architecture- and Chip-Specific Directories.
All processor architecture-specific directories are maintained in sub-directories of
the arch/
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:
arch/sim
:
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.
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.
arch/arm
:
This directory holds common ARM architectures. At present, this includes
the following subdirectories:
arch/arm/include
and arch/arm/src/common
:
Common ARM logic.
arch/arm/include/c5471
and arch/arm/src/c5471
:
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.
arch/arm/include/dm320
and arch/arm/src/dm320
:
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.
arch/arm/include/lpc214x
and arch/arm/src/lpc214x
:
These directories provide support for NXP LPC214x family of
processors.
STATUS: This port boots and passes the OS test (apps/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 configuration is also available.
configs/mcu123-lpc214x
:
The mcu123.com lpc214x development board.
This is a work in progress.
arch/m68322
A work in progress.
arch/8051
:
8051 Microcontroller. This port is not quite ready for prime time.
arch/z16f
:
Zilog z16f Microcontroller.
This port uses the Zilog z16f2800100zcog Development Kit.
This port was released with nuttx-0.3.7.
arch/z80
:
This directory holds 8-bit ZiLOG architectures. At present, this includes the
Zilog z80, ez80Acclaim! and z8Encore! Microcontrollers.
arch/z80/include
and arch/z80/src/common
:
Common logic.
arch/z80/include/z80
and arch/z80/src/z80
:
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/")
(verified with version 2.6.0 and 2.7.0).
arch/z80/include/ez80
and arch/z80/src/ez80
:
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.
arch/z80/include/z8
and arch/z80/src/z8
:
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
tools. The development environment is Cygwin under WinXP.
The initial release, verified only on the ZDS-II ez8 simulator, was released in nuttx-0.3.9.
Deprecated Architecture Directories.
The following architecture directories are deprecated. They have been
replaced by the logic in arm/arm
and will deleted when
arch/arm
is fully verified.
arch/c5471
:
Replaced with arch/arm/include/c5471
and
arch/arm/src/c5471
.
arch/dm320
:
Replaced with arch/arm/include/dm320
and
arch/arm/src/dm320
.
Other ports for the for the TI TMS320DM270 and for MIPS are in various states of progress
The binfmt/
subdirectory contains logic for loading binaries in the file
system into memory in a form that can be used to execute them.
The configs/
subdirectory contains configuration data for each board.
These board-specific configurations plus the architecture-specific configurations in
the arch/
subdirectory complete define a customized port of NuttX.
The configs directory contains board specific configuration files. Each board must
provide a subdirectory <board-name> under configs/
with the following characteristics:
<board-name> |-- include/ | |-- board.h | `-- (board-specific header files) |-- src/ | |-- Makefile | `-- (board-specific source files) |-- <config1-dir> | |-- Make.defs | |-- defconfig | |-- appconfig1 | `-- setenv.sh |-- <config2-dir> | |-- Make.defs | |-- defconfig | |-- appconfig1 | `-- setenv.sh | ... `-- (other board-specific configuration sub-directories)/
1Optional
include/
:
This directory contains board specific header files.
This directory will be linked as include/arch/board
at configuration time
and can be included via #include <arch/board/header.h>
.
These header file can only be included by files in arch/
<arch-name>/include/
and arch/
<arch-name>/src/
.
src/
:
This directory contains board specific drivers.
This directory will be linked as /src/board
at configuration
time and will be integrated into the build system.
src/Makefile
:
This makefile will be invoked to build the board specific drivers.
It must support the following targets: libext$(LIBEXT)
, clean
, and distclean
.
The configs/
<board-name>/
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: Make.defs
, defconfig
, and setenv.sh
.
Typically, each set of configuration files is retained in a separate configuration sub-directory
(<config1-dir>, <config2-dir>, .. in the above diagram).
The procedure for configuring NuttX is described below,
This paragraph will describe the contents of these configuration files.
Make.defs
: 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:
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.
defconfig
: This is a configuration file similar to the Linux
configuration file. In contains variable/value pairs like:
CONFIG_VARIABLE
=valueThis configuration file will be used at build time:
include/nuttx/config.h
which is included by
most C files in the system.
appconfig
: 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 ../apps/README.txt
for further details.
setenv.sh
: 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.
All of the specific boards supported by NuttX are identified below. These are the specific <board-name>'s that may be used to configure NuttX as described below.
configs/avr32dev1
:
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.
configs/c5471evm
:
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
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.
configs/demo9s12ne64
:
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.
configs/detron
:
This is a NuttX port to the Detron LPC1768 board from Decio Renno
(Detron Electronica)
configs/ea3131
:
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.
configs/eagle100
:
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.
configs/ez80f0910200kitg
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.
configs/ez80f910200zco
:
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.
configs/lm3s6965-ek
:
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.
configs/lm3s8962-ek
:
Stellaris LMS38962 Evaluation Kit. STATUS: contributed.
configs/lpcxpresso-lpc1768
:
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.
configs/m68322evb
:
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.
configs/mbed
:
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.
configs/mcu123-lpc214x
:
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.
configs/mx1ads
:
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.
configs/ne64badge
:
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.
configs/ntosd-dm320
:
This port uses the Neuros OSD with a GNU arm-elf toolchain* under Linux or Cygwin.
See Neuros Wiki
for further information.
NuttX operates on the ARM9EJS of this dual core processor.
STATUS: This port is code complete, verified, and included in the
NuttX 0.2.1 release.
configs/nucleus2g
:
This port uses the Nucleus 2G board (with Babel CAN board).
This board features an NXP LPC1768 processor.
See the 2G Engineering website for more information about the Nucleus 2G.
configs/olimex-lpc1766stk
:
This port uses the Olimex LPC1766-STK board and a GNU GCC toolchain under
Linux or Cygwin. STATUS: Complete and mature.
configs/olimex-lpc2378
:
This port uses the Olimex-lpc2378 board and a GNU arm-elf toolchain under
Linux or Cygwin. STATUS: ostest and NSH configurations available.
configs/olimex-strp711
:
This port uses the Olimex STR-P711 board arm-elf toolchain* under Linux or Cygwin.
See the Olimex web site
for further information.
STATUS: Configurations for the basic OS test and NSH are complete and verified.
configs/pcblogic-pic32mx
:
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).
configs/pjrc-8051
:
8051 Microcontroller. This port uses the PJRC 87C52 development system
and the SDCC toolchain under Linux or Cygwin.
This port is not quite ready for prime time.
configs/qemu-i486
:
Port of NuttX to QEMU in i486 mode. This port will also run on real i486
hardwared (Google the Bifferboard).
configs/rgmp
:
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 RGMP Wiki for further information about RGMP.
configs/sam3u-ek
:
The port of NuttX to the Atmel SAM3U-EK development board.
configs/skp16c26
:
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.
configs/stm3210e-eval
:
STMicro STM3210E-EVAL development board based on the STMicro STM32F103ZET6
microcontroller (ARM Cortex-M3). This port uses the GNU Cortex-M3
toolchain.
configs/sim
:
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.
configs/us7032evb1
:
This is a port of the Hitachi SH-1 on the Hitachi SH-1/US7032EVB1 board.
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.
configs/vsn
:
ISOTEL NetClamps VSN V1.2 ready2go sensor network platform based on the
STMicro STM32F103RET6. Contributed by Uros Platise.
See the Isotel web site for further information
about the NetClamps board.
configs/xtrs
:
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
Linux platform (http://www.tim-mann.org/xtrs.html).
configs/z16f2800100zcog
z16f Microcontroller.
This port use the Zilog z16f2800100zcog development kit and the
Zilog ZDS-II Windows command line tools.
The development environment is Cygwin under WinXP.
configs/z80sim
:
z80 Microcontroller. This port uses a Z80 instruction set simulator.
That simulator can be found in the NuttX SVN
here.
This port also the SDCC toolchain
under Linux or Cygwin(verified with version 2.6.0).
configs/z8encore000zco
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.
configs/z8encore000zco
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.
configs/z8f64200100kit
:
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.
* A customized version of the buildroot
is available to build these toolchains under Linux or Cygwin.
This directory holds architecture-independent device drivers.
drivers/ |-- Makefile |-- bch/ | |-- Make.defs | `-- (bch driver source files) |-- mmcsd/ | |-- Make.defs | `-- (mmcsd driver source files) |-- net/ | |-- Make.defs | `-- (net driver source files) |-- usbdev/ | |-- Make.defs | `-- (USB device driver source files) |-- usbhost/ | |-- Make.defs | `-- (USB host driver source files) `-- (common driver source files)
This directory contains the NuttX file system. This file system is described below.
fs/ |-- Makefile |-- fat/ | |-- Make.defs | `-- (fat file system source files) |-- nxffs/ | |-- Make.defs | `-- (NXFFS file system source files) |-- romfs/ | |-- Make.defs | `-- (romfs file system source files) `-- (common file system source files)
This directory contains files for graphics/video support under NuttX.
graphics/ |-- Makefile |-- nxglib/ | |-- Make.defs | `-- (NuttX graphics library source files) |-- nx/ | |-- Make.defs | `-- (NuttX X-server source files) `-- (common file system source files)
This directory holds NuttX header files. Standard header files file retained in can be included in the normal fashion:
include <stdio.h>
include <sys/types.h>
Directory structure:
include/ |-- (standard header files) |-- arpa/ | `-- (standard header files) |-- net/ | `-- uip/ | `-- (uIP specific header files) |-- netinet/ | `-- (standard header files) |-- nuttx/ | `-- (nuttx specific header files) `- sys/ `-- (more standard header files)2.9 nuttx/lib
This directory holds a collection of standard libc-like functions with custom interfaces into NuttX.
2.10 nuttx/libxx
This directory holds a tiny, minimal standard std C++ that can be used to build some, simple C++ applications in NuttX.
2.11 nuttx/mm
This is the NuttX memory manager.
2.12 nuttx/net
This directory contains the implementation of the socket APIs. The subdirectory,
uip
contains the uIP port.2.13 nuttx/sched
The files forming core of the NuttX RTOS reside here.
2.14 nuttx/syscall
If NuttX is built as a separately compiled kernel (with CONFIG_NUTTX_KERNEL=y), then the contents of this directory are built. This directory holds a syscall interface that can be used for communication between user-mode applications and the kernel-mode RTOS.
2.15 nuttx/tools
This directory holds a collection of tools and scripts to simplify configuring, building and maintaining NuttX.
tools/ |-- Makefile.host |-- README.txt |-- configure.sh |-- cfgparser.c |-- cfgparser.h |-- define.sh |-- incdir.sh |-- indent.sh |-- link.sh |-- mkconfig.c |-- mkdeps.sh |-- mkimage.sh |-- mknulldeps.sh |-- mkromfsimg.sh |-- mksyscall.c |-- mkversion.c |-- unlink.sh |-- version.sh |-- winlink.sh `-- zipme.sh
Refer to the README file in the tools
directory for more information about the individual files.
Some of these tools are discussed below as well in the discussion of configuring and building NuttX.
The top-level Makefile
in the ${TOPDIR}
directory contains all of the top-level control
logic to build NuttX.
Use of this Makefile
to build NuttX is described below.
This directory contains most of the network applications. Some of these are original with NuttX (like tftpc and dhcpd) and others were leveraged from the uIP-1.0 apps directory. As the uIP apps/README says, these applications "are not all heavily tested."
netutils/ |-- Makefile |-- dhcp/ | |-- Make.defs | `-- (dhcp source files) |-- dhcpd/ | |-- Make.defs | `-- (dhcpd source files) |-- resolv/ | |-- Make.defs | `-- (resolv source files) |-- smtp/ | |-- Make.defs | `-- (smtp source files) |-- telnetd/ | |-- Make.defs | `-- (telnetd source files) |-- tftpc/ | |-- Make.defs | `-- (tftpc source files) |-- thttpd/ | |-- Make.defs | `-- (thttpd source files) |-- uiplib/ | |-- Make.defs | `-- (uiplib source files) |-- weblclient/ | |-- Make.defs | `-- (webclient source files) |-- webserver/ | |-- Make.defs | `-- (webserver source files) `-- (netutils common files)
This directory contains for the core of the NuttShell (NSH) application.
Example and test programs to build against.
3.0 Configuring and Building |
Manual Configuration.
Configuring NuttX requires only copying the
board-specific configuration files into the top level directory which appears in the make files as the make variable, ${TOPDIR}
.
This could be done manually as follows:
configs/
<board-name>/[
<config-dir>/]Make.defs
to ${TOPDIR}/Make.defs
,configs/
<board-name>/[
<config-dir>/]setenv.sh
to ${TOPDIR}/setenv.sh
, andconfigs/
<board-name>/[
<config-dir>/]defconfig
to ${TOPDIR}/.config
And if configs/
<board-name>/[
<config-dir>/appconfig
exists in the board configuration directory:
configs/
<board-name>/[
<config-dir>/appconfig
to <app-dir>/.config
echo "APPS_LOC=\"<app-dir>\"" >> "${TOPDIR}/.config"
Where <board-name> is the name of one of the sub-directories of the
NuttX configs/
directory.
This sub-directory name corresponds to one of the supported boards
identified above.
<config-dir> is the optional, specific configuration directory for the board.
And <app-dir> is the location of the optonal application directory.
Automated Configuration. There is a script that automates these steps. The following steps will accomplish the same configuration:
cd tools ./configure.sh <board-name>[/<config-dir>]
And if configs/
<board-name>/[
<config-dir>/appconfig
exists and your application directory is not in the standard loction (
cd tools ./configure.sh -a <app-dir> <board-name>[/<config-dir>]
Version Files.
The NuttX build expects to find a version file located in the top-level NuttX build directory.
That version file is called .version
.
The correct version file is installed in each versioned NuttX released.
However, if you are working from an SVN snapshot, then there will be no version file.
If there is no version file, the top-level Makefile
will create a dummy .version
file on the first make.
This dummy version file will contain all zeroes for version information.
If that is not what you want, they you should run the version.sh
script to create a better .version
file.
You can get help information from the version.sh
script using the -h
option.
For example:
$ tools/version.sh -h tools/version.sh is a tool for generation of proper version files for the NuttX build USAGE: tools/version.sh [-d|-h] [-b build] -v <major.minor> <outfile-path> Where: -d Enable script debug -h show this help message and exit -v <major.minor> The NuttX version number expressed a major and minor number separated by a period <outfile-path> The full path to the version file to be created
As an example, the following command will generate a version file for version 6.1 using the current SVN revision number:
tools/version.h -v 6.1 .version
The .version
file is also used during the build process to create a C header file at include/nuttx/version.h
that contains the same version information.
That version file may be used by your C applications for, as an example, reporting version information.
Additional Configuration Steps.
The remainder of configuration steps will be performed by ${TOPDIR}/Makefile
the first time the system is built as described below.
Building NuttX. Once NuttX has been configured as described above, it may be built as follows:
cd ${TOPDIR} source ./setenv.sh make
The ${TOPDIR}
directory holds:
Makefile
that controls the NuttX build.
That directory also holds:
.config
that describes the current configuration.Make.defs
that provides customized build targets, andsetenv.sh
that sets up the configuration environment for the build.
The setenv.sh
contains Linux/Cygwin environmental settings that are needed for the build.
The specific environmental definitions are unique for each board but should include, as a minimum, updates to the PATH
variable to include the full path to the architecture-specific toolchain identified in Make.defs
.
The setenv.sh
only needs to be source'ed at the beginning of a session.
The system can be re-made subsequently by just typing make
.
First Time Make. Additional configuration actions will be taken the first time that system is built. These additional steps include:
include/nuttx/config.h
using the ${TOPDIR}/.config
file.${TOPDIR}/.version
with version 0.0 if one does not exist.include/nuttx/version.h
using the ${TOPDIR}/.version
file.${TOPDIR}/arch/
<arch-name>/include
at ${TOPDIR}/include/arch
.${TOPDIR}/configs/
<board-name>/include
at ${TOPDIR}/include/arch/board
.${TOPDIR}/configs/
<board-name>/src
at ${TOPDIR}/arch/
<arch-name>/src/board
${APPDIR}/include
at ${TOPDIR}/include/apps
4.0 Architecture APIs |
The file include/nuttx/arch.h
identifies by prototype all of the APIs that must
be provided by the architecture specific logic.
The internal OS APIs that architecture-specific logic must
interface with also also identified in include/nuttx/arch.h
or in
other header files.
up_initialize()
Prototype: void up_initialize(void);
Description.
up_initialize()
will be called once during OS
initialization after the basic OS services have been
initialized. The architecture specific details of
initializing the OS will be handled here. Such things as
setting up interrupt service routines, starting the
clock, and registering device drivers are some of the
things that are different for each processor and hardware
platform.
up_initialize()
is called after the OS initialized but
before the init process has been started and before the
libraries have been initialized. OS services and driver
services are available.
up_idle()
Prototype: void up_idle(void);
Description.
up_idle()
is the logic that will be executed
when their is no other ready-to-run task. This is processor
idle time and will continue until some interrupt occurs to
cause a context switch from the idle task.
Processing in this state may be processor-specific. e.g., this is where power management operations might be performed.
up_initial_state()
Prototype: void up_initial_state(FAR _TCB *tcb);
Description. A new thread is being started and a new TCB has been created. This function is called to initialize the processor specific portions of the new TCB.
This function must setup the initial architecture registers and/or stack so that execution will begin at tcb->start on the next context switch.
This function may also need to set up processor registers so that the new thread executes
with the correct privileges.
If CONFIG_NUTTX_KERNEL
has been selected in the NuttX configuration,
then special initialization may need to be performed depending on the task type specified
in the TCB's flags field:
Kernel threads will require kernel-mode privileges;
User tasks and pthreads should have only user-mode privileges.
If CONFIG_NUTTX_KERNEL
has not been selected,
then all threads should have kernel-mode privileges.
up_create_stack()
Prototype: STATUS up_create_stack(FAR _TCB *tcb, size_t stack_size);
Description. Allocate a stack for a new thread and setup up stack-related information in the TCB.
The following TCB fields must be initialized:
adj_stack_size
: Stack size after adjustment for hardware,
processor, etc. This value is retained only for debug
purposes.stack_alloc_ptr
: Pointer to allocated stackadj_stack_ptr
: Adjusted stack_alloc_ptr
for HW. The
initial value of the stack pointer.
This API is NOT required if CONFIG_CUSTOM_STACK
is defined.
Inputs:
tcb
: The TCB of new task.
stack_size
: The requested stack size. At least this much
must be allocated.
up_use_stack()
Prototype:
STATUS up_use_stack(FAR _TCB *tcb, FAR void *stack, size_t stack_size);
Description. Setup up stack-related information in the TCB using pre-allocated stack memory.
The following TCB fields must be initialized:
adj_stack_size
: Stack size after adjustment for hardware,
processor, etc. This value is retained only for debug
purposes.stack_alloc_ptr
: Pointer to allocated stackadj_stack_ptr
: Adjusted stack_alloc_ptr
for HW. The
initial value of the stack pointer.
This API is NOT required if CONFIG_CUSTOM_STACK
is defined.
Inputs:
tcb
: The TCB of new task.
stack_size
: The allocated stack size.
up_release_stack()
Prototype: void up_release_stack(FAR _TCB *dtcb);
Description. A task has been stopped. Free all stack related resources retained int the defunct TCB.
This API is NOT required if CONFIG_CUSTOM_STACK
is defined.
up_unblock_task()
Prototype: void up_unblock_task(FAR _TCB *tcb);
Description. A task is currently in an inactive task list but has been prepped to execute. Move the TCB to the ready-to-run list, restore its context, and start execution.
This function is called only from the NuttX scheduling logic. Interrupts will always be disabled when this function is called.
Inputs:
tcb
: Refers to the tcb to be unblocked. This tcb is
in one of the waiting tasks lists. It must be moved to
the ready-to-run list and, if it is the highest priority
ready to run tasks, executed.
up_block_task()
Prototype: void up_block_task(FAR _TCB *tcb, tstate_t task_state);
Description. The currently executing task at the head of the ready to run list must be stopped. Save its context and move it to the inactive list specified by task_state. This function is called only from the NuttX scheduling logic. Interrupts will always be disabled when this function is called.
Inputs:
tcb
: Refers to a task in the ready-to-run list (normally
the task at the head of the list). It most be
stopped, its context saved and moved into one of the
waiting task lists. It it was the task at the head
of the ready-to-run list, then a context to the new
ready to run task must be performed.
task_state
: Specifies which waiting task list should be
hold the blocked task TCB.
up_release_pending()
Prototype: void up_release_pending(void);
Description. When tasks become ready-to-run but cannot run because pre-emption is disabled, they are placed into a pending task list. This function releases and makes ready-to-run all of the tasks that have collected in the pending task list. This can cause a context switch if a new task is placed at the head of the ready to run list.
This function is called only from the NuttX scheduling logic when pre-emption is re-enabled. Interrupts will always be disabled when this function is called.
up_reprioritize_rtr()
Prototype: void up_reprioritize_rtr(FAR _TCB *tcb, uint8_t priority);
Description. Called when the priority of a running or ready-to-run task changes and the reprioritization will cause a context switch. Two cases:
This function is called only from the NuttX scheduling logic. Interrupts will always be disabled when this function is called.
Inputs:
tcb
: The TCB of the task that has been reprioritized
priority
: The new task priority
_exit()
Prototype: void _exit(int status) noreturn_function;
Description. This function causes the currently executing task to cease to exist. This is a special case of task_delete().
Unlike other UP APIs, this function may be called directly from user programs in various states. The implementation of this function should disable interrupts before performing scheduling operations.
up_assert()
Prototype:
void up_assert(FAR const uint8_t *filename, int linenum);
void up_assert_code(FAR const uint8_t *filename, int linenum, int error_code);
Description. Assertions may be handled in an architecture-specific way.
up_schedule_sigaction()
Prototype:
void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver);
Description. This function is called by the OS when one or more signal handling actions have been queued for execution. The architecture specific code must configure things so that the 'sigdeliver' callback is executed on the thread specified by 'tcb' as soon as possible.
This function may be called from interrupt handling logic.
This operation should not cause the task to be unblocked nor should it cause any immediate execution of sigdeliver. Typically, a few cases need to be considered:
This API is NOT required if CONFIG_DISABLE_SIGNALS
is defined.
up_allocate_heap()
Prototype: void up_allocate_heap(FAR void **heap_start, size_t *heap_size);
Description. The heap may be statically allocated by defining CONFIG_HEAP_BASE and CONFIG_HEAP_SIZE. If these are not defined, then this function will be called to dynamically set aside the heap region.
This API is NOT required if CONFIG_HEAP_BASE
is defined.
up_interrupt_context()
Prototype: bool up_interrupt_context(void)
Description. Return true if we are currently executing in the interrupt handler context.
up_disable_irq()
Prototype:
#ifndef CONFIG_ARCH_NOINTC void up_disable_irq(int irq); #endif
Description. Disable the IRQ specified by 'irq' On many architectures, there are three levels of interrupt enabling: (1) at the global level, (2) at the level of the interrupt controller, and (3) at the device level. In order to receive interrupts, they must be enabled at all three levels.
This function implements enabling of the device specified by 'irq' at the interrupt controller level if supported by the architecture (irqsave() supports the global level, the device level is hardware specific).
If the architecture does not support up_disable_irq
,
CONFIG_ARCH_NOINTC
should be defined in the NuttX configuration file.
Since this API cannot be supported on all architectures, it should be
avoided in common implementations where possible.
up_enable_irq()
Prototype:
#ifndef CONFIG_ARCH_NOINTC void up_enable_irq(int irq); #endif
Description. This function implements disabling of the device specified by 'irq' at the interrupt controller level if supported by the architecture (irqrestore() supports the global level, the device level is hardware specific).
If the architecture does not support up_disable_irq
,
CONFIG_ARCH_NOINTC
should be defined in the NuttX configuration file.
Since this API cannot be supported on all architectures, it should be
avoided in common implementations where possible.
up_prioritize_irq()
Prototype:
#ifdef CONFIG_ARCH_IRQPRIO void up_enable_irq(int irq); #endif
Description. Set the priority of an IRQ.
If the architecture supports up_enable_irq
,
CONFIG_ARCH_IRQPRIO
should be defined in the NuttX configuration file.
Since this API cannot be supported on all architectures, it should be
avoided in common implementations where possible.
up_putc()
Prototype: int up_putc(int ch);
Description. This is a debug interface exported by the architecture-specific logic. Output one character on the console
System Timer
In most implementations, system time is provided by a timer interrupt.
That timer interrupt runs at rate determined by CONFIG_MSEC_PER_TICKS
(default 10 or 100Hz).
The timer generates an interrupt each CONFIG_MSEC_PER_TICKS
milliseconds and increments a counter called g_system_timer
.
g_system_timer
then provides a time-base for calculating up-time and elapsed time intervals in units of CONFIG_MSEC_PER_TICKS
.
System Timer Accuracy
On many system, the exact timer interval specified by CONFIG_MSEC_PER_TICKS
cannot be achieved due to limitations in frequencies or in dividers.
As a result, the time interval specified by CONFIG_MSEC_PER_TICKS
may only be approximate and there may be small errors in the apparent up-time time.
These small errors, however, will accumulate over time and after a long period of time may have an unacceptably large error in the apparent up-time of the MCU.
CONFIG_MSEC_PER_TICKS
and if there you require accurate up-time for the MCU, then there are measures that you can take:
CONFIG_MSEC_PER_TICKS
to a different value so that an exactly CONFIG_MSEC_PER_TICKS
can be accomplished.
Delta-Sigma Modulation Example.
Consider this case: The system timer is a count-up timer driven at 32.768KHz.
There are dividers that can be used, but a divider of one yields the highest accuracy.
This counter counts up until the count equals a match value, then a timer interrupt is generated.
The desire frequency is 100Hz (CONFIG_MSEC_PER_TICKS
is 10).
This exact frequency of 100Hz cannot be obtained in this case. In order to obtain that exact frequency a match value of 327.68 would have to be provided. The closest integer value is 328 but the ideal match value is between 327 and 328. The closest value, 328, would yield an actual timer frequency of 99.9Hz! That will may cause significant timing errors in certain usages.
Use of Delta-Sigma Modulation can eliminate this error in the long run. Consider this example implementation:
accumulator = 0; match = 328;
if (match == 328) { accumulator += 32; // 100*(328 - 327.68) } else { accumulator -= 68; // (100*(327 - 327.68) }
if (accumulator < 0) { match = 328; } else { match = 327; }
In this way, the timer interval is controlled from interrupt-to-interrupt to produce an average frequency of exactly 100Hz.
To enable UTC time representation use option:
CONFIG_SYSTEM_UTC=y
which adds the following variables:
g_system_utc
(seconds, 4 bytes)g_tickcount
(timer ticks, 1-2 bytes typically)and replaces:
g_system_timer
(4 bytes)g_basetime
(8 bytes)g_tickbias
(4 bytes)
Otherwise internal time is computed from 32-bit running tick timer
g_systemtimer
the start date g_basetime
and time offset the g_tickbias
.
To enable hardware module use option:
CONFIG_RTC=y
which requires the following three base functions to read time:
up_rtcinitialize()
up_rtc_gettime()
. UTC time in seconds.up_rtc_getclock()
. Replacement for g_system_tick
This module depends on CONFIG_SYSTEM_UTC=y
.
The system tick is represented by, when CONFIG_SYSTEM_UTC=n
:
g_system_timer
or, when CONFIG_SYSTEM_UTC=y
g_tickcount
g_system_utc
Running at rate of system base timer, used for time-slicing, and so forth.
If hardware RTC is present (CONFIG_RTC
) and enabled, then after successful
initiliazation variables are overriden by calls to up_rtc_getclock()
which is
running continously even in power-down modes.
In the case of CONFIG_RTC
is set the g_tickcount
and g_system_utc
keep
counting at rate of a system timer, which however, is disabled in power-down
mode. By comparing this time and RTC (actual time) one may determine the
actual system active time. To retrieve that variable use:
clock_gettime(CLOCK_ACTIVETIME, tp)
If the CLOCK_ACTIVETIME
time is never set it will serve as power-up time
minus all deep sleeps.
These are standard interfaces that are exported by the OS for use by the architecture specific logic.
os_start()
To be provided
To be provided
sched_process_timer()
Prototype: void sched_process_timer(void);
Description.
This function handles system timer events.
The timer interrupt logic itself is implemented in the
architecture specific code, but must call the following OS
function periodically -- the calling interval must be
MSEC_PER_TICK
.
irq_dispatch()
Prototype: void irq_dispatch(int irq, FAR void *context);
Description. This function must be called from the architecture- specific logic in order to display an interrupt to the appropriate, registered handling logic.
The NuttX On-Demand Paging feature permits embedded MCUs with some limited RAM space to execute large programs from some non-random access media. If the platform meets certiain requirements, then NuttX can provide on-demand paging: It can copy .text from the large program in non-volatile media into RAM as needed to execute a huge program from the small RAM. Design and porting issues for this feature are discussed in a sepate document. Please see the NuttX Demand Paging design document for further information.
A board architecture may or may not have LEDs.
If the board does have LEDs, then most architectures provide similar LED support that is enabled when CONFIG_ARCH_LEDS
is selected in the NuttX configuration file.
This LED support is part of architecture-specific logic and is not managed by the core NuttX logic.
However, the support provided by each architecture is sufficiently similar that it can be documented here.
LED-related definitions are provided in two header files:
board.h
that resides
in the <board-name>/include/board.h
file (which is also
linked to include/arch/board/board.h
when the RTOS is configured).
Those definitions are discussed below.
<arch-name>/src/common/up_internal.h
,
but could be at other locations in particular architectures.
These prototypes are discussed below.
The implementation of LED support is very specific to a board architecture. Some boards have several LEDS, others have only one or two. Some have none. Others LED matrices and show alphanumeric data, etc. The NuttX logic does not refer to specific LEDS, rather, it refers to an event to be shown on the LEDS in whatever manner is appropriate for the board; the way that this event is presented depends upon the hardware available on the board.
The model used by NuttX is that the board can show 8 events defined as follows in <board-name>/include/board.h
:
#define LED_STARTED ?? #define LED_HEAPALLOCATE ?? #define LED_IRQSENABLED ?? #define LED_STACKCREATED ?? #define LED_INIRQ ?? #define LED_SIGNAL ?? #define LED_ASSERTION ?? #define LED_PANIC ??
The specific value assigned to each pre-processor variable can be whatever makes the implementation easiest for the board logic. The meaning associated with each definition is as follows:
LED_STARTED
is the value that describes the setting of the LEDs when the LED logic is first initialized.
This LED value is set but never cleared.
LED_HEAPALLOCATE
indicates that the NuttX heap has been configured.
This is an important place in the boot sequence because if the memory is configured wrong, it will probably crash leaving this LED setting.
This LED value is set but never cleared.
LED_IRQSENABLED
indicates that interrupts have been enabled.
Again, during bring-up (or if there are hardware problems), it is very likely that the system may crash just when interrupts are enabled, leaving this setting on the LEDs.
This LED value is set but never cleared.
LED_STACKCREATED
is set each time a new stack is created.
If set, it means that the system attempted to start at least one new thread.
This LED value is set but never cleared.
LED_INIRQ
is set and cleared on entry and exit from each interrupt.
If interrupts are working okay, this LED will have a dull glow.
LED_SIGNAL
is set and cleared on entry and exit from a signal handler.
Signal handlers are tricky so this is especially useful during bring-up or a new architecture.
LED_ASSERTION
is set if an assertion occurs.
LED_PANIC
will blink at around 1Hz if the system panics and hangs.
The <arch-name>/src/common/up_internal.h
probably has definitions
like:
/* Defined in board/up_leds.c */ #ifdef CONFIG_ARCH_LEDS extern void up_ledinit(void); extern void up_ledon(int led); extern void up_ledoff(int led); #else # define up_ledinit() # define up_ledon(led) # define up_ledoff(led) #endif
Where:
void up_ledinit(void)
is called early in power-up initialization to initialize the LED hardware.
up_ledon(int led)
is called to instantiate the LED presentation of the event.
The led
argument is one of the definitions provided in <board-name>/include/board.h
.
up_ledoff(int led
is called to terminate the LED presentation of the event.
The led
argument is one of the definitions provided in <board-name>/include/board.h
.
Note that only LED_INIRQ
, LED_SIGNAL
, LED_ASSERTION
, and LED_PANIC
indications are terminated.
5.0 NuttX File System |
Overview. NuttX includes an optional, scalable file system. This file-system may be omitted altogether; NuttX does not depend on the presence of any file system.
Pseudo Root File System.
Or, a simple in-memory, pseudo file system can be enabled.
This simple file system can be enabled setting the CONFIG_NFILE_DESCRIPTORS
option to a non-zero value (see Appendix A).
This is an in-memory file system because it does not require any
storage medium or block driver support.
Rather, file system contents are generated on-the-fly as referenced via
standard file system operations (open, close, read, write, etc.).
In this sense, the file system is pseudo file system (in the
same sense that the Linux /proc
file system is also
referred to as a pseudo file system).
Any user supplied data or logic can be accessed via the pseudo-file system.
Built in support is provided for character and block drivers in the
/dev
pseudo file system directory.
Mounted File Systems
The simple in-memory file system can be extended my mounting block
devices that provide access to true file systems backed up via some
mass storage device.
NuttX supports the standard mount()
command that allows
a block driver to be bound to a mountpoint within the pseudo file system
and to a file system.
At present, NuttX supports the standard VFAT and ROMFS file systems and
well as a special, wear-leveling NuttX FLASH File System (NXFFS).
Comparison to Linux From a programming perspective, the NuttX file system appears very similar to a Linux file system. However, there is a fundamental difference: The NuttX root file system is a pseudo file system and true file systems may be mounted in the pseudo file system. In the typical Linux installation by comparison, the Linux root file system is a true file system and pseudo file systems may be mounted in the true, root file system. The approach selected by NuttX is intended to support greater scalability from the very tiny platform to the moderate platform.
6.0 NuttX Device Drivers |
NuttX supports a variety of device drivers including:
Character device drivers have these properties:
include/nuttx/fs.h
.
All structures and APIs needed to work with character drivers are provided in this header file.
struct file_operations
.
Each character device driver must implement an instance of struct file_operations
.
That structure defines a call table with the following methods:
int open(FAR struct file *filp);
int close(FAR struct file *filp);
ssize_t read(FAR struct file *filp, FAR char *buffer, size_t buflen);
ssize_t write(FAR struct file *filp, FAR const char *buffer, size_t buflen);
off_t seek(FAR struct file *filp, off_t offset, int whence);
int ioctl(FAR struct file *filp, int cmd, unsigned long arg);
int poll(FAR struct file *filp, struct pollfd *fds, bool setup);
int register_driver(const char *path, const struct file_operations *fops, mode_t mode, void *priv);
.
Each character driver registers itself by calling register_driver()
, passing it the
path
where it will appear in the pseudo-file-system and it's
initialized instance of struct file_operations
.
User Access.
After it has been registered, the character driver can be accessed by user code using the standard
driver operations including
open()
, close()
, read()
, write()
, etc.
Examples:
drivers/dev_null.c
, drivers/fifo.c
, drivers/serial.c
, etc.
Block device drivers have these properties:
include/nuttx/fs.h
.
All structures and APIs needed to work with block drivers are provided in this header file.
struct block_operations
.
Each block device driver must implement an instance of struct block_operations
.
That structure defines a call table with the following methods:
int open(FAR struct inode *inode);
int close(FAR struct inode *inode);
ssize_t read(FAR struct inode *inode, FAR unsigned char *buffer, size_t start_sector, unsigned int nsectors);
ssize_t write(FAR struct inode *inode, FAR const unsigned char *buffer, size_t start_sector, unsigned int nsectors);
int geometry(FAR struct inode *inode, FAR struct geometry *geometry);
int ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
int register_blockdriver(const char *path, const struct block_operations *bops, mode_t mode, void *priv);
.
Each block driver registers itself by calling register_blockdriver()
, passing it the
path
where it will appear in the pseudo-file-system and it's
initialized instance of struct block_operations
.
User Access.
Users do not normally access block drivers directly, rather, they access block drivers
indirectly through the mount()
API.
The mount()
API binds a block driver instance with a file system and with a mountpoint.
Then the user may use the block driver to access the file system on the underlying media.
Example: See the cmd_mount()
implementation in apps/nshlib/nsh_fscmds.c
.
Accessing a Character Driver as a Block Device.
See the loop device at drivers/loop.c
.
Example: See the cmd_losetup()
implementation in apps/nshlib/nsh_fscmds.c
.
Accessing a Block Driver as Character Device.
See the Block-to-Character (BCH) conversion logic in drivers/bch/
.
Example: See the cmd_dd()
implementation in apps/nshlib/nsh_ddcmd.c
.
Examples.
drivers/loop.c
, drivers/mmcsd/mmcsd_spi.c
, drivers/ramdisk.c
, etc.
include/net/uip/uip-arch.h
.
All structures and APIs needed to work with Ethernet drivers are provided in this header file.
The structure struct uip_driver_s
defines the interface and is passed to uIP via
netdev_register()
.
int netdev_register(FAR struct uip_driver_s *dev);
.
Each Ethernet driver registers itself by calling netdev_register()
.
Examples:
drivers/net/dm90x0.c
, arch/drivers/arm/src/c5471/c5471_ethernet.c
, arch/z80/src/ez80/ez80_emac.c
, etc.
include/nuttx/spi.h
.
All structures and APIs needed to work with SPI drivers are provided in this header file.
struct spi_ops_s
.
Each SPI device driver must implement an instance of struct spi_ops_s
.
That structure defines a call table with the following methods:
void lock(FAR struct spi_dev_s *dev);
void select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
uint32_t setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
void setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
void setbits(FAR struct spi_dev_s *dev, int nbits);
uint8_t status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
uint16_t send(FAR struct spi_dev_s *dev, uint16_t wd);
void exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords);
int registercallback(FAR struct spi_dev_s *dev, mediachange_t callback, void *arg);
Binding SPI Drivers.
SPI drivers are not normally directly accessed by user code, but are usually bound to another,
higher level device driver.
See for example, int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi)
in drivers/mmcsd/mmcsd_spi.c
.
In general, the binding sequence is:
struct spi_dev_s
from the hardware-specific SPI device driver, and
Examples:
drivers/loop.c
, drivers/mmcsd/mmcsd_spi.c
, drivers/ramdisk.c
, etc.
include/nuttx/i2c/i2c.h
.
All structures and APIs needed to work with I2C drivers are provided in this header file.
struct i2c_ops_s
.
Each I2C device driver must implement an instance of struct i2c_ops_s
.
That structure defines a call table with the following methods:
uint32_t setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency);
int setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits);
int write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen);
int read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
Binding I2C Drivers. I2C drivers are not normally directly accessed by user code, but are usually bound to another, higher level device driver. In general, the binding sequence is:
struct i2c_dev_s
from the hardware-specific I2C device driver, and
Examples:
arch/z80/src/ez80/ez80_i2c.c
, arch/z80/src/z8/z8_i2c.c
, etc.
include/nuttx/serial.h
.
All structures and APIs needed to work with serial drivers are provided in this header file.
struct uart_ops_s
.
Each serial device driver must implement an instance of struct uart_ops_s
.
That structure defines a call table with the following methods:
int setup(FAR struct uart_dev_s *dev);
void shutdown(FAR struct uart_dev_s *dev);
int attach(FAR struct uart_dev_s *dev);
void detach(FAR struct uart_dev_s *dev);
int ioctl(FAR struct file *filep, int cmd, unsigned long arg);
int receive(FAR struct uart_dev_s *dev, unsigned int *status);
void rxint(FAR struct uart_dev_s *dev, bool enable);
bool rxavailable(FAR struct uart_dev_s *dev);
void send(FAR struct uart_dev_s *dev, int ch);
void txint(FAR struct uart_dev_s *dev, bool enable);
bool txready(FAR struct uart_dev_s *dev);
bool txempty(FAR struct uart_dev_s *dev);
int uart_register(FAR const char *path, FAR uart_dev_t *dev);
.
A serial driver may register itself by calling uart_register()
, passing it the
path
where it will appear in the pseudo-file-system and it's
initialized instance of struct uart_ops_s
.
By convention, serial device drivers are registered at paths like /dev/ttyS0
, /dev/ttyS1
, etc.
See the uart_register()
implementation in drivers/serial.c
.
User Access. Serial drivers are, ultimately, normal character drivers and are accessed as other character drivers.
Examples:
arch/arm/src/chip/lm3s_serial.c
, arch/arm/src/lpc214x/lpc214x_serial.c
, arch/z16/src/z16f/z16f_serial.c
, etc.
include/nuttx/fb.h
.
All structures and APIs needed to work with frame buffer drivers are provided in this header file.
struct fb_vtable_s
.
Each frame buffer device driver must implement an instance of struct fb_vtable_s
.
That structure defines a call table with the following methods:
Get information about the video controller configuration and the configuration of each color plane.
int (*getvideoinfo)(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo);
int (*getplaneinfo)(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo);
The following are provided only if the video hardware supports RGB color mapping:
int (*getcmap)(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap);
int (*putcmap)(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap);
The following are provided only if the video hardware supports a hardware cursor:
int (*getcursor)(FAR struct fb_vtable_s *vtable, FAR struct fb_cursorattrib_s *attrib);
int (*setcursor)(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings);
Binding Frame Buffer Drivers. Frame buffer drivers are not normally directly accessed by user code, but are usually bound to another, higher level device driver. In general, the binding sequence is:
struct fb_vtable_s
from the hardware-specific frame buffer device driver, and
Examples:
arch/sim/src/up_framebuffer.c
.
See also the usage of the frame buffer driver in the graphics/
directory.
include/nuttx/lcd/lcd.h
.
Structures and APIs needed to work with LCD drivers are provided in this header file.
This header file also depends on some of the same definitions used for the frame buffer driver as privided in include/nuttx/fb.h
.
struct lcd_dev_s
.
Each LCD device driver must implement an instance of struct lcd_dev_s
.
That structure defines a call table with the following methods:
Get information about the LCD video controller configuration and the configuration of each LCD color plane.
int (*getvideoinfo)(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo);
int (*getplaneinfo)(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo);
The following are provided only if the video hardware supports RGB color mapping:
int (*getcmap)(FAR struct lcd_dev_s *dev, FAR struct fb_cmap_s *cmap);
int (*putcmap)(FAR struct lcd_dev_s *dev, FAR const struct fb_cmap_s *cmap);
The following are provided only if the video hardware supports a hardware cursor:
int (*getcursor)(FAR struct lcd_dev_s *dev, FAR struct fb_cursorattrib_s *attrib);
int (*setcursor)(FAR struct lcd_dev_s *dev, FAR struct fb_setcursor_s *settings)
Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER
: full on).
On backlit LCDs, this setting may correspond to the backlight setting.
int (*getpower)(struct lcd_dev_s *dev);
Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER
: full on).
On backlit LCDs, this setting may correspond to the backlight setting.
int (*setpower)(struct lcd_dev_s *dev, int power);
Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST) */
int (*getcontrast)(struct lcd_dev_s *dev);
Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST)
int (*setcontrast)(struct lcd_dev_s *dev, unsigned int contrast);
Binding LCD Drivers. LCD drivers are not normally directly accessed by user code, but are usually bound to another, higher level device driver. In general, the binding sequence is:
struct lcd_dev_s
from the hardware-specific LCD device driver, and
Examples:
drivers/lcd/nokia6100.c
, drivers/lcd/p14201.c
, configs/sam3u-ek/src/up_lcd.c.
See also the usage of the LCD driver in the graphics/
directory.
include/nuttx/mtd.h
.
All structures and APIs needed to work with MTD drivers are provided in this header file.
struct mtd_dev_s
.
Each MTD device driver must implement an instance of struct mtd_dev_s
.
That structure defines a call table with the following methods:
Erase the specified erase blocks (units are erase blocks):
int (*erase)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks);
Read/write from the specified read/write blocks:
ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, FAR uint8_t *buffer);
ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, FAR const uint8_t *buffer);
Some devices may support byte oriented reads (optional). Most MTD devices are inherently block oriented so byte-oriented writing is not supported. It is recommended that low-level drivers not support read() if it requires buffering.
ssize_t (*read)(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, FAR uint8_t *buffer);
Support other, less frequently used commands:
MTDIOC_GEOMETRY
: Get MTD geometryMTDIOC_XIPBASE:
: Convert block to physical address for eXecute-In-PlaceMTDIOC_BULKERASE
: Erase the entire device
is provided via a sinble ioctl
method (see include/nuttx/ioctl.h
):
int (*ioctl)(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg);
Binding MTD Drivers. MTD drivers are not normally directly accessed by user code, but are usually bound to another, higher level device driver. In general, the binding sequence is:
struct mtd_dev_s
from the hardware-specific MTD device driver, and
Examples:
drivers/mtd/m25px.c
and drivers/mtd/ftl.c
include/nuttx/sdio.h
.
All structures and APIs needed to work with SDIO drivers are provided in this header file.
struct sdio_dev_s
.
Each SDIOI device driver must implement an instance of struct sdio_dev_s
.
That structure defines a call table with the following methods:
Initialization/setup:
void (*reset)(FAR struct sdio_dev_s *dev);
uint8_t (*status)(FAR struct sdio_dev_s *dev);
void (*widebus)(FAR struct sdio_dev_s *dev, bool enable);
void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate);
int (*attach)(FAR struct sdio_dev_s *dev);
Command/Status/Data Transfer:
void (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg);
int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, size_t nbytes);
int (*sendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer, size_t nbytes);
int (*cancel)(FAR struct sdio_dev_s *dev);
int (*waitresponse)(FAR struct sdio_dev_s *dev, uint32_t cmd);
int (*recvR1)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R1);
int (*recvR2)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t R2[4]);
int (*recvR3)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R3);
int (*recvR4)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R4);
int (*recvR5)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R5);
int (*recvR6)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R6);
int (*recvR7)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R7);
Event/Callback support:
void (*waitenable)(FAR struct sdio_dev_s *dev, sdio_eventset_t eventset);
sdio_eventset_t (*eventwait)(FAR struct sdio_dev_s *dev, uint32_t timeout);
void (*callbackenable)(FAR struct sdio_dev_s *dev, sdio_eventset_t eventset);
int (*registercallback)(FAR struct sdio_dev_s *dev, worker_t callback, void *arg);
DMA support:
bool (*dmasupported)(FAR struct sdio_dev_s *dev);
int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, size_t buflen);
int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer, size_t buflen);
Binding SDIO Drivers. SDIO drivers are not normally directly accessed by user code, but are usually bound to another, higher level device driver. In general, the binding sequence is:
struct sdio_dev_s
from the hardware-specific SDIO device driver, and
Examples:
arch/arm/src/stm32/stm32_sdio.c
and drivers/mmcsd/mmcsd_sdio.c
include/nuttx/usb/usbhost.h
.
All structures and APIs needed to work with USB host-side drivers are provided in this header file.
struct usbhost_driver_s
.
Each USB host controller driver must implement an instance of struct usbhost_driver_s
.
This structure is defined in include/nuttx/usb/usbhost.h
.
Examples:
arch/arm/src/lpc17xx/lpc17_usbhost.c
.
struct usbhost_class_s
.
Each USB host class driver must implement an instance of struct usbhost_class_s
.
This structure is also defined in include/nuttx/usb/usbhost.h
.
Examples:
drivers/usbhost/usbhost_storage.c
USB Host Class Driver Registry.
The NuttX USB host infrastructure includes a registry.
During its initialization, each USB host class driver must call the interface, usbhost_registerclass()
in order add its interface to the registery.
Later, when a USB device is connected, the USB host controller will look up the USB host class driver that is needed to support the connected device in this registry.
Examples:
drivers/usbhost/usbhost_registry.c
, drivers/usbhost/usbhost_registerclass.c
, and drivers/usbhost/usbhost_findclass.c
,
Detection and Enumeration of Connected Devices. Each USB host device controller supports two methods that are used to detect and enumeration newly connected devices (and also detect disconnected devices):
int (*wait)(FAR struct usbhost_driver_s *drvr, bool connected);
Wait for a device to be connected or disconnected.
int (*enumerate)(FAR struct usbhost_driver_s *drvr);
Enumerate the connected device.
As part of this enumeration process, the driver will
(1) get the device's configuration descriptor,
(2) extract the class ID info from the configuration descriptor,
(3) call usbhost_findclass(
) to find the class that supports this device,
(4) call the create()
method on the struct usbhost_registry_s interface
to get a class instance, and
finally (5) call the connect()
method of the struct usbhost_class_s
interface.
After that, the class is in charge of the sequence of operations.
Binding USB Host-Side Drivers.
USB host-side controller drivers are not normally directly accessed by user code,
but are usually bound to another, higher level USB host class driver.
The class driver exports the standard NuttX device interface so that the connected USB device can be accessed just as with other, similar, on-board devices.
For example, the USB host mass storage class driver (drivers/usbhost/usbhost_storage.c
) will register a standard, NuttX block driver interface (like /dev/sda
)
that can be used to mount a file system just as with any other other block driver instance.
In general, the binding sequence is:
Each USB host class driver includes an intialization entry point that is called from the
application at initialization time.
This driver calls usbhost_registerclass()
during this initialization in order to makes itself available in the event the the device that it supports is connected.
Examples:
The function usbhost_storageinit()
in the file drivers/usbhost/usbhost_storage.c
Each application must include a waiter thread thread that (1) calls the USB host controller driver's wait()
to detect the connection of a device, and then
(2) call the USB host controller driver's enumerate
method to bind the registered USB host class driver to the USB host controller driver.
Examples:
The function nsh_waiter()
in the file configs/nucleus2g/src/up_nsh.c
and
the function nsh_waiter()
in the file configs/olimex-lpc1766stk/src/up_nsh.c
.
As part of its operation during the binding operation, the USB host class driver will register an instances of a standard NuttX driver under the /dev
directory.
To repeat the above example, the USB host mass storage class driver (drivers/usbhost/usbhost_storage.c
) will register a standard, NuttX block driver interface (like /dev/sda
)
that can be used to mount a file system just as with any other other block driver instance.
Examples:
See the call to register_blockdriver()
in the function usbhost_initvolume()
in the file drivers/usbhost/usbhost_storage.c
.
include/nuttx/usb/usbdev.h
.
All structures and APIs needed to work with USB device-side drivers are provided in this header file.
include/nuttx/usb/usbdev_trace.h
.
Declarations needed to work the the NuttX USB device driver trace capability.
That USB trace capability is detailed in separate document.
struct usbdev_s
.
Each USB device controller driver must implement an instance of struct usbdev_s
.
This structure is defined in include/nuttx/usb/usbdev.h
.
Examples:
arch/arm/src/dm320/dm320_usbdev.c
, arch/arm/src/lpc17xx/lpc17_usbdev.c
,
arch/arm/src/lpc214x/lpc214x_usbdev.c
, arch/arm/src/lpc313x/lpc313x_usbdev.c
, and
arch/arm/src/stm32/stm32_usbdev.c
.
struct usbdevclass_driver_s
.
Each USB device class driver must implement an instance of struct usbdevclass_driver_s
.
This structure is also defined in include/nuttx/usb/usbdev.h
.
Examples:
drivers/usbdev/usbdev_serial.c
and drivers/usbdev/usbdev_storage.c
Binding USB Device-Side Drivers. USB device-side controller drivers are not normally directly accessed by user code, but are usually bound to another, higher level USB device class driver. The class driver is then configured to export the USB device functionality. In general, the binding sequence is:
Each USB device class driver includes an intialization entry point that is called from the application at initialization time.
Examples:
The function usbdev_serialinitialize()
in the file drivers/usbdev/usbdev_serial.c
and
the function in the file
drivers/usbdev/usbdev_storage.c
These initialization functions called the driver API, usbdev_register()
.
This driver function will bind the USB class driver to the USB device controller driver,
completing the initialization.
Appendix A: NuttX Configuration Settings |
The following variables are recognized by the build (you may also include architecture-specific settings).
The following configuration items select the architecture, chip, and board configuration for the build.
CONFIG_ARCH
:
Identifies the arch subdirectoryCONFIG_ARCH_name
:
For use in C codeCONFIG_ARCH_CHIP
:
Identifies the arch/*/chip subdirectoryCONFIG_ARCH_CHIP_name
:
For use in C codeCONFIG_ARCH_BOARD
:
Identifies the configs subdirectory and hence, the board that supports
the particular chip or SoC.CONFIG_ARCH_BOARD_name
:
For use in C codeCONFIG_ENDIAN_BIG
:
Define if big endian (default is little endian).CONFIG_ARCH_NOINTC
:
Define if the architecture does not support an interrupt controller
or otherwise cannot support APIs like up_enable_irq() and up_disable_irq().CONFIG_ARCH_IRQPRIO
:
Define if the architecture supports prioritization of interrupts and the
up_prioritize_irq() API.Some architectures require a description of the RAM configuration:
CONFIG_DRAM_SIZE
:
Describes the installed DRAM.CONFIG_DRAM_START
:
The start address of DRAM (physical)CONFIG_DRAM_VSTART
:
The start address of DRAM (virtual)General build options:
CONFIG_RRLOAD_BINARY
:
Make the rrload binary format used with BSPs from ridgerun.com
using the tools/mkimage.sh
script.
CONFIG_INTELHEX_BINARY
:
Make the Intel HEX binary format used with many different loaders using the GNU objcopy program
This option should not be selected if you are not using the GNU toolchain.
CONFIG_MOTOROLA_SREC
:
Make the Motorola S-Record binary format used with many different loaders using the GNU objcopy program
Should not be selected if you are not using the GNU toolchain.
CONFIG_RAW_BINARY
:
Make a raw binary format file used with many different loaders using the GNU objcopy program.
This option should not be selected if you are not using the GNU toolchain.
CONFIG_HAVE_LIBM
:
Toolchain supports libm.a
CONFIG_HAVE_CXX
:
Toolchain supports C++ and CXX
, CXXFLAGS
, and COMPILEXX
have been defined in the configurations Make.defs
file.
Building application code:
CONFIG_APPS_DIR
: Identifies the directory that builds the application to link with NuttX.
This symbol must be assigned to the path of the application build directory relative to the NuttX top build directory.
If the application resides in the top-level ../apps/
directory, it is not necessary to define CONFIG_APPS_DIR
.
If you have an application directory and the NuttX directory each in separate directories such as this:
build |-nuttx | | | `- Makefile `-application | `- Makefile
CONFIG_APPS_DIR=../application
.
The default value of CONFIG_APPS_DIR
is ../apps/
.
The application direction must contain Makefile
and this make file must support the following targets:
libapps$(LIBEXT)
(usually libapps.a
).
libapps.a
is a static library ( an archive) that contains all of application object files.
clean
.
Do whatever is appropriate to clean the application directories for a fresh build.
distclean
.
Clean everthing -- auto-generated files, symbolic links etc. -- so that the directory contents are the same as the contents in your configuration management system.
This is only done when you change the NuttX configuration.
context
.
Perform one-time configuration-related setup.
This might includes such things as creating auto-generated files or symbolic links for directory configurations.
depend
.
Make or update the application build dependencies.
When this application is invoked it will receive the setting TOPDIR
like:
$(MAKE) -C $(CONFIG_APPS_DIR) TOPDIR="$(TOPDIR)"
<target>
TOPDIR
is the full path to the NuttX directory.
It can be used, for example, to include makefile fragments (e.g., .config
or Make.defs
) or to set up include file paths.
Two-pass Build Options. If the 2 pass build option is selected, then these options configure the make system build a extra link object. This link object is assumed to be an incremental (relative) link object, but could be a static library (archive) (some modification to this Makefile would be required if CONFIG_PASS1_TARGET generates an archive). Pass 1 1ncremental (relative) link objects should be put into the processor-specific source directory where other link objects will be created - ff the pass1 obect is an archive, it could go anywhere.
CONFIG_BUILD_2PASS
:
Enables the two pass build options.
When the two pass build option is enabled, the following also apply:
CONFIG_PASS1_TARGET
: The name of the first pass build target.
CONFIG_PASS1_BUILDIR
:
The path, relative to the top NuttX build directory to directory that contains the Makefile to build the first pass object. The Makefile must support the following targets:
CONFIG_PASS1_TARGET
(if defined), andCONFIG_PASS1_OBJECT
: May be used to include an extra, pass1 object into the final link.
This would probably be the object generated from the CONFIG_PASS1_TARGET
.
It may be available at link time in the arch/<architecture>/src
directory.
CONFIG_DEBUG
: enables built-in debug options
CONFIG_DEBUG_VERBOSE
: enables verbose debug output
CONFIG_DEBUG_SYMBOLS
: build without optimization and with debug symbols (needed for use with a debugger).
CONFIG_DEBUG_SCHED
: enable OS debug output (disabled by default)
CONFIG_DEBUG_MM
: enable memory management debug output (disabled by default)
CONFIG_DEBUG_NET
: enable network debug output (disabled by default)
CONFIG_DEBUG_USB
: enable USB debug output (disabled by default)
CONFIG_DEBUG_FS
: enable file system debug output (disabled by default)
CONFIG_DEBUG_LIB
: enable C library debug output (disabled by default)
CONFIG_DEBUG_BINFMT
: enable binary loader debug output (disabled by default)
CONFIG_DEBUG_GRAPHICS
: enable NX graphics debug output (disabled by default)
CONFIG_ARCH_LOWPUTC
: architecture supports low-level, boot
time console output
CONFIG_NUTTX_KERNEL
:
With most MCUs, NuttX is built as a flat, single executable image
containing the NuttX RTOS along with all application code.
The RTOS code and the application run in the same address space and at the same kernel-mode privileges.
If this option is selected, NuttX will be built separately as a monolithic, kernel-mode module and the applications
can be added as a separately built, user-mode module.
In this a system call layer will be built to support the user- to kernel-mode interface to the RTOS.
CONFIG_MM_REGIONS
: If the architecture includes multiple
regions of memory to allocate from, this specifies the
number of memory regions that the memory manager must
handle and enables the API mm_addregion(start, end);
CONFIG_MSEC_PER_TICK
: The default system timer is 100Hz
or MSEC_PER_TICK
=10. This setting may be defined to inform NuttX
that the processor hardware is providing system timer interrupts at some interrupt
interval other than 10 msec.
CONFIG_RR_INTERVAL
: The round robin time slice will be set
this number of milliseconds; Round robin scheduling can
be disabled by setting this value to zero.
CONFIG_SCHED_INSTRUMENTATION
: enables instrumentation in
scheduler to monitor system performance
CONFIG_TASK_NAME_SIZE
: Specifies that maximum size of a
task name to save in the TCB. Useful if scheduler
instrumentation is selected. Set to zero to disable.
CONFIG_START_YEAR
, CONFIG_START_MONTH
, CONFIG_START_DAY
-
Used to initialize the internal time logic.
CONFIG_GREGORIAN_TIME
: Enables Gregorian time conversions.
You would only need this if you are concerned about accurate time conversions in
the recent past or in the distant future.
CONFIG_JULIAN_TIME
: Enables Julian time conversions.
You would only need this if you are concerned about accurate time conversion in the distand past.
You must also define CONFIG_GREGORIAN_TIME
in order to use Julian time.
CONFIG_DEV_CONSOLE
: Set if architecture-specific logic
provides /dev/console. Enables stdout, stderr, stdin.
CONFIG_MUTEX_TYPES
: Set to enable support for recursive and
errorcheck mutexes. Enables pthread_mutexattr_settype()
.
CONFIG_PRIORITY_INHERITANCE
: Set to enable support for
priority inheritance on mutexes and semaphores.
Priority inheritance is a strategy of addressing
priority inversion.
Details of the NuttX implementation of priority inheritance is
discussed elsewhere.
CONFIG_SEM_PREALLOCHOLDERS
: This setting is only used
if priority inheritance is enabled.
It defines the maximum number of different threads (minus one) that
can take counts on a semaphore with priority inheritance support.
This may be set to zero if priority inheritance is disabled OR if you
are only using semaphores as mutexes (only one holder) OR if no more
than two threads participate using a counting semaphore.
CONFIG_SEM_NNESTPRIO
: If priority inheritance is enabled,
then this setting is the maximum number of higher priority threads (minus
1) than can be waiting for another thread to release a count on a semaphore.
This value may be set to zero if no more than one thread is expected to
wait for a semaphore.
CONFIG_FDCLONE_DISABLE
: Disable cloning of all file descriptors
by task_create() when a new task is started.
If set, all files/drivers will appear to be closed in the new task.
CONFIG_FDCLONE_STDIO
: Disable cloning of all but the first
three file descriptors (stdin, stdout, stderr) by task_create()
when a new task is started.
If set, all files/drivers will appear to be closed in the new task except
for stdin, stdout, and stderr.
CONFIG_SDCLONE_DISABLE
: Disable cloning of all socket
desciptors by task_create() when a new task is started.
If set, all sockets will appear to be closed in the new task.
CONFIG_NXFLAT
: Enable support for the NXFLAT binary format.
This format will support execution of NuttX binaries located
in a ROMFS file system (see apps/examples/nxflat
).
CONFIG_SCHED_WORKQUEUE
: Create a dedicated "worker" thread to
handle delayed processing from interrupt handlers. This feature
is required for some drivers but, if there are not complaints,
can be safely disabled. The worker thread also performs
garbage collection -- completing any delayed memory deallocations
from interrupt handlers. If the worker thread is disabled,
then that clean will be performed by the IDLE thread instead
(which runs at the lowest of priority and may not be appropriate
if memory reclamation is of high priority). If CONFIG_SCHED_WORKQUEUE
is enabled, then the following options can also be used:
CONFIG_SCHED_WORKPRIORITY
: The execution priority of the worker
thread. Default: 50
CONFIG_SCHED_WORKPERIOD
: How often the worker thread checks for
work in units of microseconds. Default: 50*1000 (50 MS).
CONFIG_SCHED_WORKSTACKSIZE
: The stack size allocated for the worker
thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
CONFIG_SIG_SIGWORK
: The signal number that will be used to wake-up
the worker thread. Default: 4
Kernel build options:
CONFIG_NUTTX_KERNEL
: Builds NuttX as a separately compiled kernel.
CONFIG_SYS_RESERVED
: Reserved system call values for use by architecture-specific logic.
OS setup related to on-demand paging:
CONFIG_PAGING
: If set =y in your configation file, this setting will
enable the on-demand paging feature as described in
http://www.nuttx.org/NuttXDemandPaging.html.
If CONFIG_PAGING is selected, then you will probabaly need CONFIG_BUILD_2PASS
to correctly position
the code and the following configuration options also apply:
CONFIG_PAGING_PAGESIZE
:
The size of one managed page.
This must be a value supported by the processor's memory management unit.
CONFIG_PAGING_NLOCKED
:
This is the number of locked pages in the memory map.
The locked address region will then be from CONFIG_DRAM_VSTART
through
(CONFIG_DRAM_VSTART
+ CONFIG_PAGING_PAGESIZE
*CONFIG_PAGING_NLOCKED
)
CONFIG_PAGING_LOCKED_PBASE
and CONFIG_PAGING_LOCKED_VBASE
:
These may be defined to determine the base address of the locked page regions.
If neither are defined, the logic will be set the bases to CONFIG_DRAM_START
and CONFIG_DRAM_VSTART
(i.e., it assumes that the base address of the locked
region is at the beginning of RAM).
NOTE:
In some architectures, it may be necessary to take some memory from the beginning
of this region for vectors or for a page table.
In such cases, CONFIG_PAGING_LOCKED_P/VBASE
should take that into consideration
to prevent overlapping the locked memory region and the system data at the beginning of SRAM.
CONFIG_PAGING_NPPAGED
:
This is the number of physical pages available to support the paged text region.
This paged region begins at
(CONFIG_PAGING_LOCKED_PBASE
+ CONFIG_PAGING_PAGESIZE
*CONFIG_PAGING_NPPAGED
)
and continues until
(CONFIG_PAGING_LOCKED_PBASE
+ CONFIG_PAGING_PAGESIZE
*(CONFIG_PAGING_NLOCKED
+
CONFIG_PAGING_NPPAGED
)
CONFIG_PAGING_NVPAGED
:
This actual size of the paged text region (in pages).
This is also the number of virtual pages required to support the entire paged region.
The on-demand paging feature is intended to support only the case where the virtual paged text
area is much larger the available physical pages.
Otherwise, why would you enable on-demand paging?
CONFIG_PAGING_NDATA
:
This is the number of data pages in the memory map.
The data region will extend to the end of RAM unless overridden by a setting in the configuration file.
NOTE:
In some architectures, it may be necessary to take some memory from the end of RAM for page tables
or other system usage.
The configuration settings and linker directives must be cognizant of that:
CONFIG_PAGING_NDATA
should be defined to prevent the data region from extending all the way to the end of memory.
CONFIG_PAGING_DEFPRIO
:
The default, minimum priority of the page fill worker thread.
The priority of the page fill work thread will be boosted boosted dynmically so that it matches the
priority of the task on behalf of which it peforms the fill.
This defines the minimum priority that will be used. Default: 50.
CONFIG_PAGING_STACKSIZE
:
Defines the size of the allocated stack for the page fill worker thread. Default: 1024.
CONFIG_PAGING_BLOCKINGFILL
:
The architecture specific up_fillpage()
function may be blocking or non-blocking.
If defined, this setting indicates that the up_fillpage()
implementation will block until the
transfer is completed. Default: Undefined (non-blocking).
CONFIG_PAGING_WORKPERIOD
:
The page fill worker thread will wake periodically even if there is no mapping to do.
This selection controls that wake-up period (in microseconds).
This wake-up a failsafe that will handle any cases where a single is lost (that would
really be a bug and shouldn't happen!)
and also supports timeouts for case of non-blocking, asynchronous fills (see CONFIG_PAGING_TIMEOUT_TICKS
).
CONFIG_PAGING_TIMEOUT_TICKS
:
If defined, the implementation will monitor the (asynchronous) page fill logic.
If the fill takes longer than this number if microseconds, then a fatal error will be declared.
Default: No timeouts monitored.
Some architecture-specific settings. Defaults are architecture specific. If you don't know what you are doing, it is best to leave these undefined and try the system defaults:
CONFIG_PAGING_VECPPAGE
:
This the physical address of the page in memory to be mapped to the vector address.
CONFIG_PAGING_VECL2PADDR
:
This is the physical address of the L2 page table entry to use for the vector mapping.
CONFIG_PAGING_VECL2VADDR
:
This is the virtual address of the L2 page table entry to use for the vector mapping.
CONFIG_PAGING_BINPATH
:
If CONFIG_PAGING_BINPATH
is defined, then it is the full path to a file on a mounted file system that contains a binary image of the NuttX executable.
Pages will be filled by reading from offsets into this file that correspond to virtual fault addresses.
CONFIG_PAGING_MOUNTPT
:
If CONFIG_PAGING_BINPATH
is defined, additional options may be provided to control the initialization of underlying devices.
CONFIG_PAGING_MOUNTPT
identifies the mountpoint to be used if a device is mounted.
CONFIG_PAGING_MINOR
:
Some mount operations require a "minor" number to identify the specific device instance.
Default: 0
CONFIG_PAGING_SDSLOT
:
If CONFIG_PAGING_BINPATH
is defined, additional options may be provided to control the initialization of underlying devices.
CONFIG_PAGING_SDSLOT
identifies the slot number of the SD device to initialize.
This must be undefined if SD is not being used.
This should be defined to be zero for the typical device that has only a single slot (See CONFIG_MMCSD_NSLOTS
).
If defined, CONFIG_PAGING_SDSLOT
will instruct certain board-specific logic to initialize the media in this SD slot.
CONFIG_PAGING_M25PX
:
Use the m25px.c FLASH driver.
If this is selected, then the MTD interface to the M25Px device will be used to support paging.
CONFIG_PAGING_AT45DB
:
Use the at45db.c FLASH driver.
If this is selected, then the MTD interface to the Atmel AT45DB device will be used to support paging.
CONFIG_PAGING_BINOFFSET
:
If CONFIG_PAGING_M25PX or CONFIG_PAGING_AT45DB is defined then CONFIG_PAGING_BINOFFSET will be used to specify the offset in bytes into the FLASH device where the NuttX binary image is located.
Default: 0
CONFIG_PAGING_SPIPORT
:
If CONFIG_PAGING_M25PX or CONFIG_PAGING_AT45DB is defined and the device has multiple SPI busses (ports), then this configuration should be set to indicate which SPI port the device is connected.
Default: 0
The following can be used to disable categories of APIs supported by the OS. If the compiler supports weak functions, then it should not be necessary to disable functions unless you want to restrict usage of those APIs.
There are certain dependency relationships in these features.
mq_notify()
logic depends on signals to awaken tasks
waiting for queues to become full or empty.
pthread_condtimedwait()
depends on signals to wake
up waiting tasks.
CONFIG_DISABLE_CLOCK
, CONFI_DISABLE_POSIX_TIMERS
,
CONFIG_DISABLE_PTHREAD
, CONFIG_DISABLE_SIGNALS
,
CONFIG_DISABLE_MQUEUE
, CONFIG_DISABLE_MOUNTPOUNT
CONFIG_NOPRINTF_FIELDWIDTH
: sprintf-related logic is a
little smaller if we do not support fieldwidthes
CONFIG_LIBC_FLOATINGPOINT
: By default, floating point
support in printf, sscanf, etc. is disabled.
The architecture can provide optimized versions of the following to improve system performance.
CONFIG_ARCH_MEMCPY
, CONFIG_ARCH_MEMCMP
, CONFIG_ARCH_MEMMOVE
,
CONFIG_ARCH_MEMSET
, CONFIG_ARCH_STRCMP
, CONFIG_ARCH_STRCPY
,
CONFIG_ARCH_STRNCPY
, CONFIG_ARCH_STRLEN
, CONFIG_ARCH_STRNLEN
,
CONFIG_ARCH_BZERO
The architecture may provide custom versions of certain standard header files:
CONFIG_ARCH_MATH_H
, CONFIG_ARCH_STDBOOL_H
, CONFIG_ARCH_STDINT_H
CONFIG_MAX_TASKS
: The maximum number of simultaneously
active tasks. This value must be a power of two.
CONFIG_NPTHREAD_KEYS
: The number of items of thread-
specific data that can be retained
CONFIG_NFILE_DESCRIPTORS
: The maximum number of file
descriptors (one for each open)
CONFIG_NFILE_STREAMS
: The maximum number of streams that
can be fopen'ed
CONFIG_NAME_MAX
: The maximum size of a file name.
CONFIG_STDIO_BUFFER_SIZE
: Size of the buffer to allocate
on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
CONFIG_STDIO_LINEBUFFER
:
If standard C buffered I/O is enabled (CONFIG_STDIO_BUFFER_SIZE
> 0),
then this option may be added to force automatic, line-oriented flushing the output buffer
for putc()
, fputc()
, putchar()
, puts()
, fputs()
,
printf()
, fprintf()
, and vfprintf()
.
When a newline character is encountered in the output string, the output buffer will be flushed.
This (slightly) increases the NuttX footprint but supports the kind of behavior that people expect for printf()
.
CONFIG_NUNGET_CHARS
: Number of characters that can be
buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
CONFIG_PREALLOC_MQ_MSGS
: The number of pre-allocated message
structures. The system manages a pool of preallocated
message structures to minimize dynamic allocations
CONFIG_MQ_MAXMSGSIZE
: Message structures are allocated with
a fixed payload size given by this setting (does not include
other message structure overhead.
CONFIG_PREALLOC_WDOGS
: The number of pre-allocated watchdog
structures. The system manages a pool of preallocated
watchdog structures to minimize dynamic allocations
CONFIG_PREALLOC_IGMPGROUPS
: Pre-allocated IGMP groups are used
Only if needed from interrupt level group created (by the IGMP server).
Default: 4
CONFIG_DEV_PIPE_SIZE
: Size, in bytes, of the buffer to allocated
for pipe and FIFO support (default is 1024).
CONFIG_FS_FAT
: Enable FAT file system support.
CONFIG_FAT_SECTORSIZE
: Max supported sector size.
CONFIG_FS_NXFFS
: Enable NuttX FLASH file system (NXFF) support.
CONFIG_NXFFS_ERASEDSTATE
: The erased state of FLASH.
This must have one of the values of 0xff
or 0x00
.
Default: 0xff
.
CONFIG_NXFFS_PACKTHRESHOLD
: When packing flash file data,
don't both with file chunks smaller than this number of data bytes.
Default: 32.
CONFIG_NXFFS_MAXNAMLEN
: The maximum size of an NXFFS file name.
Default: 255.
CONFIG_NXFFS_PACKTHRESHOLD
: When packing flash file data,
don't both with file chunks smaller than this number of data bytes.
Default: 32.
CONFIG_NXFFS_TAILTHRESHOLD
: clean-up can either mean
packing files together toward the end of the file or, if file are
deleted at the end of the file, clean up can simply mean erasing
the end of FLASH memory so that it can be re-used again. However,
doing this can also harm the life of the FLASH part because it can
mean that the tail end of the FLASH is re-used too often. This
threshold determines if/when it is worth erased the tail end of FLASH
and making it available for re-use (and possible over-wear).
Default: 8192.
CONFIG_FS_ROMFS
: Enable ROMFS file system support
CONFIG_FS_RAMMAP
: For file systems that do not support
XIP, this option will enable a limited form of memory mapping that is
implemented by copying whole files into memory.
CONFIG_SPI_OWNBUS
- Set if there is only one active device
on the SPI bus. No locking or SPI configuration will be performed.
It is not necessary for clients to lock, re-configure, etc..
CONFIG_SPI_EXCHANGE
: Driver supports a single exchange method
(vs a recvblock() and sndblock ()methods)
CONFIG_MMCSD_NSLOTS
: Number of MMC/SD slots supported by the driver. Default is one.
CONFIG_MMCSD_READONLY
: Provide read-only access. Default is Read/Write
CONFIG_MMCSD_SPICLOCK
: Maximum SPI clock to drive MMC/SD card. Default is 20MHz.
CONFIG_FS_READAHEAD
: Enable read-ahead buffering
CONFIG_FS_WRITEBUFFER
: Enable write buffering
CONFIG_SDIO_DMA
: SDIO driver supports DMA
CONFIG_MMCSD_MMCSUPPORT
: Enable support for MMC cards
CONFIG_MMCSD_HAVECARDDETECT
: SDIO driver card detection is 100% accurate
CONFIG_LCD_P14201
: Enable P14201 support
CONFIG_P14201_SPIMODE
: Controls the SPI mode
CONFIG_P14201_FREQUENCY
: Define to use a different bus frequency
CONFIG_P14201_NINTERFACES
:
Specifies the number of physical P14201 devices that will be supported.
CONFIG_P14201_FRAMEBUFFER
:
If defined, accesses will be performed using an in-memory copy of the OLEDs GDDRAM.
This cost of this buffer is 128 * 96 / 2 = 6Kb.
If this is defined, then the driver will be fully functional.
If not, then it will have the following limitations:
CONFIG_NOKIA6100_SPIMODE
: Controls the SPI mode,
CONFIG_NOKIA6100_FREQUENCY
: Define to use a different bus frequency.
CONFIG_NOKIA6100_NINTERFACES
:Specifies the number of physical Nokia
6100 devices that will be supported.
CONFIG_NOKIA6100_BPP
: Device supports 8, 12, and 16 bits per pixel.
CONFIG_NOKIA6100_S1D15G10
: Selects the Epson S1D15G10 display controller
CONFIG_NOKIA6100_PCF8833
: Selects the Phillips PCF8833 display controller
CONFIG_NOKIA6100_BLINIT
: Initial backlight setting
The following may need to be tuned for your hardware:
CONFIG_NOKIA6100_INVERT
: Display inversion, 0 or 1, Default: 1
CONFIG_NOKIA6100_MY
: Display row direction, 0 or 1, Default: 0
CONFIG_NOKIA6100_MX
: Display column direction, 0 or 1, Default: 1
CONFIG_NOKIA6100_V
: Display address direction, 0 or 1, Default: 0
CONFIG_NOKIA6100_ML
: Display scan direction, 0 or 1, Default: 0
CONFIG_NOKIA6100_RGBORD
: Display RGB order, 0 or 1, Default: 0
Required LCD driver settings:
CONFIG_LCD_NOKIA6100
: Enable Nokia 6100 support
CONFIG_LCD_MAXCONTRAST
: Must be 63 with the Epson controller and 127 with
the Phillips controller.
CONFIG_LCD_MAXPOWER
:Maximum value of backlight setting. The backlight
control is managed outside of the 6100 driver so this value has no
meaning to the driver. Board-specific logic may place restrictions on
this value.
CONFIG_NET_ENC28J60
: Enabled ENC28J60 support
CONFIG_ENC28J60_SPIMODE
: Controls the SPI mode
CONFIG_ENC28J60_FREQUENCY
: Define to use a different bus frequency
CONFIG_ENC28J60_NINTERFACES
:
Specifies the number of physical ENC28J60 devices that will be supported.
CONFIG_ENC28J60_STATS
: Collect network statistics
CONFIG_ENC28J60_HALFDUPPLEX
: Default is full duplex
CONFIG_NET
: Enable or disable all network features
CONFIG_NET_SLIP
: Selects the Serial Line Internet Protocol (SLIP) data link layer.
(This selection is discussed further below).
CONFIG_NET_NOINTS
: CONFIG_NET_NOINT
indicates that uIP not called from the interrupt level.
If CONFIG_NET_NOINTS
is defined, critical sections will be managed with semaphores;
Otherwise, it assumed that uIP will be called from interrupt level handling and critical sections will be managed by enabling and disabling interrupts.
CONFIG_NET_MULTIBUFFER
: Traditionally, uIP has used a single buffer for all incoming and outgoing traffic.
If this configuration is selected, then the driver can manage multiple I/O buffers and can, for example, be filling one input buffer while sending another output buffer.
Or, as another example, the driver may support queuing of concurrent input/ouput and output transfers for better performance.
CONFIG_NET_IPv6
: Build in support for IPv6
CONFIG_NSOCKET_DESCRIPTORS
: Maximum number of socket descriptors per task/thread.
CONFIG_NET_NACTIVESOCKETS
: Maximum number of concurrent socket operations (recv, send, etc.).
Default: CONFIG_NET_TCP_CONNS
+CONFIG_NET_UDP_CONNS
.
CONFIG_NET_SOCKOPTS
: Enable or disable support for socket options.
CONFIG_NET_BUFSIZE
: uIP buffer size
CONFIG_NET_TCP
: TCP support on or off
CONFIG_NET_TCP_CONNS
: Maximum number of TCP connections (all tasks).
CONFIG_NET_TCPBACKLOG
:
Incoming connections pend in a backlog until accept()
is called.
The size of the backlog is selected when listen()
is called.
CONFIG_NET_TCP_READAHEAD_BUFSIZE
: Size of TCP read-ahead buffers
CONFIG_NET_NTCP_READAHEAD_BUFFERS
: Number of TCP read-ahead buffers (may be zero)
CONFIG_NET_MAX_LISTENPORTS
: Maximum number of listening TCP ports (all tasks).
CONFIG_NET_TCPURGDATA
: Determines if support for TCP urgent data
notification should be compiled in. Urgent data (out-of-band data)
is a rarely used TCP feature that is very seldom would be required.
CONFIG_NET_UDP
: UDP support on or off
CONFIG_NET_UDP_CHECKSUMS
: UDP checksums on or off
CONFIG_NET_UDP_CONNS
: The maximum amount of concurrent UDP connections
CONFIG_NET_ICMP
: Enable minimal ICMP support. Includes built-in support
for sending replies to received ECHO (ping) requests.
CONFIG_NET_ICMP_PING
: Provide interfaces to support application level
support for sending ECHO (ping) requests and associating ECHO replies.
CONFIG_NET_IGMP
: Enable IGMPv2 client support.
CONFIG_PREALLOC_IGMPGROUPS
: Pre-allocated IGMP groups are used
Only if needed from interrupt level group created (by the IGMP server).
Default: 4
CONFIG_NET_PINGADDRCONF
: Use "ping" packet for setting IP address
CONFIG_NET_STATISTICS
: uIP statistics on or off
CONFIG_NET_RECEIVE_WINDOW
: The size of the advertised receiver's window
CONFIG_NET_ARPTAB_SIZE
: The size of the ARP table
CONFIG_NET_ARP_IPIN
: Harvest IP/MAC address mappings for the ARP table from incoming IP packets.
CONFIG_NET_BROADCAST
: Incoming UDP broadcast support
CONFIG_NET_MULTICAST
: Outgoing multi-cast address support
CONFIG_NET_FWCACHE_SIZE
: number of packets to remember when looking for duplicates
The NuttX SLIP driver supports point-to-point IP communications over a serial port.
The default data link layer for uIP is Ethernet.
If CONFIG_NET_SLIP
is defined in the NuttX configuration file, then SLIP will be supported.
The basic differences between the SLIP and Ethernet configurations is that when SLIP is selected:
CONFIG_NET_SLIP
is not selected, then Ethernet will be used
(there is no need to define anything special in the configuration file to use Ethernet -- it is the default).
CONFIG_NET_SLIP
: Enables building of the SLIP driver.
SLIP requires at least one IP protocols selected and the following additional network settings: CONFIG_NET_NOINTS
and CONFIG_NET_MULTIBUFFER
.
CONFIG_NET_BUFSIZE
must be set to 296.
Other optional configuration settings that affect the SLIP driver: CONFIG_NET_STATISTICS
.
Default: Ethernet.
If SLIP is selected, then the following SLIP options are available:
CONFIG_CLIP_NINTERFACES
: Selects the number of physical SLIP interfaces to support. Default: 1
CONFIG_SLIP_STACKSIZE
: Select the stack size of the SLIP RX and TX tasks. Default: 2048
CONFIG_SLIP_DEFPRIO
: The priority of the SLIP RX and TX tasks. Default: 128
CONFIG_NET_DHCP_LIGHT
: Reduces size of DHCP
CONFIG_NET_RESOLV_ENTRIES
: Number of resolver entries
CONFIG_THTTPD_PORT
: THTTPD Server port number
CONFIG_THTTPD_IPADDR
: Server IP address (no host name)
CONFIG_THTTPD_SERVER_ADDRESS
: SERVER_ADDRESS: response
CONFIG_THTTPD_SERVER_SOFTWARE
: SERVER_SOFTWARE: response
CONFIG_THTTPD_PATH
: Server working directory. Default: /mnt/www
.
CONFIG_THTTPD_CGI_PATH
: Path to CGI executables. Default: /mnt/www/cgi-bin
.
CONFIG_THTTPD_CGI_PATTERN
: Only CGI programs whose expanded paths
match this pattern will be executed. In fact, if this value is not defined
then no CGI logic will be built. Default: /mnt/www/cgi-bin/*
.
CONFIG_THTTPD_CGI_PRIORITY
: Provides the priority of CGI child tasks
CONFIG_THTTPD_CGI_STACKSIZE
: Provides the initial stack size of
CGI child task (will be overridden by the stack size in the NXFLAT
header)
CONFIG_THTTPD_CGI_BYTECOUNT
: Byte output limit for CGI tasks.
CONFIG_THTTPD_CGI_TIMELIMIT
: How many seconds to allow CGI programs
to run before killing them.
CONFIG_THTTPD_CHARSET
: The default character set name to use with
text MIME types.
CONFIG_THTTPD_IOBUFFERSIZE
:
CONFIG_THTTPD_INDEX_NAMES
: A list of index filenames to check. The
files are searched for in this order.
CONFIG_AUTH_FILE
: The file to use for authentication. If this is
defined then thttpd checks for this file in the local directory
before every fetch. If the file exists then authentication is done,
otherwise the fetch proceeds as usual. If you leave this undefined
then thttpd will not implement authentication at all and will not
check for auth files, which saves a bit of CPU time. A typical
value is ".htpasswd&quout;
CONFIG_THTTPD_LISTEN_BACKLOG
: The listen() backlog queue length.
CONFIG_THTTPD_LINGER_MSEC
: How many milliseconds to leave a connection
open while doing a lingering close.
CONFIG_THTTPD_OCCASIONAL_MSEC
: How often to run the occasional
cleanup job.
CONFIG_THTTPD_IDLE_READ_LIMIT_SEC
: How many seconds to allow for
reading the initial request on a new connection.
CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC
: How many seconds before an
idle connection gets closed.
CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2
: Tilde mapping.
Many URLs use ~username to indicate a user's home directory. thttpd
provides two options for mapping this construct to an actual filename.
CONFIG_THTTPD_GENERATE_INDICES
:
CONFIG_THTTPD_URLPATTERN
: If defined, then it will be used to match
and verify referrers.
CONFIG_USBDEV
: Enables USB device support
CONFIG_USBDEV_ISOCHRONOUS
: Build in extra support for isochronous endpoints
CONFIG_USBDEV_DUALSPEED
: Hardware handles high and full speed operation (USB 2.0)
CONFIG_USBDEV_SELFPOWERED
: Will cause USB features to indicate that the device is self-powered
CONFIG_USBDEV_MAXPOWER
: Maximum power consumption in mA
CONFIG_USBDEV_TRACE
: Enables USB tracing for debug
CONFIG_USBDEV_TRACE_NRECORDS
: Number of trace entries to remember
CONFIG_USBSER
: Enable compilation of the USB serial driver
CONFIG_USBSER_EPINTIN
: The logical 7-bit address of a hardware endpoint that supports interrupt IN operation
CONFIG_USBSER_EPBULKOUT
: The logical 7-bit address of a hardware endpoint that supports bulk OUT operation
CONFIG_USBSER_EPBULKIN
: The logical 7-bit address of a hardware endpoint that supports bulk IN operation
CONFIG_USBSER_NWRREQS
and CONFIG_USBSER_NRDREQS
: The number of write/read requests that can be in flight
CONFIG_USBSER_VENDORID
and CONFIG_USBSER_VENDORSTR
: The vendor ID code/string
CONFIG_USBSER_PRODUCTID
and CONFIG_USBSER_PRODUCTSTR
: The product ID code/string
CONFIG_USBSER_RXBUFSIZE
and CONFIG_USBSER_TXBUFSIZE
: Size of the serial receive/transmit buffers
CONFIG_USBSTRG
:
Enable compilation of the USB storage driver
CONFIG_USBSTRG_EP0MAXPACKET
:
Max packet size for endpoint 0
CONFIG_USBSTRGEPBULKOUT
and CONFIG_USBSTRG_EPBULKIN
:
The logical 7-bit address of a hardware endpoints that support bulk OUT and IN operations
CONFIG_USBSTRG_NWRREQS
and CONFIG_USBSTRG_NRDREQS
:
The number of write/read requests that can be in flight
CONFIG_USBSTRG_BULKINREQLEN
and CONFIG_USBSTRG_BULKOUTREQLEN
:
The size of the buffer in each write/read request.
This value needs to be at least as large as the endpoint maxpacket and
ideally as large as a block device sector.
CONFIG_USBSTRG_VENDORID
and CONFIG_USBSTRG_VENDORSTR
:
The vendor ID code/string
CONFIG_USBSTRG_PRODUCTID
and CONFIG_USBSTRG_PRODUCTSTR
:
The product ID code/string
CONFIG_USBSTRG_REMOVABLE
:
Select if the media is removable
CONFIG_USBHOST
: Enables USB host support
CONFIG_USBHOST_NPREALLOC
: Number of pre-allocated class instances
CONFIG_USBHOST_BULK_DISABLE
: On some architectures, selecting this setting will reduce driver size by disabling bulk endpoint support
CONFIG_USBHOST_INT_DISABLE
: On some architectures, selecting this setting will reduce driver size by disabling interrupt endpoint support
CONFIG_USBHOST_ISOC_DISABLE
: On some architectures, selecting this setting will reduce driver size by disabling isochronous endpoint support
Requires CONFIG_USBHOST=y
, CONFIG_USBHOST_INT_DISABLE=n
, CONFIG_NFILE_DESCRIPTORS > 0
,
CONFIG_SCHED_WORKQUEUE=y
, and CONFIG_DISABLE_SIGNALS=n
.
CONFIG_HIDKBD_POLLUSEC
: Device poll rate in microseconds. Default: 100 milliseconds.
CONFIG_HIDKBD_DEFPRIO
: Priority of the polling thread. Default: 50.
CONFIG_HIDKBD_STACKSIZE
: Stack size for polling thread. Default: 1024
CONFIG_HIDKBD_BUFSIZE
: Scancode buffer size. Default: 64.
CONFIG_HIDKBD_NPOLLWAITERS
: If the poll() method is enabled, this defines the maximum number of threads that can be waiting for keyboard events. Default: 2.
CONFIG_HIDKBD_RAWSCANCODES
: If set to y
no conversion will be made on the raw keyboard scan codes. Default: ASCII conversion.
CONFIG_HIDKBD_ALLSCANCODES
: If set to y
all 231 possible scancodes will be converted to something. Default: 104 key US keyboard.
CONFIG_HIDKBD_NODEBOUNCE
: If set to y
normal debouncing is disabled. Default: Debounce/No repeat keys.
Requires CONFIG_USBHOST=y
, CONFIG_USBHOST_BULK_DISABLE=n
, CONFIG_NFILE_DESCRIPTORS > 0
,
and CONFIG_SCHED_WORKQUEUE=y
.
CONFIG_NX
Enables overall support for graphics library and NX
CONFIG_NX_MULTIUSER
:
Configures NX in multi-user mode.
CONFIG_NX_NPLANES
:
Some YUV color formats requires support for multiple planes,
one for each color component. Unless you have such special
hardware, this value should be undefined or set to 1.
CONFIG_NX_DISABLE_1BPP
, CONFIG_NX_DISABLE_2BPP
,
CONFIG_NX_DISABLE_4BPP
, CONFIG_NX_DISABLE_8BPP
CONFIG_NX_DISABLE_16BPP
, CONFIG_NX_DISABLE_24BPP
, and
CONFIG_NX_DISABLE_32BPP
:
NX supports a variety of pixel depths. You can save some
memory by disabling support for unused color depths.
CONFIG_NX_PACKEDMSFIRST
:
If a pixel depth of less than 8-bits is used, then NX needs
to know if the pixels pack from the MS to LS or from LS to MS
CONFIG_NX_LCDDRIVER
:
By default, NX builds to use a framebuffer driver (see include/nuttx/fb.h
).
If this option is defined, NX will build to use an LCD driver (see include/nuttx/lcd/lcd.h
).
CONFIG_LCD_MAXPOWER
:
The full-on power setting for an LCD device.
CONFIG_LCD_MAXCONTRAST
:
The maximum contrast value for an LCD device.
CONFIG_NX_MOUSE
:
Build in support for mouse input.
CONFIG_NX_KBD
:
Build in support of keypad/keyboard input.
CONFIG_NXTK_BORDERWIDTH
:
Specifies with with of the border (in pixels) used with
framed windows. The default is 4.
CONFIG_NXTK_BORDERCOLOR1
and CONFIG_NXTK_BORDERCOLOR2
:
Specify the colors of the border used with framed windows.
CONFIG_NXTK_BORDERCOLOR2
is the shadow side color and so
is normally darker. The default is medium and dark grey,
respectively
CONFIG_NXTK_AUTORAISE
:
If set, a window will be raised to the top if the mouse position
is over a visible portion of the window. Default: A mouse
button must be clicked over a visible portion of the window.
CONFIG_NXFONTS_CHARBITS
:
The number of bits in the character set. Current options are
only 7 and 8. The default is 7.
CONFIG_NXFONT_SANS
:
At present, there is only one font. But if there were were more,
then this option would select the sans serif font.
CONFIG_NX_BLOCKING
Open the client message queues in blocking mode. In this case,
nx_eventhandler()
will not return until a message is received and processed.
CONFIG_NX_MXSERVERMSGS
and CONFIG_NX_MXCLIENTMSGS
Specifies the maximum number of messages that can fit in
the message queues. No additional resources are allocated, but
this can be set to prevent flooding of the client or server with
too many messages (CONFIG_PREALLOC_MQ_MSGS
controls how many
messages are pre-allocated).
CONFIG_BOOT_RUNFROMFLASH
: Some configurations support XIP
operation from FLASH but must copy initialized .data sections to RAM.
CONFIG_BOOT_COPYTORAM
: Some configurations boot in FLASH
but copy themselves entirely into RAM for better performance.
CONFIG_STACK_POINTER
: The initial stack pointer
CONFIG_IDLETHREAD_STACKSIZE
: The size of the initial stack.
This is the thread that (1) performs the initial boot of the system up
to the point where user_start() is spawned, and (2) there after is the
IDLE thread that executes only when there is no other thread ready to
run.
CONFIG_USERMAIN_STACKSIZE
: The size of the stack to allocate
for the main user thread that begins at the user_start() entry point.
CONFIG_PTHREAD_STACK_MIN
: Minimum pthread stack size
CONFIG_PTHREAD_STACK_DEFAULT
: Default pthread stack size
CONFIG_HEAP_BASE
: The beginning of the heap
CONFIG_HEAP_SIZE
: The size of the heap
Appendix B: Trademarks |
NOTE: NuttX is not licensed to use the POSIX trademark. NuttX uses the POSIX standard as a development guideline only.