LinuxCommandLibrary

pio-init

Initialize PlatformIO project environment

TLDR

View documentation for the original command

$ tldr pio project
copy

SYNOPSIS

pio init [OPTIONS]

PARAMETERS

--project-dir
    Specify the project directory (default: current working directory).

--ide
    Generate project files for the specified IDE (e.g., vscode, atom, eclipse).

--board
    Set the default board for the project. You can find board IDs using the pio boards command.

--environment
    Set the environment name in the platformio.ini file. It can contain several board ids, framework, upload ports. It is useful when you have several projects. This option requires --board.

-d, --project-option
    Define project options in the form of section.option = value. These options are added to the platformio.ini file.

--lib-dir
    Define custom library directory.

--src-dir
    Define source directory

DESCRIPTION

The pio init command is a core part of the PlatformIO Core command-line interface (CLI). It initializes a new PlatformIO project within a specified directory. This process sets up the necessary directory structure and configuration files (platformio.ini) that are essential for managing the project's build environment, dependencies (libraries), and target hardware platforms.

The pio init command automates the creation of a basic project framework, eliminating the need to manually create folders and configuration files. After successful initialization, you can then use other PlatformIO commands to build, upload, and manage your project, streamlining the development workflow for embedded systems and IoT projects.

CAVEATS

Running pio init in an existing directory will overwrite any existing platformio.ini file. Always backup critical files before initializing a new project.

IDE INTEGRATION

Using the --ide flag simplifies the setup process for popular IDEs. PlatformIO will generate the necessary project files and configurations, enabling seamless integration with the chosen IDE. This reduces manual configuration steps and improves the development experience. Supported IDEs include but are not limited to VSCode, Atom, and Eclipse.

PROJECT STRUCTURE

The command generates a standard project structure, typically including a src directory for source code, a lib directory for project-specific libraries, and the platformio.ini file for project configuration.

HISTORY

The pio init command was introduced as part of the initial release of PlatformIO Core. It has been continuously refined and expanded to support a wider range of IDEs, boards, and project options to accommodate the evolving needs of the embedded development community. It is a crucial command for rapid project setup and management within the PlatformIO ecosystem.

SEE ALSO

pio run(1), pio boards(1), platformio.ini(5)

Copied to clipboard