Skip to content

Latest commit

 

History

192 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExAtomVM

ExAtomVM provide a collection of Mix tasks that greatly simplify development and deployment of Elixir applications targeted for the AtomVM platform.

The following operations are supported:

  • Packing compiled BEAM files into AVM files for use in AtomVM;
  • Flashing AVM files to micro-controllers (Currently, only ESP32 devices are supported).

Note. For information about how to use Mix plugins, see the Mix documentation.

Dependencies

To use this plugin to build packbeam files, you will need

To flash an ExAtomVM project to an ESP32, you will need:

  • An ESP32 development module such as the Espressif DevKit C
  • A USB cable to connect the ESP32 development module to your workstation
  • esptool
  • (Optional) A serial console program, such as minicom, or the pythonx dependency for mix atomvm.esp32.monitor

Consult your local package manager for installation of these tools.

Getting Started

Start by creating a Mix project

shell$ mix new my_project --module MyProject
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating lib
* creating lib/my_project.ex
* creating test
* creating test/test_helper.exs
* creating test/my_project_test.exs

Your Mix project was created successfully.
You can use "mix" to compile it, test it, and more:

    cd my_project
    mix test

Run "mix help" for more commands.

Edit the generated mix.exs to include the ExAtomVM dependency ({:exatomvm, git: "https://github.com/atomvm/ExAtomVM/"}), and add a properties list using the atomvm key containing a start entry (the flash tasks document their optional entries below):

## elixir
defmodule MyProject.MixProject do
use Mix.Project

    def project do
    [
        app: :my_project,
        version: "0.1.0",
        elixir: "~> 1.13",
        start_permanent: Mix.env() == :prod,
        deps: deps(),
        atomvm: [
          start: MyProject
        ]
    ]
    end

    # Run "mix help compile.app" to learn about applications.
    def application do
    [
        extra_applications: [:logger]
    ]
    end

    # Run "mix help deps" to learn about dependencies.
    defp deps do
    [
        {:exatomvm, git: "https://github.com/atomvm/ExAtomVM/"}
        # {:dep_from_hexpm, "~> 0.3.0"},
        # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
    ]
    end
end

Note. By convention, Mix dependencies are encapsulated in the private deps function in the project module (mix.exs).

Edit the my_project.ex file so that it contains a start function:

## elixir
defmodule MyProject do
  def start do
    :ok
  end
end

Run mix deps.get to download ExAtomVM into your deps directory:

