Nerves Tip #1 - Toolshed

Want more traditional shell tools in your Nerves IEx?

Use Toolshed!

Its included by default and has may familiar functions, such as `cat`, `ls`, or even `weather` 🌤️

https://hexdocs.pm/toolshed

#NervesTips #MyElixirStatus

8:33 PM · Jun 11, 2021

Nerves Tip #2 - Kernel log messages

Need more than Elixir logs? Run `dmesg` to see log messages from device drivers and the Linux kernel. Nerves also routes kernel log messages to the Elixir logger.

#NervesTips #MyElixirStatus

5:52 PM · Jun 25, 2021

Nerves Tip #3 - Erlinit

Erlinit is a small program that starts the Erlang VM on boot. It has many options - especially for debugging startup issues.

https://hexdocs.pm/nerves/advanced-configuration.html#overriding-erlinit-config-from-mix-config

#NervesTips #MyElixirStatus

1:59 PM · Jul 14, 2021

Nerves Tip #4 - Disable automatic reboot

Nerves automatically reboots devices when the Erlang VM exits. This can make some debugging harder, but you can easily disable it to let those sessions hang for debugging ¬

#NervesTips #MyElixirStatus

1:05 PM · Jul 16, 2021

Nerves Tip #5 - Whats in a firmware?

Use `mix firmware.unpack` to decompress a local copy of your firmware on host and inspect the files within before installing on device

#NervesTips #MyElixirStatus

1:48 PM · Aug 9, 2021

Nerves Tip #6 - Elixir Circuits libraries

See if someone has already implemented support for a sensor or other hardware device that you have by checking https://elixir-circuits.github.io/.

#NervesTips #MyElixirStatus

1:51 PM · Aug 9, 2021

Nerves Tip #7 - Read-only filesystems

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`

#NervesTips #MyElixirStatus

1:05 PM · Aug 27, 2021

Nerves Tip #8 - SASL log messages

Configuring the Elixir Logger to show SASL reports can help debug unexpected GenServer restarts.

https://hexdocs.pm/logger/Logger.html#module-erlang-otp-integration

#NervesTips #MyElixirStatus

1:12 PM · Aug 27, 2021

Nerves Tip #9 - Viewing the file system

Sometimes, you just need to see whats on your Nerves device's disk. Luckily, there are a few ways to do that. You can even use VSCode!

https://embedded-elixir.com/post/2021-05-08-nerves-file-peeking/#sshfs

#NervesTips #MyElixirStatus

1:24 PM · Aug 27, 2021

Nerves Tip #10 - NervesPack

Get all of the default packages for starting a new Nerves project by depending on `:nerves_pack`

https://github.com/nerves-project/nerves_pack

#NervesTips #MyElixirStatus

1:18 PM · Sep 3, 2021

Nerves Tip #11 - Hardware watchdogs

Nerves enables hardware watchdogs and connects them to Erlang's heart feature to detect and recover from the Erlang VM hanging.

See https://embedded-elixir.com/post/2018-12-10-heart/ to learn more about this.

#NervesTips #MyElixirStatus

12:18 PM · Sep 11, 2021

Nerves Tip #12 - Copy and paste

Make small code changes to your running application by copy/pasting Elixir source files at the IEx prompt.

#NervesTips #MyElixirStatus

2:43 PM · Oct 10, 2021

Nerves Tip #13 - Read-only filesystems

Nerves stores all BEAM files, the Erlang runtime and various support libraries and apps in a compressed and read-only SquashFS filesystem.

The writable application partition is mounted at `/data`

#NervesTips #MyElixirStatus

9:09 AM · Nov 26, 2021

Nerves Tip #14 - Device serial numbers

Identify your Nerves devices using a unique ID that's already programmed into the hardware using the boardid command. Details at https://github.com/nerves-project/boardid/ and the boardid.config file.

#NervesTips #MyElixirStatus

3:37 PM · Dec 23, 2021

Nerves Tip #15 - Need an example?

Nerves maintains a set of examples for common use-cases with devices. Things like running a phoenix app, using SQLite, controlling GPIO, using Zig lang, and more!

https://github.com/nerves-project/nerves_examples

#NervesTips #MyElixirStatus

3:54 PM · Dec 23, 2021

Nerves Tip #16 - Logs

Use `RingLogger.next` to dump the current log buffer to screen.

Use `log_attach` from `Toolshed` to attach the current session to the Elixir logger for live logs.

https://hexdocs.pm/toolshed/Toolshed.Log.html#log_attach/1

#NervesTips #MyElixirStatus

12:09 PM · Jan 21, 2022

Nerves Tip #17 - Eye from the Sky

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

#NervesTips #MyElixirStatus

12:16 PM · Jan 21, 2022

Nerves Tip #18 - Revert to the previously loaded firmware

Run `Nerves.Runtime.revert` to go back to the previously loaded firmware.

#NervesTips #MyElixirStatus

4:58 PM · Feb 11, 2022

Nerves Tip #19 - Compiling systems

Compiling systems on linux or via `mix nerves.system.shell`?

Don't forgot about `make help` and other tips from the Buildroot manual (thanks @ericr3r)

https://buildroot.org/downloads/manual/manual.html#make-tips

#NervesTips #MyElixirStatus

4:58 PM · Feb 11, 2022

Nerves Tip #20 - Order matters

Sometimes when compiling Nerves systems, order matters!

Use `make show-build-order` while in `mix nerves.system.shell` to see the compilation order and make sure all your 🦆🦆 are in a row (thanks @ericr3r!)

#NervesTips #MyElixirStatus

4:59 PM · Feb 11, 2022

Nerves Tip #21 - RamoopsLogger

Use the `RamoopsLogger` backend to store log messages in DRAM that can survive unexpected reboots.

https://github.com/smartrent/ramoops_logger

#NervesTips #MyElixirStatus

12:20 AM · Mar 5, 2022