hello,
an attempt to compile the “blink” example supplied by expressif is failing under pio.
steps to reproduce:
[az@dell5000 blink_pio]$ ~/.platformio/penv/bin/pio init
The current working directory /home/az/Work/Arduino/blink_pio will be used for the project.
The next files/directories have been created in /home/az/Work/Arduino/blink_pio
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File
Project has been successfully initialized! Useful commands:
`pio run` - process/build project from the current directory
`pio run --target upload` or `pio run -t upload` - upload firmware to a target
`pio run --target clean` - clean project (remove compiled files)
`pio run --help` - additional information
[az@dell5000 blink_pio]$
[az@dell5000 blink_pio]$ ls -la ./
total 44
drwxrwxr-x 8 az az 4096 Sep 6 20:58 .
drwxrwxr-x 5 az az 4096 Sep 6 20:58 ..
-rw-rw-r-- 1 az az 94 Sep 6 20:58 .gitignore
drwxrwxr-x 2 az az 4096 Sep 6 20:58 include
drwxrwxr-x 2 az az 4096 Sep 6 20:58 lib
drwxrwxr-x 4 az az 4096 Sep 6 21:00 .pio
-rw-rw-r-- 1 az az 483 Sep 6 20:59 platformio.ini
drwxrwxr-x 2 az az 4096 Sep 6 21:00 src
drwxrwxr-x 2 az az 4096 Sep 6 20:58 test
-rw-rw-r-- 1 az az 1557 Sep 6 20:58 .travis.yml
drwxrwxr-x 2 az az 4096 Sep 6 20:58 .vscode
az@dell5000 blink_pio]$ more ./platformio.ini
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = espidf
monitor_speed = 115200
[az@dell5000 blink_pio]$ more ./src/main.cpp
/* Blink Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
/* Can use project configuration menu (idf.py menuconfig) to choose the GPIO to blink,
or you can edit the following line and set a number here.
*/
#define BLINK_GPIO CONFIG_BLINK_GPIO
extern "C" {
void app_main(void);
}
void app_main(void)
{
/* Configure the IOMUX register for pad BLINK_GPIO (some pads are
muxed to GPIO on reset already, but some default to other
functions and need to be switched to GPIO. Consult the
Technical Reference for a list of pads and their default
functions.)
*/
gpio_pad_select_gpio(BLINK_GPIO);
/* Set the GPIO as a push/pull output */
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while(1) {
/* Blink off (output low) */
printf("Turning off the LED\n");
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
/* Blink on (output high) */
printf("Turning on the LED\n");
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
[az@dell5000 blink_pio]$
[az@dell5000 blink_pio]$ ~/.platformio/penv/bin/pio run
Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: espidf)
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 1.9.0 > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-espidf 3.30202.190627 (3.2.2), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pio/build/esp32doit-devkit-v1/src/main.o
Generating partitions .pio/build/esp32doit-devkit-v1/partitions.bin
Generating LD script .pio/build/esp32doit-devkit-v1/esp32_out.ld
Compiling .pio/build/esp32doit-devkit-v1/bootloader/bootloader_start.o
src/main.cpp: In function 'void app_main()':
src/main.cpp:18:20: error: 'CONFIG_BLINK_GPIO' was not declared in this scope
#define BLINK_GPIO CONFIG_BLINK_GPIO
^
src/main.cpp:33:26: note: in expansion of macro 'BLINK_GPIO'
gpio_pad_select_gpio(BLINK_GPIO);
^
*** [.pio/build/esp32doit-devkit-v1/src/main.o] Error 1
================================================================= [FAILED] Took 2.29 seconds =================================================================
[az@dell5000 blink_pio]$
at the same time compilation with the idf toolset works fine:
[az@dell5000 blink]$ idf.py build
Checking Python dependencies…
Python requirements from /home/az/esp-idf/requirements.txt are satisfied.
Executing action: all (aliases: build)
Running ninja in directory /home/az/Work/Arduino/blink/build
…
enerated /home/az/Work/Arduino/blink/build/blink.bin
Project build complete. To flash, run this command:
…/…/…/esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 --after hard_reset write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/blink.bin
or run ‘idf.py -p (PORT) flash’
[/code]