The atomvm_packgleam library is just a standalone utility that can be added to your gleam project dependencies
in order to create a packed .avm
file of your project for the AtomVM machine
to be flashed onto your IoT device.
gleam add atomvm_packgleam@1
The utility is using the AtomVM packbeam
tool.
Your main module, named the same as your project, will need a pub fn start() { ... }
function that
AtomVM uses as entry point to start the application.
import gleam/io
// Gleam run start
pub fn main() {
io.println("Hello from gleam run!")
}
// For AtomVM start
// Start the application, callback for AtomVM init.
pub fn start() {
io.println("Hello from AtomVM!")
}
To create the avm
file execute:
gleam run -m atomvm_packgleam # Create an `<application>.avm` file
The file name is picked from the name
attribute in your gleam.toml
file.
In order to flash, check the AtomVM documentation for the available devices.
Further documentation can be found at https://hexdocs.pm/atomvm_packgleam.