Launch Types

There are two execution types for extra scripts:

  • PRE - executes before the main script of Development Platforms.

    Useful to pre-generate extra source files or make dynamic changes/patches to the existing, pass flags to the global building environment, add Build Middlewares, etc. Please note that the projenv (see Construction Environments) is not available at this stage.

  • POST - executes after the PRE and the main script of Development Platforms.

    The building environment is fully constructed at this stage with all build flags, development platform targets, dependent libraries, and projenv. Useful to assign Pre & Post Actions, modify default build flags set by the development platform, or extend the building workflow.

The extra scripts can be configured using the extra_scripts option in “platformio.ini” (Project Configuration File). The launch type can be specified as a prefix (pre: or post:) to the script path. If there is no prefix specified, the post: will be used automatically.

Example

[env:my_env_1]
platform = ...
; Defaults to POST script since no prefix is used
extra_scripts = post_extra_script.py

[env:my_env_2]
platform = ...
extra_scripts =
  pre:pre_extra_script.py
  post:post_extra_script1.py
  post_extra_script2.py