Skip to content

Commit df76c05

Browse files
committed
Allow passing packbeam options from other tasks
Update the platform_flash_providers and uf2create provider to pass options to packbeam. Capitalized versions of the short option are used for pass-through to avoid conflicts with existing task options and to maintain some consistency and clarity about which options are passed to packbeam and which are consumed by the task. The `start` option has not been exposed, since this should be determined by other means, and the long and short versions of the option collides with other tasks options. Closes #65 Signed-off-by: Winford <winford@object.stream>
1 parent ad82c28 commit df76c05

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ Any setting specified on the command line take precedence over settings in `reba
180180

181181
The `packbeam` task depends on the `compile` task, so any changes to modules in the project will automatically get rebuilt when running the `packbeam` task.
182182

183+
Packbeam options may also be passed through from other higher level tasks such as `uf2create` or
184+
the various flash tasks for mcu platforms. When options for packbeam are given to other tasks use
185+
the long version, or the capitalized version of the short parameters, for example `-P` or
186+
`--prune` intstead of `-p`.
187+
183188
#### External Dependencies
184189

185190
If you already have AVM modules are not available via `rebar3`, you can direct the `packbeam` task to these AVM files via the `--external` (or `-e`) flag, e.g.,

src/atomvm_esp32_flash_provider.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
3232
{chip, $c, "chip", string, "ESP chip (default auto)"},
3333
{port, $p, "port", string, "Device port (default /dev/ttyUSB0)"},
3434
{baud, $b, "baud", integer, "Baud rate (default 115200)"},
35-
{offset, $o, "offset", string, "Offset (default 0x210000)"}
35+
{offset, $o, "offset", string, "Offset (default 0x210000)"},
36+
{prune, $P, "prune", boolean, "Prune unused modules with packbeam"},
37+
{external, $E, "external", string, "External modules to add to packed AVM"},
38+
{force, $F, "force", boolean, "Force packbeam to repack"},
39+
{application, $A, "application", boolean, "Build and flash an OTP application"},
40+
{remove_lines, $R, "remove_lines", boolean,
41+
"Remove line information from generated AVM files (off by default)"},
42+
{list, $L, "list", boolean, "List the contents of AVM files after creation"}
3643
]).
3744

3845
-define(DEFAULT_OPTS, #{

src/atomvm_pico_flash_provider.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@
3535
"Path to pico device (Defaults Linux: /run/media/${USER}/RPI-RP2, MacOS: /Volumes/RPI-RP2)"},
3636
{reset, $r, "reset", string,
3737
"Path to serial device to reset before flashing (Defaults Linux: /dev/ttyACM0, MacOS: /dev/cu.usbmodem14*)"},
38-
{picotool, $t, "picotool", string, "Path to picotool utility (Default is to search in PATH)"}
38+
{picotool, $t, "picotool", string, "Path to picotool utility (Default is to search in PATH)"},
39+
{prune, $P, "prune", boolean, "Prune unused modules with packbeam"},
40+
{external, $E, "external", string, "External modules to add to packed AVM"},
41+
{force, $F, "force", boolean, "Force packbeam to repack"},
42+
{application, $A, "application", boolean, "Build and flash an OTP application"},
43+
{remove_lines, $R, "remove_lines", boolean,
44+
"Remove line information from generated AVM files (off by default)"},
45+
{list, $L, "list", boolean, "List the contents of AVM files after creation"}
3946
]).
4047

4148
%%

src/atomvm_stm32_flash_provider.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
3232
-define(DEPS, [packbeam]).
3333
-define(OPTS, [
3434
{stflash, $s, "stflash", string, "Path to st-flash"},
35-
{offset, $o, "offset", string, "Offset (default 0x8080000)"}
35+
{offset, $o, "offset", string, "Offset (default 0x8080000)"},
36+
{prune, $P, "prune", boolean, "Prune unused modules with packbeam"},
37+
{external, $E, "external", string, "External modules to add to packed AVM"},
38+
{force, $F, "force", boolean, "Force packbeam to repack"},
39+
{application, $A, "application", boolean, "Build and flash an OTP application"},
40+
{remove_lines, $R, "remove_lines", boolean,
41+
"Remove line information from generated AVM files (off by default)"},
42+
{list, $L, "list", boolean, "List the contents of AVM files after creation"}
3643
]).
3744

3845
-define(DEFAULT_OPTS, #{

src/atomvm_uf2create_provider.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@
3333
"Device family or flavor of uf2 file to create (default universal)"},
3434
{output, $o, "output", string, "Output path/name"},
3535
{start, $s, "start", string, "Start address for the uf2 binary (default 0x10180000)"},
36-
{input, $i, "input", string, "Input avm file to convert to uf2"}
36+
{input, $i, "input", string, "Input avm file to convert to uf2"},
37+
{prune, $P, "prune", boolean, "Prune unused modules with packbeam"},
38+
{external, $E, "external", string, "External modules to add to packed AVM"},
39+
{force, $F, "force", boolean, "Force packbeam to repack"},
40+
{application, $A, "application", boolean, "Build and flash an OTP application"},
41+
{remove_lines, $R, "remove_lines", boolean,
42+
"Remove line information from generated AVM files (off by default)"},
43+
{list, $L, "list", boolean, "List the contents of AVM files after creation"}
3744
]).
3845

3946
-define(DEFAULT_OPTS, #{

0 commit comments

Comments
 (0)