Skip to content

Commit 577b6fb

Browse files
committed
Make pico_flash task abort on errors
The provider will now abort when an error in encountered, rather than try to continue after a failure. Signed-off-by: Winford <winford@object.stream>
1 parent 46bd7de commit 577b6fb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
rp2040 or rp2350 devices.
2424
- The `pico_flash` task now checks that a device is an RP2 platform before resetting to `BOOTSEL`
2525
mode, preventing interference with other MCUs that may be attached to the host system.
26+
- The `pico_flash` task now aborts on all errors rather than trying to continue after a failure.
2627

2728
## [0.7.5] (2025.05.27)
2829

src/atomvm_pico_flash_provider.erl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ do(State) ->
7979
{ok, State}
8080
catch
8181
_C:E:_S ->
82-
rebar_api:error("An error occurred in the ~p task. Error=~p~n", [?PROVIDER, E]),
83-
{error, E}
82+
rebar_api:abort("An error occurred in the ~p task. Error=~p~n", [?PROVIDER, E])
8483
end.
8584

8685
-spec format_error(any()) -> iolist().
@@ -278,8 +277,7 @@ do_reset(ResetPort, Picotool) ->
278277
"The device was asked to reboot into BOOTSEL mode." ->
279278
ok;
280279
BootError ->
281-
rebar_api:error("Failed to prepare pico for flashing: ~s", [BootError]),
282-
erlang:throw(picoflash_reboot_error)
280+
rebar_api:abort("Failed to prepare pico for flashing: ~s", [BootError])
283281
end
284282
end
285283
end.
@@ -319,8 +317,7 @@ do_flash(ProjectApps, PicoPath, ResetDev, Picotool) ->
319317
{ok, _Size} ->
320318
ok;
321319
CopyError ->
322-
rebar_api:error("Failed to copy application file ~s to pico: ~s", [File, CopyError]),
323-
erlang:throw(picoflash_copy_error)
320+
rebar_api:abort("Failed to copy application file ~s to pico: ~s", [File, CopyError])
324321
end,
325322
rebar_api:info("Successfully loaded ~s application to the device.", [App]),
326323
ok.

0 commit comments

Comments
 (0)