You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #2254 from bettio/grow-erlang-boot-partition
ESP32: Increase Erlang boot.avm partition to 512KB
Users flashing applications to ESP32 devices with Erlang-only images must update their
flashing offset from `0x210000` to `0x250000`.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Copy file name to clipboardExpand all lines: doc/src/build-instructions.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -505,9 +505,9 @@ The flash layout is roughly as follows (not to scale):
505
505
| (factory) | |
506
506
| | |
507
507
+-----------------+ |
508
-
| boot.avm | 256-512KB v
509
-
+-----------------+ ------------- 0x210000 for Erlang only images or
510
-
| | ^ 0x250000 for images with Elixir modules
508
+
| boot.avm | 512KB v
509
+
+-----------------+ ------------- 0x250000
510
+
| | ^
511
511
| | |
512
512
| main.avm | 1MB+ | Erlang/Elixir
513
513
| | | Application
@@ -524,11 +524,13 @@ The following table summarizes the partitions created on the ESP32 when deployin
524
524
| NVS | 0x9000 | 24kB | Space for non-volatile storage. |
525
525
| PHY_INIT | 0xF000 | 4kB | Initialization data for physical layer radio signal data. |
526
526
| AtomVM virtual machine | 0x10000 | 1.75mB | The AtomVM virtual machine (compiled from C code). |
527
-
| boot.avm | 0x1D0000 |256k| The AtomVM BEAM library, compiled from Erlang and Elixir files in the AtomVM source tree. |
528
-
| main.avm |`0x210000`\|`0x250000`| 1mB | The user application. This is where users flash their compiled Erlang/Elixir code |
527
+
| boot.avm | 0x1D0000 |512k| The AtomVM BEAM library, compiled from Erlang and Elixir files in the AtomVM source tree. |
528
+
| main.avm | 0x250000 | 1mB | The user application. This is where users flash their compiled Erlang/Elixir code |
529
529
530
-
```{warning}
531
-
There is an important difference in the partition layout between the minimal images and those build with Elixir support. To accommodate the extra Elixir modules the boot.avm partition on these images is larger, and the application offset is moved accordingly. When working with Elixir supported images it is important to always use the offset `0x250000` whether using `mix` or the `atomvm_rebar3_plugin` (possibly to test an Erlang app), otherwise part of the boot.avm partition (specifically the area where many Elixir modules are located) will be overwritten with the application, but the VM will still be trying to load from the later `0x250000` offset. This should be kept in mind reading the rest of build instructions, and [AtomVM Tooling](./atomvm-tooling.md) sections of the docs that cover the use of rebar3, for these sections an Erlang only image is assumed.
530
+
```{note}
531
+
Since v0.7.0-alpha.1, both Erlang-only and Elixir-supported images use the same partition layout
532
+
and the same `main.avm` offset of `0x250000`. Previous versions used `0x210000` for Erlang-only
533
+
images.
532
534
```
533
535
534
536
### The `boot.avm` and `main.avm` partitions
@@ -537,7 +539,7 @@ The `boot.avm` and `main.avm` partitions are intended to store Erlang/Elixir lib
537
539
538
540
The `boot.avm` partition is intended for core Erlang/Elixir libraries that are built as part of the AtomVM build. The release image of AtomVM (see below) includes both the AtomVM virtual machine and the `boot.avm` partition, which includes the BEAM files from the `estdlib` and `eavmlib` libraries.
539
541
540
-
In contrast, the `main.avm` partition is intended for user applications. Currently, the `main.avm` partition starts at address `0x210000` for thin images or `0x250000` for images with Elixir modules, and it is to that location to which application developers should flash their application AVM files.
542
+
In contrast, the `main.avm` partition is intended for user applications. Currently, the `main.avm` partition starts at address `0x250000`, and it is to that location to which application developers should flash their application AVM files.
541
543
542
544
The AtomVM search path for BEAM modules starts in the `main.avm` partition and falls back to `boot.avm`. Users should not have a need to override any functionality in the `boot.avm` partition, but if necessary, a BEAM module of the same name in the `main.avm` partition will be loaded instead of the version in the `boot.avm` partition.
543
545
@@ -580,7 +582,7 @@ Wrote AtomVM Virtual Machine at offset 0x10000 (65536)
580
582
Wrote AtomVM Core BEAM Library at offset 0x1D0000 (1114112)
581
583
```
582
584
583
-
Users can then use the `esptool.py` directly to flash the entire image to the ESP32 device, and then flash their applications to the `main.app` partition at address `0x210000`, (or `0x250000` for Elixir images)
585
+
Users can then use the `esptool.py` directly to flash the entire image to the ESP32 device, and then flash their applications to the `main.app` partition at address `0x250000`.
584
586
585
587
But first, it is a good idea to erase the flash, e.g.,
Copy file name to clipboardExpand all lines: doc/src/getting-started-guide.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ The ES32 AtomVM virtual machine is an IDF application that runs on the ESP32 pla
51
51
52
52
The AtomVM virtual machine is implemented in C, and the AtomVM binary image contains the binary object code compiled from C source files, as well as the ESP boot loader and partition map, which tells the ESP32 how the flash module is laid out.
53
53
54
-
AtomVM developers will typically write their applications in Erlang or Elixir. These source files are compiled into BEAM bytecode, which is then assembled into AtomVM "packbeam" (`.avm`) files. This packbeam file is flashed onto the ESP32 device, starting at the data partition address `0x210000`. When AtomVM starts, it will look in this partition for the first occurrence of a BEAM module that exports a `start/0` function. Once that module is located, execution of the BEAM bytecode will commence at that point.
54
+
AtomVM developers will typically write their applications in Erlang or Elixir. These source files are compiled into BEAM bytecode, which is then assembled into AtomVM "packbeam" (`.avm`) files. This packbeam file is flashed onto the ESP32 device, starting at the data partition address `0x250000`. When AtomVM starts, it will look in this partition for the first occurrence of a BEAM module that exports a `start/0` function. Once that module is located, execution of the BEAM bytecode will commence at that point.
55
55
56
56
The following diagram provides a simplified overview of the layout of the AtomVM virtual machine and Erlang/Elixir applications on the ESP32 flash module.
57
57
@@ -66,8 +66,8 @@ The following diagram provides a simplified overview of the layout of the AtomVM
66
66
| Virtual | |
67
67
| Machine | |
68
68
| | v
69
-
+---------------+ ----------- 0x210000 for thin images or
70
-
| | ^ 0x250000 for images with Elixir modules
69
+
+---------------+ ----------- 0x250000
70
+
| | ^
71
71
| | |
72
72
| data | | Erlang/Elixir
73
73
| partition | | Application
@@ -187,7 +187,7 @@ Instructions for building AtomVM from source are covered in the AtomVM [Build In
187
187
188
188
### Deploying an AtomVM application for ESP32
189
189
190
-
An AtomVM application is a collection of BEAM files, which have been compiled using the Erlang or Elixir compiler. These BEAM files are assembled into an AtomVM "packbeam" (`.avm`) file, which in turn is flashed to the `main` data partition on the ESP32 flash module, starting at address `0x210000` if you are using a thin image, or `0x250000` for images with Elixir support.
190
+
An AtomVM application is a collection of BEAM files, which have been compiled using the Erlang or Elixir compiler. These BEAM files are assembled into an AtomVM "packbeam" (`.avm`) file, which in turn is flashed to the `main` data partition on the ESP32 flash module, starting at address `0x250000`.
191
191
192
192
When the AtomVM virtual machine starts, it will search for the first module that contains an exported `start/0` function in this partition, and it will begin execution of the BEAM bytecode at that function.
0 commit comments