platformio / platformio/platformio-core

[feature request] PlatformIO CLI get board_build.mcu

Open
#5,262 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

Summary

I'm trying to do a small tool for build merged firmware binaries for my CI pipeline, and I found that is so hard to determinate what kind of mcu is in the specific platformio env, I mean, I wanna to know what board and its mcu is on each env:xxxx. Maybe something like this:

pio project config -e myenv board_mcu

My target is retrieve what mcu or core type, with this command, something like esp32s2, esp32c3, esp32s3 or esp32 of each pio env definition, but without use Python or modify the PlatformIO project, because the idea is release this tool for general purpose.

Meanwhile I was trying to retrieve the boards and its mcu from the pio project config but it is so hard because when you have some extended envs, you don't have the board, and the config output is confuse.

This is my current script section that do that:

  # Get board name
  board_config=$(pio project config | grep -A 10 "env:$1") 
  board_name=$(echo "$board_config" | grep "board" | awk '{print $3}')
  
  # Check global and project-specific board JSON files
  global_json_path="$HOME/.platformio/platforms/espressif32/boards/$board_name.json"
  project_json_path="boards/$board_name.json"
  
  if [[ -f "$global_json_path" ]]; then
      mcu_core=$(jq -r '.build.mcu' "$global_json_path")
  elif [[ -f "$project_json_path" ]]; then
      mcu_core=$(jq -r '.build.mcu' "$project_json_path")
  else
      mcu_core="unknown (board JSON not found)"
  fi
  
  echo " - Board: $board_name"
  echo " - MCU Core: $mcu_core"

but it is not working for specialized projects with many envs and some extended envs like this:
https://github.com/kike-canaries/canairio_firmware

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The request centers on the pio project config command and env: inheritance; no implementation file or test is named. Start by tracing that CLI entry point and its project-configuration handling, then define how resolved boards and build.mcu should be reported for inherited and specialized environments. Done means the command handles the multi-environment cases described without requiring project changes or Python code.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.