pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
vi ~/.bashrc
(or .profile or zshrc...) and addexport PATH="$PATH:~/.platformio/penv/bin"
- close your terminal and reopen or
source ~/.bashrc
to reload the PATH - (optional) activate the virtual environment,
. activate
which should now be in the PATH - can you run the cli?
pio
? if not go here, https://docs.platformio.org/en/latest/installation.html
- Just search for and install the extension
PlatformIO
- Open
settings.json
in VSCode (from the Command Palette typePreferences Open Settings (JSON)
) - Add the following (inside
{...}
),note, customPATH probably isn't necessary since we added it to the"platformio-ide.customPATH": "~/.platformio/penv/bin", "platformio-ide.useDevelopmentPIOCore": true
PATH
- Restart VSCode
- use the cli an run ,
pio run
this will take a minute to fetch the board firmware and build it. Look in the newly created folder /.pio to see what is pulled down - once everything is built then you need to upload the program (/src/main.cpp) to a board, this example uploads to the ESP8266 board,
pio run -e planter -t upload
. Note, if you have all your boards connected via a serial port then you don't need to specify-e
or which environment to upload to.upload_port
is pegged to a specific port, this should change as needed.
pio device monitor -b 115200
This project doesn't need VSCode or the PlatformIO extension in VSCode. If you look closely at the commands executed, all that is needed is PlatformIO Core and the included CLI.
Once the board is flashed it will run and connect to the MQTT broker. The board will subscribe to test/lol
as well as publish to this topic. To test the board's subscritpion make sure mosquitto is installed brew install mosquitto
then run from the terminal mosquitto_pub -t 'test/topic' -m 'helloWorld' -h <IP OF BROKER>
. The board should receive the payload Helloworld
-
Update PIO,
pio upgrade --dev
-
Find the latest PIO GCC ARM toolchain for Mac here, https://dl.bintray.com/platformio/dl-packages/ currently it is, toolchain-gccarmnoneeabi-darwin_x86_64-1.90201.191206.tar.gz, then add it to
platform_packages
-
add a platform_packages reference in plaformio.ini
[esp32]
platform_packages =
toolchain-xtensa32 @ 2.80200.200226
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
- then have the environment definition reference this
[env:planter]
board = esp32doit-devkit-v1
framework = arduino
platform = espressif32
platform_packages =
${esp32.platform_packages}
- https://community.platformio.org/t/how-to-install-a-newer-toolchain-than-the-official-one/8238
- https://community.platformio.org/t/can-not-compile-arm-none-eabi-g-command-not-found/9458/14
This may not work on certain boards.
- Add all files to upload into
data
folder - then run
pio run -t uploadfs
Follow these articles