platform = native
Native development platform is intended to be used for desktop OS. This platform uses built-in toolchains (preferable based on GCC), frameworks, libs from particular OS where it will be run.
For more detailed information please visit vendor site.
PlatformIO does not install automatically any toolchains
for the native development platform. It depends
on the system GCC
toolchain that must be added to the PATH
system environment variable.
Please open the system terminal and type gcc --version
. If the
gcc
command is not found, you have to install the GCC toolchain
manually depending on your operating system:
Windows - follow the MSYS2
installation guide and add the following paths to the PATH
system environment variable:
C:\msys64\mingw64\bin
C:\msys64\usr\bin
Linux - open the system terminal and run the following commands:
sudo apt update
sudo apt install build-essential
macOS - open the system terminal and install Xcode Command Line Tools
xcode-select --install
To execute a native program, you need to use exec
target for the
pio run --target
command. Extra program arguments can be
passed using the pio run --program-arg
option.
Example
> pio run -t exec
# extra args
> pio run -t exec --program-arg "arg1" --program-arg="--option1=value1"
# or short format
> pio run -t exec -a "arg1" -a "--option1=value1"
Examples are listed from Native development platform repository:
You can switch between stable releases of Native development platform and the latest upstream version using platform option in “platformio.ini” (Project Configuration File) as described below.
; Latest stable version
[env:latest_stable]
platform = native
board = ...
; Custom stable version
[env:custom_stable]
platform = native@x.y.z
board = ...
[env:upstream_develop]
platform = https://github.com/platformio/platform-native.git
board = ...