This is a draft cheat sheet. It is a work in progress and is not finished yet.
Terminology
host |
The computer on which you are editing source code, compiling, and assembling firmware |
target |
The platform for which your firmware is built (for example, Raspberry Pi, Raspberry Pi 2, or Beaglebone Black) |
toolchain |
The tools required to build code for the target, such as compilers, linkers, binutils, and C runtime |
system |
A lean Buildroot-based Linux distribution that has been customized and cross-compiled for a particular target |
assemble |
The process of combining system, application, and configuration into a firmware bundle |
firmware bundle |
A single file that contains an assembled version of everything needed to burn firmware |
firmware image |
Built from a firmware bundle and contains the partition table, partitions, bootloader, etc. |
Tutorial projects
Pi Camera
git clone https://fhunleth@bitbucket.org/fhunleth/nerves_cam.git
|
|
|
Official targets
Target |
Nerves System |
mix |
Raspberry Pi Zero |
nerves_system_rpi0 |
rpi0 |
Raspberry Pi A, B |
nerves_system_rpi |
rpi |
Raspberry Pi 2 |
nerves_system_rpi2 |
rpi2 |
Raspberry Pi 3 |
nerves_system_rpi3 |
rpi3 |
All BeagleBones |
nerves_system_bbb |
bbb |
Lego EV3 |
nerves_system_ev3 |
ev3 |
Linkit Smart |
nerves_system_linkit |
linkit |
Nerves basics
Create a new project
$ mix nerves.new hello_nerves
Build firmware bundle
$ cd hello_nerves
$ export MIX_TARGET=<mix target>
$ mix deps.get
$ mix firmware
Burn a MicroSD card
$ mix firmware.burn
Update using nerves_firmware_http
$ mix firmware.push hostname [--target <mix target>]
|
Connecting to the target
Most Nerves systems provide an IEx prompt over a serial port or UART. TTY emulators like screen
and picocom
can access it. Check the system for baud rate (normally 115200).
screen
$ screen /dev/tty<device> 115200
Exit screen with CTRL+a, CTRL+\
picocom
$ picocom -b 115200 /dev/tty<device>
Exit picocom with CTRL+a, CTRL+x |
Useful IEx commands
Run a Linux command |
:os.cmd('ps') |> IO.puts
|
Reboot |
|
Shell |
<CTRL+g>s sh<Enter>c 1
|
|