Apache NuttX Documentation

repository·master·Indexed 26 days ago

https://github.com/apache/nuttx

Apache NuttX is a highly scalable, POSIX and ANSI compliant real-time operating system (RTOS) suitable for environments ranging from 8-bit to 64-bit microcontrollers. The project includes support for a wide variety of hardware platforms, a simulator for terminal-based execution, and specialized tools such as the NxScope real-time data logging library and the Lightweight Link (LWL) console for debugging.

Tokens
119.2K
Snippets
222
Records
702
Agent score
87%

What's inside Apache NuttX

  1. Overview of SPIFFS (SPI Flash File System)

    master

    SPIFFS is a file system designed for SPI NOR flash devices on embedded targets. It is optimized for small targets with sparse RAM and implements static wear leveling.

    Key Characteristics

    • Low RAM Usage: Uses statically sized RAM buffers independent of the number of files.
    • POSIX-like API: Supports standard operations like open, close, read, write, seek, and stat.
    • Flat Structure: SPIFFS does not support directories. A path like tmp/myfile.txt is treated as a single filename rather than a file within a directory.
    • Wear Leveling: Implements static wear leveling to extend flash life.
    • Configurability: Highly configurable and can run multiple instances on the same target or SPI flash device.

    Limitations

    • No Directories: Produces a flat file structure.
    • Non-Realtime: Write operation latency can vary significantly.
    • Scalability: Not intended for devices larger than ~128MB due to RAM constraints.
    • No Bad Block Management: Does not currently detect or handle bad blocks.
  2. Overview of ZDS tools

    master
    The ZDS tools suite provides a build environment and wrapper system designed for ZDS-II based platforms, including z8, zNeo, and ez80. It includes zdsar.c (a wrapper for the ZDS_II librarian to simplify build scripts and improve performance/Windows compatibility) and Config.mk (a makefile fragment used to customize builds for ZDS-II tools).
  3. Overview of the P112 Hobbyist Computer Board

    master

    The P112 is an 8-bit single board computer based on the Z80182 (Z80 upgrade) CPU. It is designed in a 3.5-inch drive form factor and is typically used with CP/M or similar operating systems.

    Key Specifications:

    • CPU: Z80182 (Z80 upgrade) running at 16MHz (up to 24.576MHz possible).
    • Memory: Up to 1MB.
    • Power: 5V DC, nominal draw of 150mA (excluding disk drives).
    • I/O: Serial, parallel, diskette I/O, and a realtime clock.
    • Package: 100-pin QFP.
  4. Use the Lightweight Link (LWL) Console for debugging

    master

    The Lightweight Link (LWL) protocol provides a console interface when a target device lacks a spare serial port or other communication resources. It uses two words of memory for data exchange between the target and a debugger.

    Key Characteristics:

    • Use Case: Ideal for initial CPU bring-up or when hardware lacks a dedicated logging port.
    • Advantages: Unlike semi-hosting, it does not force the target into debug mode while running, which helps maintain better real-time semantics.
    • Limitations: It is not highly efficient. It uses busy-loop polling for input (effectively busy-locking the thread) and busy-waits for output collection. For high-efficiency output-only needs, use SWO if available.
    • Requirements: The debugger must be capable of watching and modifying a memory location on the target while it is executing.
  5. Get started with Apache NuttX

    master

    Apache NuttX is a POSIX and ANSI compliant real-time operating system (RTOS) designed for small footprints. It is scalable from 8-bit to 64-bit microcontroller environments.

    If you do not have a physical hardware board available, you can use the NuttX simulator to run the OS directly in your terminal.

  6. Hardware Overview: MAX32660-EVSYS

    master

    The MAX32660-EVSYS is a board based on the Maxim Integrated MAX32660 microcontroller.

    Key Specifications:

    • MCU: Arm Cortex-M4F, 96MHz
    • Memory: 256KB Flash, 96KB SRAM, 16KB Instruction Cache
    • Peripherals: 2x SPI, 2x I2C, 2x UART, 14x GPIO
    • Debug Adapter: MAX32625PICO-based CMSIS-DAP SWD Debugger with Virtual UART Console
    • Expansion: DIP Breakout Board (100mil pitch, breadboard compatible)
  7. Use NxWM Window Manager

    master

    The nxwm configuration is a special setup for the NxWM window manager Unit Test. It provides an interactive windowing experience on the SAMA5D4-EK TM7000 LCD.

    Key Features:

    • Boots into a graphic window management environment instead of a serial console.
    • Provides graphics-based terminals called NxTerms.
    • Supports USB HID keyboard input for console interaction.

    Console Access:

    1. Via NxTerm: Once NxWM is up, use an NxTerm window. Input is provided via USB HID keyboard.
    2. Via Telnet: This is the recommended way to access the shell and RAMLOG remotely.

    USB Keyboard Configuration for NxWM:

    • CONFIG_NXWM_KEYBOARD_USBHOST=y: Enables USB host keyboard for NxWM.
    • CONFIG_NXWM_KEYBOARD_DEVPATH="/dev/kbda": Sets the device path.
  8. Use stub files for Nordic SoftDevice Controller

    master
    The arch/arm/src/nrf53/sdc/ directory contains stub files designed to allow building the Nordic SoftDevice Controller without requiring the full NRFX and CMSIS libraries. These stubs provide the necessary definitions required for the build process to succeed without the overhead of pulling in the complete external dependencies.
  9. Available SAMA5D4-EK Configurations

    master

    The following configuration subdirectories are available for the SAMA5D4-EK:

    • at25boot: Tiny program to write a bootloader into AT25 serial FLASH.
    • bridge: Tests EMAC0 and EMAC1 via a UDP relay bridge.
    • dramboot: Debugging tool to load Intel HEX files into DRAM over a serial port.
    • elf: Demonstrates execution of ELF files from a file system.
    • ipv6: NuttShell (NSH) configuration with IPv6 enabled and IPv4 disabled.
    • knsh: A minimal NSH configuration used to test kernel build configurations.
    • nsh: Full-featured NuttShell (NSH) configuration.
    • nxwm: Window manager UnitTest integrating LCDC and ADC touchscreen.
    • ramtest: Stripped-down NSH that runs from internal SRAM to test SDRAM.
  10. Understand the two-pass build process

    master

    NuttX supports a two-pass build system designed to incorporate application-generated source logic into the kernel phase.

    1. Pass 1 (Application Phase): Application logic is built first. During this phase, applications can generate and install source files into the pass1/ directory.
    2. Pass 2 (Kernel Phase): The operating system is built. Any source files placed in the pass1/ directory during Pass 1 are compiled and incorporated directly into the kernel address space.

    This mechanism is primarily used to handle application-generated kernel symbol tables, which are required to support kernel modules.

  11. Hardware Overview: FRDM-K28F Development Board

    master

    The FRDM-K28F is a development board based on the Kinetis MK28FN2M0VMI15 MCU (ARM Cortex-M4 at 150 MHz).

    Key Hardware Features:

    • Memory: 1 MB SRAM, 2 MB flash, 256 Mbit (32 MB) QuadSPI memory (1.8 V), and 128 Mbit (16 MB) mobile SDRAM (3.3 V).
    • USB: Dual-role high-speed and full-speed USB interface via micro-B connector.
    • Debug/Programming: OpenSDA v2.2 circuit supporting DAP-Link, providing Mass-Storage Device (MSD) flash programming, CMSIS-DAP debug interface, and a virtual serial port.
    • Peripherals: FXOS8700CQ 6-axis sensor (accelerometer/magnetometer), RGB LED, and two mechanical push-buttons.
    • Expansion: Arduino R3-compatible I/O connectors and a FlexIO socket for displays.