shell$ mix deps.get
* Getting exatomvm (https://github.com/atomvm/ExAtomVM/)
remote: Enumerating objects: 150, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 150 (delta 14), reused 19 (delta 10), pack-reused 121
origin/HEAD set to master

From now on mix atomvm shows the steps of a project and the tasks of each board, and mix atomvm.esp32, mix atomvm.stm32 and mix atomvm.pico the steps of one board.

Create a directory called avm_deps in the top level of your project directory:

shell$ mkdir avm_deps

Download a copy of the AtomVM-libs from the AtomVM Gitbub release repository. Extract the contents of this archive and copy the enclosed AVM files into your avm_deps directory.

Afterwards, you should see something like:

shell$ ls -l avm_deps
total 264
-rw-rw-r--  1 frege  wheel  11380 May  8 16:32 alisp.avm
-rw-rw-r--  1 frege  wheel  48956 May  8 16:32 atomvmlib.avm
-rw-rw-r--  1 frege  wheel  23540 May  8 16:32 eavmlib.avm
-rw-rw-r--  1 frege  wheel  25456 May  8 16:32 estdlib.avm
-rw-rw-r--  1 frege  wheel   1052 May  8 16:32 etest.avm
-rw-rw-r--  1 frege  wheel  16356 May  8 16:32 exavmlib.avm

Run the atomvm.packbeam Mix task to create a packbeam file:

shell$ mix atomvm.packbeam
==> exatomvm
Compiling 5 files (.ex)
Generated exatomvm app
==> my_project
Compiling 1 file (.ex)
Generated my_project app

The my_project.avm file should be created in the top level directory of your project:

shell$ ls -l my_project.avm
-rw-rw-r--  1 frege  wheel  144148 May  8 16:34 my_project.avm

You can optionally use the AtomVM Packbeam tool to view the contents of this AVM file.

shell$ packbeam list my_project.avm
Elixir.MyProject.beam * [500]
Elixir.Mix.Tasks.Atomvm.Check.beam [5684]
Elixir.Mix.Tasks.Atomvm.Packbeam.beam [5188]
Elixir.ExAtomVM.PackBEAM.beam [3412]
Elixir.ExAtomVM.beam [504]
Elixir.Mix.Tasks.Atomvm.Esp32.Flash.beam [2048]
atomvm.beam [412]
console.beam [840]
esp.beam [912]
gpio.beam [1216]
...

To flash your project to an ESP32 device, use the atomvm.esp32.flash mix task. You can optionally specify the USB device using the --port option:`

shell% mix atomvm.esp32.flash --port /dev/tty.usbserial
Generated my_project app
esptool.py v3.2-dev
Serial port /dev/tty.usbserial
Connecting.........
Chip is ESP32-D0WDQ6-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:c6:f7:2a:54:7c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00210000 to 0x00233fff...
Writing at 0x00210000... (11 %)
Writing at 0x00214000... (22 %)
Writing at 0x00218000... (33 %)
Writing at 0x0021c000... (44 %)
Writing at 0x00220000... (55 %)
Writing at 0x00224000... (66 %)
Writing at 0x00228000... (77 %)
Writing at 0x0022c000... (88 %)
Writing at 0x00230000... (100 %)
Wrote 147456 bytes at 0x00210000 in 13.0 seconds (91.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

(Optional) To view the console output of your application, use the atomvm.esp32.monitor task, which resets the board and shows its output from the boot messages on, or a serial console program, such as minicom:

shell$ mix atomvm.esp32.monitor
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6816
ho 0 tail 12 room 4
load:0x40078000,len:12108
load:0x40080400,len:6664
entry 0x40080774
I (76) boot: Chip Revision: 3
I (77) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (42) boot: ESP-IDF v3.3.4-dirty 2nd stage bootloader
I (42) boot: compile time 14:28:14
I (42) boot: Enabling RNG early entropy source...
I (47) boot: SPI Speed      : 40MHz
I (51) boot: SPI Mode       : DIO
I (55) boot: SPI Flash Size : 4MB
I (59) boot: Partition Table:
I (63) boot: ## Label            Usage          Type ST Offset   Length
I (70) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (85) boot:  2 factory          factory app      00 00 00010000 001c0000
I (92) boot:  3 lib.avm          RF data          01 01 001d0000 00040000
I (100) boot:  4 main.avm         RF data          01 01 00210000 00100000
I (107) boot: End of partition table
I (112) boot_comm: chip revision: 3, min. application chip revision: 0
I (119) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x2cb14 (183060) map
I (194) esp_image: segment 1: paddr=0x0003cb3c vaddr=0x3ffb0000 size=0x034d4 ( 13524) load
I (200) esp_image: segment 2: paddr=0x00040018 vaddr=0x400d0018 size=0xd38d8 (866520) map
I (516) esp_image: segment 3: paddr=0x001138f8 vaddr=0x3ffb34d4 size=0x01524 (  5412) load
I (518) esp_image: segment 4: paddr=0x00114e24 vaddr=0x40080000 size=0x00400 (  1024) load
I (523) esp_image: segment 5: paddr=0x0011522c vaddr=0x40080400 size=0x17848 ( 96328) load
I (573) esp_image: segment 6: paddr=0x0012ca7c vaddr=0x400c0000 size=0x00064 (   100) load
I (573) esp_image: segment 7: paddr=0x0012cae8 vaddr=0x50000000 size=0x00804 (  2052) load
I (595) boot: Loaded app from partition at offset 0x10000
I (595) boot: Disabling RNG early entropy source...
I (596) cpu_start: Pro cpu up.
I (599) cpu_start: Application information:
I (604) cpu_start: Project name:     atomvvm-esp32
I (610) cpu_start: App version:      e34e0ed-dirty
I (615) cpu_start: Compile time:     Apr  3 2022 14:28:20
I (621) cpu_start: ELF file SHA256:  30205fd9063bc42e...
I (627) cpu_start: ESP-IDF:          v3.3.4-dirty
I (633) cpu_start: Starting app cpu, entry point is 0x40081410
I (0) cpu_start: App cpu up.
I (643) heap_init: Initializing. RAM available for dynamic allocation:
I (650) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (656) heap_init: At 3FFBAC98 len 00025368 (148 KiB): DRAM
I (662) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (669) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (675) heap_init: At 40097C48 len 000083B8 (32 KiB): IRAM
I (681) cpu_start: Pro cpu start user code
I (28) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.

    ###########################################################

       ###    ########  #######  ##     ## ##     ## ##     ##
      ## ##      ##    ##     ## ###   ### ##     ## ###   ###
     ##   ##     ##    ##     ## #### #### ##     ## #### ####
    ##     ##    ##    ##     ## ## ### ## ##     ## ## ### ##
    #########    ##    ##     ## ##     ##  ##   ##  ##     ##
    ##     ##    ##    ##     ## ##     ##   ## ##   ##     ##
    ##     ##    ##     #######  ##     ##    ###    ##     ##

    ###########################################################

I (130) AtomVM: Starting AtomVM revision 0.5.0
I (130) AtomVM: Loaded BEAM partition main.avm at address 0x250000 (size=1048576 bytes)
I (160) atomvm_adc: eFuse Two Point: NOT supported
I (160) atomvm_adc: eFuse Vref: Supported
I (160) AtomVM: Found startup beam Elixir.MyProject.beam
I (160) AtomVM: Loaded BEAM partition lib.avm at address 0x1d0000 (size=262144 bytes)
I (170) AtomVM: Starting Elixir.MyProject.beam...
---
AtomVM finished with return value: ok
I (180) AtomVM: AtomVM application terminated.  Going to sleep forever ...

Reference

mix.exs Configuration

To use this Mix plugin, add ExAtomVM to the dependencies list in your mix.exs project file.

def project do [
    ...
    deps: [
      ...
      {:exatomvm, git: "https://github.com/atomvm/ExAtomVM/"},
      ...
    ],
    ...
    atomvm: [
        start: HelloWorld
    ]
  ]
end

In addition, you may specify AtomVM-specific configuration using the atomvm tag. The fields in this properties list are described in more detail below.

The atomvm task

mix atomvm shows how an application reaches a board, and lists the tasks grouped by board:

shell$ mix atomvm
An application reaches a board in three steps.

  1. Name the module AtomVM starts in the atomvm section of mix.exs.

         atomvm: [start: MyProject]

     That module must define start/0, which AtomVM calls when the board
     boots.

  2. Install AtomVM on the board. This is done once.

  3. Flash the application, then watch its console.

Steps 2 and 3 differ from board to board:

    mix atomvm.esp32
    mix atomvm.stm32
    mix atomvm.pico

Each task documents its own options:

    mix help TASK

ESP32:
  mix atomvm.esp32.build       # Build AtomVM for ESP32 from source
  mix atomvm.esp32.erase_flash # Erase flash of ESP32
  mix atomvm.esp32.expand      # Expand the ESP32 main.avm partition to fill flash
  mix atomvm.esp32.flash       # Flash the application to an ESP32 micro-controller
  mix atomvm.esp32.info        # Get information about connected ESP32 devices
  mix atomvm.esp32.install     # Install AtomVM to ESP32 device
  mix atomvm.esp32.monitor     # Show the console output of an ESP32 board

STM32:
  mix atomvm.stm32.flash       # Flash the application to a stm32 micro-controller

Raspberry Pi Pico:
  mix atomvm.pico.flash        # Flash the application to a pico micro-controller

Any board:
  mix atomvm.check             # Check application code for use of unsupported instructions
  mix atomvm.packbeam          # Bundle the application into an AVM file
  mix atomvm.uf2create         # Create uf2 files appropriate for pico devices from a packed .avm application file

mix atomvm.esp32, mix atomvm.stm32 and mix atomvm.pico show the steps of one board, its tasks and the dependencies they need.

A task that needs the atomvm section of mix.exs and does not find it prints what to add to it.

The atomvm.packbeam task

The atomvm.packbeam task is used to bundle your application into an AVM file that can be flashed to a micro-controller and executed by the AtomVM virtual machine.

The atomvm properties list in the Mix project file (mix.exs) may contain the following entries related to this task:

Key Type Default Value
start Module - The name of the module containing the start/0 entrypoint function

Properties in the mix.exs file may be over-ridden on the command line using long-style flags (prefixed by --) by the same name as the properties key. For example, you can use the --start option to specify or override the start property in the above table.

Example:

shell$ mix atomvm.packbeam --start MyProject
==> exatomvm
Compiling 5 files (.ex)
Generated exatomvm app
==> my_project
Compiling 1 file (.ex)
Generated my_project app

The atomvm.esp32.flash task

The atomvm.esp32.flash task is used to flash your application to a micro-controller and executed by the AtomVM virtual machine.

Note. Before running this task, you must flash the AtomVM virtual machine to the device. See the Getting Started section if the AtomVM documentation for information about how to flash the AtomVM image to a device.

The atomvm properties list in the Mix project file (mix.exs) may contain the following entries related to this task. These properties may also be over-ridden on the command line when running mix by using long-style flags:

Key Type Default Value Command line override
esp32_partition string or list of strings main.avm Partition of the board to write the application to, or several that all receive it --partition
esp32_flash_offset integer (hexadecimal format) none Address to write the application to, instead of a partition found on the board --flash_offset
chip string auto ESP32 chip variant --chip
port device path or auto auto Port to which device is connected on host computer; auto detects it --port
baud integer 115200 BAUD rate used when flashing to device --baud

The application is written to the main.avm partition of the board, wherever the installed AtomVM image put it: the partition table is read from the board first. Other partitions are named with --partition, for custom layouts and A/B partitioning, and several receive the same application when named together:

shell$ mix atomvm.esp32.flash --partition app_b
shell$ mix atomvm.esp32.flash --partition app_a,app_b

esp32_flash_offset pins an address instead and skips that read. An application bigger than its partition is refused; mix atomvm.esp32.expand grows a final main.avm partition to the end of the flash.

If the IDF_PATH environment variable is set, then the esptool.py from the IDF SDK installation will be used to flash the application to the ESP32 device. Otherwise, this plugin will attempt to use the esptool.py program from the user's PATH environment variable. The ESP Tool Python3 application can be installed from source or via many popular package managers. Consult your local OS documentation for more information.

Example:

shell$ mix atomvm.esp32.flash --port /dev/tty.usbserial
Generated my_project app
esptool.py v3.2-dev
Serial port /dev/tty.usbserial
Connecting.........
Chip is ESP32-D0WDQ6-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:c6:f7:2a:54:7c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00210000 to 0x00233fff...
Writing at 0x00210000... (11 %)
Writing at 0x00214000... (22 %)
Writing at 0x00218000... (33 %)
Writing at 0x0021c000... (44 %)
Writing at 0x00220000... (55 %)
Writing at 0x00224000... (66 %)
Writing at 0x00228000... (77 %)
Writing at 0x0022c000... (88 %)
Writing at 0x00230000... (100 %)
Wrote 147456 bytes at 0x00210000 in 13.0 seconds (91.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

The atomvm.esp32.monitor task

The atomvm.esp32.monitor task shows the console output of a connected ESP32 board, so that no serial console program is needed. It needs the optional pythonx dependency:

{:pythonx, "~> 0.4.0", runtime: false}

The port is opened without resetting the board, then the board is reset, so that its output is shown from the boot messages on:

shell$ mix atomvm.esp32.monitor

--no-reset leaves the board running and shows its output from now on, and --port names the port when the configured or detected one is not the wanted one. The console runs at 115200 baud; --baud changes that, the baud key of mix.exs being the flashing speed. A board that disappears, as boards connected through their native USB port do while they reset, is waited for.

shell$ mix atomvm.esp32.monitor --no-reset --port /dev/ttyACM0

The task runs until Ctrl+C, pressed twice, or for the number of seconds given with --timeout, for scripts:

shell$ mix atomvm.esp32.monitor --timeout 10

The atomvm.esp32.expand task

The atomvm.esp32.expand task expands a final main.avm partition to use the rest of the ESP32's detected physical flash. It updates the flash size encoded in the bootloader image header, reads the existing partition table at 0x8000, preserves all offsets and other partitions, updates the partition table checksum, flashes both updates, and verifies them.

This is useful when an AtomVM image contains a partition table sized for a smaller flash chip. Detected 8 MB, 16 MB, and 32 MB flash sizes are supported.

shell$ mix atomvm.esp32.expand --port /dev/tty.usbserial

Omit --port to use the configured AtomVM port or select a connected device automatically. The task refuses to make changes when another partition follows main.avm, because expanding it would overwrite that partition. It also refuses to modify devices with secure boot or secure download mode enabled.

The atomvm.esp32.install task

The atomvm.esp32.install task erases the flash of a connected ESP32 board and installs AtomVM on it. It needs the optional pythonx and req dependencies:

{:pythonx, "~> 0.4.0", runtime: false},
{:req, "~> 0.5.0", runtime: false}

Without options it installs the latest stable AtomVM release, saying so, since other images exist: prereleases, the nightly builds of atomvm-esp32-firmware-factory with extra components and features (for example PSRAM support), and images built by yourself. List them with:

shell$ mix atomvm.esp32.install --list-images

With a board connected, only the images for its chip are listed, along with the build it currently runs; --chip esp32s3 picks a chip without a board and --chip all lists everything. The listing ends with the images on disk and, should none fit, points at mix atomvm.esp32.build, which builds a custom image from source.

An image is installed by release tag, by the name shown in the listing, or by path, for a .img file or a firmware factory .zip bundle:

shell$ mix atomvm.esp32.install --version v0.7.0-alpha.1
shell$ mix atomvm.esp32.install --image AtomVM-esp32s3-atomgl-ipv6-libsodium-psram-nightly-0.7
shell$ mix atomvm.esp32.install --image _build/atomvm_images/atomvm-esp32s3-elixir.img

Before erasing anything the task shows what it is about to install and asks for confirmation. It refuses an image built for another chip than the connected one, and warns when an image has no Elixir support, because the Elixir application of the project would not run on it.

A GitHub repository publishing custom builds is used as a further source with --repo OWNER/REPO (or the repository's URL): alone it installs the latest release of that repository, with --version one of its releases, with --image one of its images by name, whatever the name, and with --list-images its builds are listed too.

shell$ mix atomvm.esp32.install --repo acme/atomvm-builds --image esp32s3-kiosk.img

--update replaces only the AtomVM virtual machine and its boot library on a board that already runs AtomVM, keeping the bootloader, the partition table, NVS (Wi-Fi settings and the like) and the application in main.avm:

shell$ mix atomvm.esp32.install --update
shell$ mix atomvm.esp32.install --update --image AtomVM-esp32s3-atomgl-ipv6-libsodium-psram-nightly-0.7

It works with every image the task can install, and refuses when the board runs no AtomVM, when its factory or boot.avm partition differs from the image's, or when its bootloader comes from a newer ESP-IDF than the image, since such a bootloader does not start the older virtual machine; install the whole image then. A main.avm grown by mix atomvm.esp32.expand does not stand in the way.

--download-only stops once the image is in firmware_images/, to install it later or offline, by the path the task prints. A release image is downloaded for the chip named with --chip, otherwise for the chip of the connected board; with --chip or --image neither a board nor pythonx is needed:

shell$ mix atomvm.esp32.install --download-only --chip esp32s3
shell$ mix atomvm.esp32.install --download-only --image AtomVM-esp32s3-atomgl-ipv6-libsodium-psram-nightly-0.7

Downloaded images are verified against the checksums GitHub publishes and kept in firmware_images/ at the root of the project, the builds of a repository given with --repo in a subdirectory named after it, so a nightly build stays available after the factory has replaced it, offline too: install it by its cached name or path. Keep the directory out of git with:

shell$ echo '/firmware_images/' >> .gitignore

The _build/atomvm_binaries directory of earlier versions is no longer used and can be deleted. --baud sets the flashing speed, 921600 by default; use 115200 for slow connections.

The atomvm.stm32.flash task

The atomvm.stm32.flash task is used to flash your application to a micro-controller and executed by the AtomVM virtual machine.

Note. Before running this task, you must flash the AtomVM virtual machine to the device. See the Getting Started section if the AtomVM documentation for information about how to flash the AtomVM image to a device.

The atomvm properties list in the Mix project file (mix.exs) may contain the following entries related to this task. These properties may also be over-ridden on the command line when running mix by using long-style flags:

Key Type Default Value Command line override
stflash_path string undefined The full path to the st-flash utility, if not in users PATH --stflash_path
stm32_flash_offset integer (hexademical format) 0x8080000 The beginning flash address to write to --flash_offset

Example:

shell$ mix atomvm.stm32.flash
warning: GPIO.digital_write/2 is undefined (module GPIO is not available or is yet to be defined)
  lib/Blinky.ex:34

warning: GPIO.set_pin_mode/2 is undefined (module GPIO is not available or is yet to be defined)
  lib/Blinky.ex:58

warning: GPIO.set_pin_mode/2 is undefined (module GPIO is not available or is yet to be defined)
  lib/Blinky.ex:59

warning: GPIO.set_pin_mode/2 is undefined (module GPIO is not available or is yet to be defined)
  lib/Blinky.ex:65

warning: :atomvm.platform/0 is undefined (module :atomvm is not available or is yet to be defined)
  lib/Blinky.ex:48

warning: :atomvm.platform/0 is undefined (module :atomvm is not available or is yet to be defined)
  lib/Blinky.ex:57

st-flash 1.7.0
2023-10-31T10:47:20 INFO common.c: F42x/F43x: 256 KiB SRAM, 2048 KiB flash in at least 16 KiB pages.
file Blinky.avm md5 checksum: 3dca925a9616d4d65dc9d87fbf19af, stlink checksum: 0x00767ad5
2023-10-31T10:47:20 INFO common.c: Attempting to write 156172 (0x2620c) bytes to stm32 address: 134742016 (0x8080000)
EraseFlash - Sector:0x8 Size:0x20000 2023-10-31T10:47:22 INFO common.c: Flash page at addr: 0x08080000 erased
EraseFlash - Sector:0x9 Size:0x20000 2023-10-31T10:47:24 INFO common.c: Flash page at addr: 0x080a0000 erased
2023-10-31T10:47:24 INFO common.c: Finished erasing 2 pages of 131072 (0x20000) bytes
2023-10-31T10:47:24 INFO common.c: Starting Flash write for F2/F4/F7/L4
2023-10-31T10:47:24 INFO flash_loader.c: Successfully loaded flash loader in sram
2023-10-31T10:47:24 INFO flash_loader.c: Clear DFSR
2023-10-31T10:47:24 INFO common.c: enabling 32-bit flash writes
2023-10-31T10:47:26 INFO common.c: Starting verification of write complete
2023-10-31T10:47:27 INFO common.c: Flash written and verified! jolly good!

The atomvm.pico.flash task

The atomvm.pico.flash task is used to flash your application to a micro-controller and executed by the AtomVM virtual machine.

Note. Before running this task, you must flash the AtomVM virtual machine to the device. See the Getting Started section if the AtomVM documentation for information about how to flash the AtomVM image to a device.

The atomvm properties list in the Mix project file (mix.exs) may contain the following entries related to this task:

Key Type Default Value
pico_path string "/run/media/${USER}/RPI-RP2" on linux; "/Volumes/RPI-RP2" on darwin (Mac) The full path to the pico mount point
pico_reset string "/dev/ttyACM*" on linux; "/dev/cu.usbmodem14*" on darwin The full path to the pico device to reset if required
picotool string undefined The full path to picotool executable (currently optional)

Properties in the mix.exs file may be over-ridden on the command line using long-style flags (prefixed by --) by the same name as the properties key. For example, you can use the --pico_path option to specify or override the pico_path property in the above table.

The atomvm.uf2create task

The atomvm.uf2create is use to create uf2 files appropriate for pico devices from a packed .avm application file, if the packed file does not exist the atomvm.packbeam task will be used to create the file (after compilation in necessary). Normally using this task manually is not required, it is called automatically by the atomvm.pico.flash if a uf2 file has not already been created.

The atomvm properties list in the Mix project file (mix.exs) may contain the following entries related to this task:

Key Type Default Value
app_start Address in hexademical format 0x10180000 The flash address to place the application
family_id atom or string universal The flavor of uf2 to create; rp2040, rp2350_riscv, rp2350_arm_s, rp2350_arm_ns, data, absolute, or universal

Properties in the mix.exs file may be over-ridden on the command line using long-style flags (prefixed by --) by the same name as the properties key. For example, you can use the --app_start option to specify or override the app_start property in the above table.

About

Build Elixir projects for your microcontroller

Resources

Stars

76 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages