-
-
Notifications
You must be signed in to change notification settings - Fork 827
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