elral
December 31, 2023, 8:14am
1
Is there a way to run a script after all environments are compiled?
I am having really problems to firgure out what arguments can be passed to env.AddPostAction([argument], copy_fw_files) and even I am not sure if this would be the correct way via extra_scripts
.
And what would be the argument if I want to copy an .uf2
file instead of a .hex
file after compiling for a Raspberry Pico? .uf2
as argument does not work.
→ edit: for now I am checking for .bin
and if so substituting by .uf2
before copying.
elral
December 31, 2023, 2:20pm
3
Hmhm, not sure.
We have a platformio.ini file like:
; Build settings for the Arduino Mega
[env:mobiflight_mega]
platform = atmelavr
board = megaatmega2560
framework = arduino
build_flags =
${env.build_flags}
-I./_Boards/Atmel/Board_Mega
build_src_filter =
${env.build_src_filter}
lib_deps =
${env.lib_deps}
${env.custom_lib_deps_Atmel}
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}
; Build settings for the Arduino Pro Micro
[env:mobiflight_micro]
platform = atmelavr
board = sparkfun_promicro16
framework = arduino
build_flags =
${env.build_flags}
-I./_Boards/Atmel/Board_ProMicro
build_src_filter =
${env.build_src_filter}
lib_deps =
${env.lib_deps}
${env.custom_lib_deps_Atmel}
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}
; Build settings for the Arduino Uno
[env:mobiflight_uno]
platform = atmelavr
board = uno
framework = arduino
build_flags =
${env.build_flags}
-I./_Boards/Atmel/Board_Uno
build_src_filter =
${env.build_src_filter}
lib_deps =
${env.lib_deps}
${env.custom_lib_deps_Atmel}
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}
; Build settings for the Arduino Nano
[env:mobiflight_nano]
platform = atmelavr
board = nanoatmega328
framework = arduino
build_flags =
${env.build_flags}
-I./_Boards/Atmel/Board_Nano
build_src_filter =
${env.build_src_filter}
lib_deps =
${env.lib_deps}
${env.custom_lib_deps_Atmel}
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}
; Build settings for the Raspberry Pico original
[env:mobiflight_raspberrypico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower ; select new core
board_build.filesystem_size = 0M ; configure filesystem size. Default 0 Mbyte.
lib_ldf_mode = chain+
upload_protocol = mbed ; for debugging upoading can be changed to picoprobe
;debug_tool = picoprobe ; and uncomment this for debugging w/ picoprobe
build_flags =
${env.build_flags}
-I./_Boards/RaspberryPi/Pico
build_src_filter =
${env.build_src_filter}
lib_deps =
${env.lib_deps}
ricaun/ArduinoUniqueID @ ^1.3.0
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}
There is already one extra_script
which gets exectuted for each environment.
But now we need to run a script after all environments were build, so when pio run
is finished.
We don’t provide this option. You can wrap the pio run
command with some external script (Bash, Python, etc) and later process your custom commands/logic.