Back to Nerves

Nerves

README.md

1.14.126.5 KB
Original Source
<!-- SPDX-FileCopyrightText: 2016 Justin Schneck SPDX-FileCopyrightText: 2017 Frank Hunleth SPDX-FileCopyrightText: 2017 Greg Mefford SPDX-FileCopyrightText: 2017 Jeff Smith SPDX-FileCopyrightText: 2017 Xavier Damman SPDX-FileCopyrightText: 2020 Jon Carstens SPDX-FileCopyrightText: 2022 Masatoshi Nishiguchi SPDX-FileCopyrightText: 2022 Rui Lopes SPDX-FileCopyrightText: 2023 Dave Purrington SPDX-FileCopyrightText: 2024 Cocoa Xu SPDX-License-Identifier: CC-BY-4.0 -->

Nerves

Craft and deploy bulletproof embedded software in Elixir

Nerves provides tooling and libraries for building small, self-contained software images using the rock-solid Erlang virtual machine hardware support of Linux, and happy development experience of Elixir for microprocessor-based embedded systems.

While the Nerves project provides base runtime libraries for hardware access and network configuration, nearly all of the Elixir ecosystem is available, including:

  • Phoenix and LiveView for interactive local web user interfaces
  • Elixir Nx for numerical computing and machine learning
  • Livebook for interactive code notebooks on your device
  • Scenic for local on-screen user interfaces

Or just keep it simple and use whatever libraries you need from the Hex package manager. Nerves only includes what you use so your embedded software can remain small.

Nerves uses the Linux kernel to support a large variety of hardware. It is not a Linux distribution, though, and contains little of what you would find on a typical embedded Linux system. Instead, it starts the Erlang runtime as one of the first OS processes and lets Erlang and Elixir take over from there. Not to fear, if you need something from Linux, Nerves provides a way to use most of the packages available through Buildroot.

Nerves Projects

Our project is spread over many repositories in order to focus on a limited scope per repository.

This repository (nerves-project/nerves) is an entrance to Nerves and provides the core tooling and documentation.

The Nerves core team maintains the projects in the nerves-project organization with the help of many in the Elixir community. Projects under other GitHub organizations are maintained by their respective organization, but listed here since they're so commonly used in conjunction with the core libraries and tools.

Framework / Core

NameDescriptionRelease
ErlinitReplacement for /sbin/init that launches an Erlang/OTP Release
Nerves.BootstrapThe Nerves new project generator and low level hooks into Mix
Nerves.RuntimeSmall, general runtime utilities for Nerves devices
NervesPackInitialization setup for Nerves devices
NervesSystemBRBuildroot based build platform for Nerves Systems
RingLoggerA ring buffer backend for Elixir Logger with IO streaming

Example projects

NameDescriptionRelease
Circuits QuickstartTry out Elixir Circuits with prebuilt Nerves firmware
NervesExamplesSmall example programs using Nerves
Nerves LivebookDevelop on embedded devices with Livebook and Nerves

Hardware

These are the officially supported hardware ports. Many others exist in the community.

NameDescriptionRelease
NervesSystemBBBBase Nerves system configuration for the BeagleBone-based boards
NervesSystemOSD32MP1Base system for Octavo OSD32MP1
NervesSystemRPiBase Nerves system configuration for the Raspberry Pi A+ and B+
NervesSystemRPi0Base Nerves system configuration for the Raspberry Pi Zero and Zero W
NervesSystemRPi0_2Nerves system for the Raspberry Pi Zero 2 W
NervesSystemRPi2Base Nerves system configuration for the Raspberry Pi 2
NervesSystemRPi3Base Nerves system configuration for the Raspberry Pi 3
NervesSystemRPi3ANerves system for the Raspberry Pi 3 Model A+ w/ gadget mode and Raspberry Pi Zero 2 W
NervesSystemRPi4Base Nerves system configuration for the Raspberry Pi 4
NervesSystemRPi5Base Nerves system configuration for the Raspberry Pi 5
NervesSystemVultrExperimental configuration for a Vultr cloud server
NervesSystemX86_64Generic Nerves system configuration x86_64 based hardware
NervesSystemGrisp2Base Nerves system configuration for the GRiSP 2
NervesSystemMangoPiMQProBase Nerves system configuration for the MangoPi MQ-Pro

Networking

NameDescriptionRelease
VintageNetNetwork configuration and management for Nerves
VintageNetWiFiWiFi networking for VintageNet
VintageNetDirectDirect network connection support for VintageNet
VintageNetEthernetEthernet support for VintageNet
VintageNetMobileMobile connection support for VintageNet
VintageNetQMIVintageNet technology support for QMI mobile connections
VintageNetWireGuardWireguard VPN support

Hardware access

NameDescriptionRelease
Circuits.GPIOUse GPIOs in Elixir
Circuits.I2CUse I2C in Elixir
Circuits.SPICommunicate over SPI from Elixir
Circuits.UARTDiscover and use UARTs and serial ports in Elixir

SSH and Shell

