Skip to content

Commit

Permalink
add nerves-tips file
Browse files Browse the repository at this point in the history
  • Loading branch information
mnishiguchi committed Nov 10, 2023
1 parent affd988 commit 4fb4c2d
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions fortunes/nerves-tips
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Run `dmesg` to see log messages from device drivers and the Linux kernel.
Nerves also routes kernel log messages to the Elixir logger.
%
Erlinit is a small program that starts the Erlang VM on boot.
It has many options - especially for debugging startup issues.
%
Nerves automatically reboots devices when the Erlang VM exits.
You can easily disable it in your config file.

config :nerves, :erlinit, hang_on_init: true
%
Use `mix firmware.unpack` to decompress a local copy of your firmware on host
and inspect the files within before installing on device%
%
See if someone has already implemented support for a sensor or other hardware
device that you have by checking https://elixir-circuits.github.io/.
%
Nerves stores all BEAM files, the Erlang runtime and various support
libraries/apps in a compressed and read-only SquashFS filesystem.
%
Need to write to disk? Use the application partition mounted R/W at `/data`.
%
Configuring the Elixir Logger to show SASL reports can help debug unexpected
GenServer restarts.

config :logger,
handle_otp_reports: true,
handle_sasl_reports: true
%
Get the default packages for starting a new Nerves project by depending
on `:nerves_pack`. https://github.com/nerves-project/nerves_pack/
%
Nerves enables hardware watchdogs and connects them to Erlang's heart feature
to detect and recover from the Erlang VM hanging.
https://embedded-elixir.com/post/2018-12-10-heart/
%
Make small code changes to your running application by copy/pasting Elixir
source files at the IEx prompt.
%
Identify your Nerves devices using a unique ID that's already programmed into
the hardware using the boardid command. Try running `cmd("boardid")` in the IEx.
https://github.com/nerves-project/boardid
%
Nerves maintains a set of examples for common use-cases with devices.
https://github.com/nerves-project/nerves_examples
%
Use `RingLogger.next` to dump the current log buffer to screen.
%
Run `log_attach` in the IEx to attach the current session to the Elixir logger
for live logs.
%
Get some insights to Nerves internals with this high level overview of the
Nerves architecture and choice to use the BEAM VM. https://youtu.be/VzOaSvTcvU4
%
Run `Nerves.Runtime.revert` to go back to the previously loaded firmware.
%
Use the `RamoopsLogger` backend to store log messages in DRAM that can survive
unexpected reboots. https://github.com/smartrent/ramoops_logger
%
Files saved in /data are persisted across reboots and firmware upgrades.
Learn more: https://hexdocs.pm/nerves/faq.html#where-can-persistent-data-be-stored
%

0 comments on commit 4fb4c2d

Please sign in to comment.