PlatformIO STM32 Platform

repository·develop·Indexed 19 days ago

https://github.com/platformio/platform-ststm32

Provides support for the STM32 family of 32-bit ARM Cortex-M microcontrollers within the PlatformIO ecosystem. Includes documentation and examples for building and uploading firmware using PlatformIO Core, covering frameworks such as Arduino, CMSIS, and libopencm3.

Tokens
14.5K
Snippets
60
Records
70
Agent score
65%

What's inside platform-ststm32

  1. Build and upload the mbed-rtos-events example

    develop

    To build and upload the mbed-rtos-events example project using PlatformIO Core, follow these steps:

    1. Install PlatformIO Core.
    2. Download the development platform with examples from the repository.
    3. Extract the ZIP archive.
    4. Navigate to the example directory and use the pio CLI to build, upload, or clean the project.
    # Change directory to example
    $ cd platform-ststm32/examples/mbed-rtos-events
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Build specific environment
    $ pio run -e nucleo_f091rc
    
    # Upload firmware for the specific environment
    $ pio run -e nucleo_f091rc --target upload
    
    # Clean build files
    $ pio run --target clean
  2. Build and upload for a specific environment

    develop

    If the project contains multiple target environments (e.g., different boards or configurations), use the -e or --environment flag to specify which one to build or upload. This prevents PlatformIO from attempting to build all environments defined in the configuration.

    To build a specific environment (e.g., maple): pio run -e maple

    To upload firmware for a specific environment (e.g., maple): pio run -e maple --target upload

    # Build specific environment
    $ pio run -e maple
    
    # Upload firmware for the specific environment
    $ pio run -e maple --target upload
  3. Manage specific build environments and clean files

    develop

    When working with multiple board configurations in a PlatformIO project, you can target specific environments using the -e (or --environment) flag. You can also clean the build directory to remove artifacts.

    Target a specific environment

    To build or upload for a specific board (e.g., disco_f407vg):

    pio run -e disco_f407vg
    pio run -e disco_f407vg --target upload

    Clean build files

    To remove all build artifacts and start a fresh build:

    pio run --target clean
    # Build specific environment
    $ pio run -e disco_f407vg
    
    # Upload firmware for the specific environment
    $ pio run -e disco_f407vg --target upload
    
    # Clean build files
    $ pio run --target clean
  4. Build and upload the mbed-rtos-custom-target example

    develop

    To use the mbed-rtos-custom-target example, you must first install the PlatformIO Core and download the development platform containing the examples. After extracting the archive, navigate to the example directory and use the PlatformIO CLI to build, upload, or clean the project.

    Prerequisites

    1. Install PlatformIO Core.
    2. Download the development platform with examples.
    3. Extract the ZIP archive.

    Workflow Commands

    Navigate to the specific example directory before running commands: cd platform-ststm32/examples/mbed-rtos-custom-target

    # Change directory to example
    $ cd platform-ststm32/examples/mbed-rtos-custom-target
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Clean build files
    $ pio run --target clean
  5. Manage builds for specific environments in the Zephyr C++ example

    develop

    When working with multiple target boards, you can use the -e or --environment flag to specify a particular build environment (e.g., nucleo_f756zg). This allows you to build or upload firmware for a specific board without running all available environments in the project.

    # Build specific environment
    pio run -e nucleo_f756zg
    
    # Upload firmware for the specific environment
    pio run -e nucleo_f756zg --target upload
  6. Build and upload the Zephyr USB HID Mouse example

    develop

    To use this example, you must have PlatformIO Core installed. This example demonstrates a Zephyr subsystem implementation of a USB HID mouse on an STM32 platform.

    Setup Steps

    1. Install PlatformIO Core.
    2. Download the development platform containing examples from the repository.
    3. Extract the ZIP archive.
    4. Navigate to the example directory: cd platform-ststm32/examples/zephyr-subsys-usb-hid-mouse

    Common Commands

    Use the PlatformIO Core CLI (pio) to manage the build lifecycle.

    # Change directory to example
    $ cd platform-ststm32/examples/zephyr-subsys-usb-hid-mouse
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Build specific environment
    $ pio run -e disco_f407vg
    
    # Upload firmware for the specific environment
    $ pio run -e disco_f407vg --target upload
    
    # Clean build files
    $ pio run --target clean
  7. Build and upload the mbed-rtos-filesystem example

    develop

    To run the mbed-rtos-filesystem example, you must have PlatformIO Core installed. Follow these steps to build, upload, and clean the project:

    1. Install PlatformIO Core: Ensure pio is available in your terminal.
    2. Download the platform: Download the development platform ZIP archive containing the examples.
    3. Extract and Navigate: Extract the archive and change your working directory to the specific example folder: platform-ststm32/examples/mbed-rtos-filesystem.
    4. Build: Use pio run to compile the project.
    5. Upload: Use pio run --target upload to flash the firmware to your STM32 board.
    6. Clean: Use pio run --target clean to remove build artifacts.
    # Change directory to example
    cd platform-ststm32/examples/mbed-rtos-filesystem
    
    # Build project
    pio run
    
    # Upload firmware
    pio run --target upload
    
    # Clean build files
    pio run --target clean
  8. Build and upload the Zephyr Net HTTPS Client example

    develop

    To use the zephyr-net-https-client example, you must have PlatformIO Core installed. Follow these steps to set up the environment and run the project:

    1. Install PlatformIO Core: Ensure pio is available in your terminal.
    2. Download the platform: Download the development platform ZIP archive containing the examples.
    3. Extract and Navigate: Extract the archive and change your working directory to the specific example folder.
    4. Build, Upload, or Clean: Use the PlatformIO CLI to manage the project lifecycle.
    # Change directory to example
    $ cd platform-ststm32/examples/zephyr-net-https-client
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Clean build files
    $ pio run --target clean
  9. Build the mbed-rtos-ethernet-tls example project

    develop

    To build and run the mbed-rtos-ethernet-tls example, you must first have PlatformIO Core installed. Download the development platform archive, extract it, and navigate to the specific example directory before running PlatformIO commands.

    Prerequisites

    1. Install PlatformIO Core.
    2. Download the development platform with examples and extract the ZIP archive.

    Execution Steps

    Navigate to the example folder and use the pio CLI to build, upload, or clean the project.

    # Change directory to example
    $ cd platform-ststm32/examples/mbed-rtos-ethernet-tls
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Clean build files
    $ pio run --target clean
  10. Build and upload the mbed-rtos-usb-keyboard example

    develop

    To build and upload the mbed-rtos-usb-keyboard example project using PlatformIO Core, follow these steps:

    1. Install PlatformIO Core.
    2. Download the development platform with examples from the repository.
    3. Extract the ZIP archive.
    4. Navigate to the example directory and use the pio CLI to build, upload, or clean the project.
    # Change directory to example
    $ cd platform-ststm32/examples/mbed-rtos-usb-keyboard
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Build specific environment
    $ pio run -e nucleo_l476rg
    
    # Upload firmware for the specific environment
    $ pio run -e nucleo_l476rg --target upload
    
    # Clean build files
    $ pio run --target clean
  11. Build and upload the mbed-blink-baremetal example

    develop

    To build and upload the mbed-blink-baremetal example project, follow these steps:

    1. Install PlatformIO Core.
    2. Download the development platform with examples from the repository.
    3. Extract the ZIP archive.
    4. Navigate to the example directory and use the PlatformIO CLI to build, upload, or clean the project.
    # Change directory to example
    $ cd platform-ststm32/examples/mbed-blink-baremetal
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Build specific environment
    $ pio run -e nucleo_f401re
    
    # Upload firmware for the specific environment
    $ pio run -e nucleo_f401re --target upload
    
    # Clean build files
    $ pio run --target clean
  12. Build and upload the arduino-mbed-rpc example

    develop

    To build and upload the arduino-mbed-rpc example using the PlatformIO Core CLI, follow these steps:

    1. Ensure PlatformIO Core is installed.
    2. Navigate to the example directory.
    3. Use pio run to compile the project.
    4. Use pio run --target upload to flash the firmware to your device.
    5. Use pio run --target clean to remove build artifacts.
    # Change directory to example
    $ cd platform-nordicnrf52/examples/arduino-mbed-rpc
    
    # Build project
    $ pio run
    
    # Upload firmware
    $ pio run --target upload
    
    # Clean build files
    $ pio run --target clean