NameDescriptionRelease
NervesMOTDMessage of the day for Nerves devices
NervesSSHManage an SSH daemon and subsystems on Nerves devices
SSHSubsystemFwupErlang SSH Subsystem for Nerves firmware updates
ToolshedA toolshed of shell-like IEx helpers

Toolchain

Nerves provides a C/C++ cross-toolchain to ensure consistency builds on all supported host platforms. These are built using crosstool-ng and are similar to other GCC toolchains.

NameDescriptionRelease
nerves_toolchain_ctngCrosstool-NG integration for building Nerves toolchains
nerves_toolchain_aarch64_nerves_linux_gnu64-bit ARM toolchain
nerves_toolchain_armv5_nerves_linux_musleabi32-bit ARM toolchain for older ARM processors
nerves_toolchain_armv6_nerves_linux_gnueabihf32-bit ARM toolchain for Raspberry Pi A, B, and Zero
nerves_toolchain_armv7_nerves_linux_gnueabihf32-bit ARM toolchain for most 32-bit ARMs
nerves_toolchain_i586_nerves_linux_gnu32-bit Intel x86 toolchain
nerves_toolchain_mipsel_nerves_linux_musl32-bit MIPS toolchain
nerves_toolchain_riscv64_nerves_linux_gnu64-bit RISC-V toolchain
nerves_toolchain_x86_64_nerves_linux_musl64-bit x86 toolchain using the musl libc
nerves_toolchain_x86_64_nerves_linux_gnu64-bit x86 toolchain using GNU libc

Miscellaneous

NameDescriptionRelease
boardidPrint out a platform-specific board serial number
NervesFWLoadersA collection of firmware loaders for boards with internal storage
NervesHeartErlang heartbeat support for Nerves
ShoehornHelp handle OTP application failures and start order
UBootEnvRead and write to U-Boot environment blocks

Upcoming

These projects are new or experimental and are in various stages of being ready to promote to the above categories.

NameDescriptionRelease
NervesLoggingRoute system log messages through the Elixir logger
NervesUEventSimple UEvent monitor for detecting hardware and automatically loading drivers
PropertyTableIn-memory key-value store with subscriptions
nerves_initramfsAn initramfs for early boot handling of Nerves devices
nerves_system_linterMix task to check Nerves system configuration files
nerves_systemsBuild scripts for maintaining multiple repositoriesunreleased
<details> <summary><b>See outdated/inactive projects...</b></summary>
NameDescriptionRelease
nerves_ledsFunctions to drive LEDs on embedded systems
system_registrySerial nested term storage and dispatch registry
system_registry_term_storageSimple term storage for SystemRegistry
nerves_system_test
nerves_test_server

There is also a gravesite for old Nerves libraries at https://github.com/nerves-project-attic.

</details>

Host Requirements

  • Mac OS 10.13+ (High Sierra and later)
  • 64-bit Linux (tested on Debian / Ubuntu / Redhat / CentOS / Arch)
  • Windows 10 with Windows Subsystem for Linux 2
  • Elixir ~> 1.11

See Installation Docs for software dependencies.

Quick-Reference

Generating a New Nerves Application

bash
mix nerves.new my_app

Building Firmware

bash
export MIX_TARGET=rpi3
mix deps.get      # Fetch the dependencies
mix firmware      # Cross-compile dependencies and create a .fw file
mix firmware.burn # Burn firmware to an inserted SD card

Note: The mix firmware.burn target uses sudo to be able to write to a MicroSD card on Linux. You will be asked for a password. You can also set the SUDO_ASKPASS environment variable if you'd prefer an alternative way of requesting the password. E.g., export SUDO_ASKPASS=ssh-askpass.

Docs

Installation Docs

Getting Started

Frequently-Asked Questions

Systems

Targets

User Interfaces

Advanced Configuration

Compiling non-BEAM code

Customizing Systems

Contributors

This project exists thanks to all the people who contribute. <a href="https://github.com/nerves-project/nerves/graphs/contributors"></a>

Please see our Contributing Guide for details on how you can contribute in various ways.

Metal Level Sponsors

Metal level sponsors are companies that allow core team members to maintain and extend Nerves for a portion of each work week. Nerves is not a product of any one company. We also have a soft spot for supporting makers and hobbyists using the BEAM, and it would be difficult to do this without them.

<a href="https://www.smartrent.com" target="_blank"></a>

<a href="https://www.redwirelabs.com/" target="_blank"></a>

<a href="https://www.binarynoggin.com" target="_blank"></a>

[Become a metal level sponsor]

OpenCollective Backers

Thank you to all our monetary backers! Hardware costs money and without support, we wouldn't be able to support nearly as many devices. 🙏 [Become a backer]

<a href="https://opencollective.com/nerves-project#backers" target="_blank"></a>

OpenCollective Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

<a href="https://opencollective.com/nerves-project/sponsor/0/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/1/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/2/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/3/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/4/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/5/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/6/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/7/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/8/website" target="_blank"></a> <a href="https://opencollective.com/nerves-project/sponsor/9/website" target="_blank"></a>

Copyright (C) 2015-2021 by the Nerves Project developers [email protected]