PlatformIO Community

Platform_packages in platformio.ini not working as expected

I’ve cloned and built the espressif/arduino-esp32 package, uploaded it to github, and specified it in the platformio.ini file via the platform_packages stanza (shown below). However, when I build the project (after a pio pkg update and pio run -t clean, it’s never picking up my version of the package. It’s being fetched into ~/.platformio/packages directory (shown at end) just like the framework-arduinoespressif32, but it’s not being used.

I’ve run pio run -v 2>1 >output.txt and taken a look through it, but all the references are to framework-arduinoespressif32. I’ve also tried specifying it as a platform =, but that resulted in Error: This board doesn't support https://github.com/jcwren/framework-arduinoespressif32 framework!. I also tried it as a platform =, which resulted in Error: Could not find one of 'platform.json' manifest files in the package (which is correct, there’s no platform.json in either directory).

What do I need to do to get PlatformIO to use framework-arduinoespressif32-jcw instead of framework-arduinoespressif32?

[platformio]
default_envs = v2x

[env]
platform = espressif32
framework = arduino
lib_deps =
  bblanchon/ArduinoJson@^6.19.4
  heltecautomation/Heltec ESP32 Dev-Boards@^1.1.1
  https://github.com/jcwren/ESP32_LoRaWAN.git
  adafruit/CAN Adafruit Fork@^1.2.1
  end2endzone/SoftTimers@^2.0.0
  ayushsharma82/AsyncElegantOTA@^2.2.7
  esphome/AsyncTCP-esphome@^2.0.0
  https://github.com/me-no-dev/ESPAsyncWebServer.git
  marvinroger/AsyncMqttClient@^0.9.0
lib_ldf_mode = deep+
build_type = debug
build_flags =
  -D REGION_US915
  -D ACTIVE_REGION=LORAMAC_REGION_US915
  -D LORAWAN_DEBUG_LEVEL=0
  -D LORAWAN_PREAMBLE_LENGTH=8
monitor_speed = 115200
monitor_filters = esp32_exception_decoder

[env:v2]
board = heltec_wifi_lora_32_V2

[env:v2x]
board = heltec_wifi_lora_32_V2
platform_packages =
  framework-arduinoespressif32-jcw @ https://github.com/jcwren/framework-arduinoespressif32
total 0
drwx------  13 jcw  staff   416B Nov 12 20:16 framework-arduinoespressif32
drwx------  22 jcw  staff   704B Nov 12 20:39 framework-arduinoespressif32-jcw
drwx------  24 jcw  staff   768B Nov  4 11:38 tool-esptoolpy
drwx------   5 jcw  staff   160B Nov  4 11:43 tool-mkfatfs
drwx------   5 jcw  staff   160B Nov  4 11:43 tool-mklittlefs
drwx------   7 jcw  staff   224B Nov  4 11:43 tool-mkspiffs
drwx------  14 jcw  staff   448B Nov  4 11:39 tool-scons
drwx------   9 jcw  staff   288B Nov  4 11:38 toolchain-xtensa-esp32

The builder script for framework = arduino will only ever be looking at the framework-arduinoespressif32 package.

Having a different name in your forked Arduino-ESP32’s package.json or platformio.ini will make it just be ignored completely in the build process.

Do the fork, do no changes to the package.json, and specify

platform_packages =
  framework-arduinoespressif32@https://github.com/jcwren/framework-arduinoespressif32

Just like the documentation says.

1 Like

Thank you. Unfortunately, “Just like the documentation says.” was not clear that it is NECESSARY to use the same name to override a default package. As my configuration allows for building against the default framework-arduinoespressif32 and my version of framework-arduinoespressif32, I was under the (mistaken) assumption that namespace collision would be an issue.

Trust me, I spent plenty of time Googling this and reading the documentation before I asked.