From c0bdf2023108da5cae3e68ce96f607104a5e7af1 Mon Sep 17 00:00:00 2001 From: Srikanth Anantharam Date: Fri, 9 Feb 2018 16:37:18 +0530 Subject: [PATCH 01/38] Define LED_BUILTIN if not already defined in pins_arduino.h. (#67) --- examples/arduino-blink/src/Blink.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/arduino-blink/src/Blink.cpp b/examples/arduino-blink/src/Blink.cpp index f4059a0..b24679e 100644 --- a/examples/arduino-blink/src/Blink.cpp +++ b/examples/arduino-blink/src/Blink.cpp @@ -6,7 +6,10 @@ #include -#define LED_BUILTIN 13 +#ifndef LED_BUILTIN + // Set LED_BUILTIN if it is not defined by Arduino framework + #define LED_BUILTIN 13 +#endif void setup() { From 51e1d40eb4ed96ed76956e2a933ee1d8364e4228 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 13:18:22 +0200 Subject: [PATCH 02/38] Format board manifests --- boards/esp-wrover-kit.json | 4 ++-- boards/esp32-evb.json | 2 +- boards/esp32-gateway.json | 2 +- boards/esp320.json | 2 +- boards/esp32dev.json | 2 +- boards/esp32doit-devkit-v1.json | 2 +- boards/esp32thing.json | 2 +- boards/esp32vn-iot-uno.json | 2 +- boards/espea32.json | 2 +- boards/espectro32.json | 2 +- boards/espino32.json | 2 +- boards/featheresp32.json | 2 +- boards/firebeetle32.json | 2 +- boards/heltec_wifi_kit_32.json | 2 +- boards/heltec_wifi_lora_32.json | 2 +- boards/hornbill32dev.json | 2 +- boards/hornbill32minima.json | 2 +- boards/intorobot.json | 2 +- boards/lolin32.json | 2 +- boards/m5stack-core-esp32.json | 2 +- boards/mhetesp32devkit.json | 2 +- boards/mhetesp32minikit.json | 2 +- boards/microduino-core-esp32.json | 2 +- boards/nano32.json | 2 +- boards/nina_w10.json | 4 ++-- boards/node32s.json | 2 +- boards/nodemcu-32s.json | 2 +- boards/onehorse32dev.json | 2 +- boards/pocket_32.json | 2 +- boards/quantum.json | 2 +- boards/wemosbat.json | 2 +- boards/widora-air.json | 2 +- 32 files changed, 34 insertions(+), 34 deletions(-) diff --git a/boards/esp-wrover-kit.json b/boards/esp-wrover-kit.json index 5e68c57..6f7d9ea 100644 --- a/boards/esp-wrover-kit.json +++ b/boards/esp-wrover-kit.json @@ -3,14 +3,14 @@ "core": "esp32", "extra_flags": "-DARDUINO_ESP32_DEV", "f_cpu": "240000000L", + "f_flash": "40000000L", + "flash_mode": "dio", "hwids": [ [ "0x0403", "0x6010" ] ], - "f_flash": "40000000L", - "flash_mode": "dio", "ldscript": "esp32_out.ld", "mcu": "esp32", "variant": "esp32" diff --git a/boards/esp32-evb.json b/boards/esp32-evb.json index 912047e..6f00ce2 100644 --- a/boards/esp32-evb.json +++ b/boards/esp32-evb.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/esp32-gateway.json b/boards/esp32-gateway.json index 6740baa..05da6c5 100644 --- a/boards/esp32-gateway.json +++ b/boards/esp32-gateway.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/esp320.json b/boards/esp320.json index af9cf27..b33488d 100644 --- a/boards/esp320.json +++ b/boards/esp320.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/esp32dev.json b/boards/esp32dev.json index 01c07b8..032743e 100644 --- a/boards/esp32dev.json +++ b/boards/esp32dev.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/esp32doit-devkit-v1.json b/boards/esp32doit-devkit-v1.json index be93b86..2e69666 100644 --- a/boards/esp32doit-devkit-v1.json +++ b/boards/esp32doit-devkit-v1.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/esp32thing.json b/boards/esp32thing.json index f6f72c0..76e89f6 100644 --- a/boards/esp32thing.json +++ b/boards/esp32thing.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/esp32vn-iot-uno.json b/boards/esp32vn-iot-uno.json index 90cecf6..25815ec 100644 --- a/boards/esp32vn-iot-uno.json +++ b/boards/esp32vn-iot-uno.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/espea32.json b/boards/espea32.json index caebc4d..44ff2f5 100644 --- a/boards/espea32.json +++ b/boards/espea32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/espectro32.json b/boards/espectro32.json index a1d539f..03e8aba 100644 --- a/boards/espectro32.json +++ b/boards/espectro32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/espino32.json b/boards/espino32.json index d1feabc..ad36d32 100644 --- a/boards/espino32.json +++ b/boards/espino32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/featheresp32.json b/boards/featheresp32.json index bfaf64c..e3e283e 100644 --- a/boards/featheresp32.json +++ b/boards/featheresp32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/firebeetle32.json b/boards/firebeetle32.json index 46fe60c..118617e 100644 --- a/boards/firebeetle32.json +++ b/boards/firebeetle32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/heltec_wifi_kit_32.json b/boards/heltec_wifi_kit_32.json index e9d14e9..abd61d4 100644 --- a/boards/heltec_wifi_kit_32.json +++ b/boards/heltec_wifi_kit_32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/heltec_wifi_lora_32.json b/boards/heltec_wifi_lora_32.json index 8853d39..89c961f 100644 --- a/boards/heltec_wifi_lora_32.json +++ b/boards/heltec_wifi_lora_32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/hornbill32dev.json b/boards/hornbill32dev.json index e4294d0..135c97e 100644 --- a/boards/hornbill32dev.json +++ b/boards/hornbill32dev.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/hornbill32minima.json b/boards/hornbill32minima.json index b8c4ae7..e1bb9cf 100644 --- a/boards/hornbill32minima.json +++ b/boards/hornbill32minima.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/intorobot.json b/boards/intorobot.json index bd0bebb..fd5f2d2 100644 --- a/boards/intorobot.json +++ b/boards/intorobot.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/lolin32.json b/boards/lolin32.json index 0bfa49d..33f3769 100644 --- a/boards/lolin32.json +++ b/boards/lolin32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/m5stack-core-esp32.json b/boards/m5stack-core-esp32.json index 72d5112..6177d68 100644 --- a/boards/m5stack-core-esp32.json +++ b/boards/m5stack-core-esp32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/mhetesp32devkit.json b/boards/mhetesp32devkit.json index 659a00a..5b7aa19 100644 --- a/boards/mhetesp32devkit.json +++ b/boards/mhetesp32devkit.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/mhetesp32minikit.json b/boards/mhetesp32minikit.json index d6b114e..7c8e5e2 100644 --- a/boards/mhetesp32minikit.json +++ b/boards/mhetesp32minikit.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/microduino-core-esp32.json b/boards/microduino-core-esp32.json index 010da23..7ceb214 100644 --- a/boards/microduino-core-esp32.json +++ b/boards/microduino-core-esp32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/nano32.json b/boards/nano32.json index 4776a2b..4fd1bce 100644 --- a/boards/nano32.json +++ b/boards/nano32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf", "simba", diff --git a/boards/nina_w10.json b/boards/nina_w10.json index 913228a..9e6294b 100644 --- a/boards/nina_w10.json +++ b/boards/nina_w10.json @@ -5,9 +5,9 @@ "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", - "partitions": "minimal", "ldscript": "esp32_out.ld", "mcu": "esp32", + "partitions": "minimal", "variant": "nina_w10" }, "connectivity": [ @@ -16,7 +16,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/node32s.json b/boards/node32s.json index a83fd80..36c0cf7 100644 --- a/boards/node32s.json +++ b/boards/node32s.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/nodemcu-32s.json b/boards/nodemcu-32s.json index 49bd65c..581b78f 100644 --- a/boards/nodemcu-32s.json +++ b/boards/nodemcu-32s.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/onehorse32dev.json b/boards/onehorse32dev.json index 34b049d..0fe69da 100644 --- a/boards/onehorse32dev.json +++ b/boards/onehorse32dev.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/pocket_32.json b/boards/pocket_32.json index 92db513..716a255 100644 --- a/boards/pocket_32.json +++ b/boards/pocket_32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/quantum.json b/boards/quantum.json index 3640da7..62e87d4 100644 --- a/boards/quantum.json +++ b/boards/quantum.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/wemosbat.json b/boards/wemosbat.json index 0214a7d..e424180 100644 --- a/boards/wemosbat.json +++ b/boards/wemosbat.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], diff --git a/boards/widora-air.json b/boards/widora-air.json index 9285c71..148958c 100644 --- a/boards/widora-air.json +++ b/boards/widora-air.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], From 213be81db53e9341e66fad887ea1316499db220a Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Wed, 21 Mar 2018 23:37:51 +0200 Subject: [PATCH 03/38] Add initial code for debugging feature --- boards/esp-wrover-kit.json | 11 ++++++++- boards/esp32-evb.json | 13 ++++++++-- boards/esp32-gateway.json | 13 ++++++++-- boards/esp320.json | 8 ++++-- boards/esp32dev.json | 13 ++++++++-- boards/esp32doit-devkit-v1.json | 13 ++++++++-- boards/esp32thing.json | 13 ++++++++-- boards/esp32vn-iot-uno.json | 13 ++++++++-- boards/espea32.json | 8 ++++-- boards/espectro32.json | 13 ++++++++-- boards/espino32.json | 13 ++++++++-- boards/featheresp32.json | 13 ++++++++-- boards/firebeetle32.json | 13 ++++++++-- boards/heltec_wifi_kit_32.json | 8 ++++-- boards/heltec_wifi_lora_32.json | 8 ++++-- boards/hornbill32dev.json | 13 ++++++++-- boards/hornbill32minima.json | 13 ++++++++-- boards/intorobot.json | 8 ++++-- boards/lolin32.json | 13 ++++++++-- boards/m5stack-core-esp32.json | 8 ++++-- boards/mhetesp32devkit.json | 13 ++++++++-- boards/mhetesp32minikit.json | 13 ++++++++-- boards/microduino-core-esp32.json | 8 ++++-- boards/nano32.json | 8 ++++-- boards/nina_w10.json | 8 ++++-- boards/node32s.json | 13 ++++++++-- boards/nodemcu-32s.json | 13 ++++++++-- boards/onehorse32dev.json | 8 ++++-- boards/pocket_32.json | 13 ++++++++-- boards/quantum.json | 8 ++++-- boards/wemosbat.json | 13 ++++++++-- boards/widora-air.json | 8 ++++-- platform.json | 5 ++++ platform.py | 41 +++++++++++++++++++++++++++++++ 34 files changed, 337 insertions(+), 63 deletions(-) diff --git a/boards/esp-wrover-kit.json b/boards/esp-wrover-kit.json index 6f7d9ea..1109686 100644 --- a/boards/esp-wrover-kit.json +++ b/boards/esp-wrover-kit.json @@ -21,6 +21,9 @@ "ethernet", "can" ], + "debug": { + "openocd_board": "esp32-wrover.cfg" + }, "frameworks": [ "arduino", "espidf" @@ -32,7 +35,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://espressif.com/en/products/hardware/esp-wrover-kit/overview", "vendor": "Espressif" diff --git a/boards/esp32-evb.json b/boards/esp32-evb.json index 6f00ce2..8c75e18 100644 --- a/boards/esp32-evb.json +++ b/boards/esp32-evb.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://www.olimex.com/Products/IoT/ESP32-EVB/open-source-hardware", "vendor": "OLIMEX" diff --git a/boards/esp32-gateway.json b/boards/esp32-gateway.json index 05da6c5..6a5f038 100644 --- a/boards/esp32-gateway.json +++ b/boards/esp32-gateway.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://www.olimex.com/Products/IoT/ESP32-GATEWAY/open-source-hardware", "vendor": "OLIMEX" diff --git a/boards/esp320.json b/boards/esp320.json index b33488d..84f0dbe 100644 --- a/boards/esp320.json +++ b/boards/esp320.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://www.sweetpeas.se/controller-modules/10-esp210.html", "vendor": "Electronic SweetPeas" diff --git a/boards/esp32dev.json b/boards/esp32dev.json index 032743e..e5efe8e 100644 --- a/boards/esp32dev.json +++ b/boards/esp32dev.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://en.wikipedia.org/wiki/ESP32", "vendor": "Espressif" diff --git a/boards/esp32doit-devkit-v1.json b/boards/esp32doit-devkit-v1.json index 2e69666..d4f8e16 100644 --- a/boards/esp32doit-devkit-v1.json +++ b/boards/esp32doit-devkit-v1.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://www.doit.am/", "vendor": "DOIT" diff --git a/boards/esp32thing.json b/boards/esp32thing.json index 76e89f6..636f7ae 100644 --- a/boards/esp32thing.json +++ b/boards/esp32thing.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://www.sparkfun.com/products/13907", "vendor": "SparkFun Electronics" diff --git a/boards/esp32vn-iot-uno.json b/boards/esp32vn-iot-uno.json index 25815ec..2af96b9 100644 --- a/boards/esp32vn-iot-uno.json +++ b/boards/esp32vn-iot-uno.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://esp32.vn/", "vendor": "ESP32vn" diff --git a/boards/espea32.json b/boards/espea32.json index 44ff2f5..71fe3cf 100644 --- a/boards/espea32.json +++ b/boards/espea32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "https://blog.aprbrother.com/product/espea", "vendor": "April Brother" diff --git a/boards/espectro32.json b/boards/espectro32.json index 03e8aba..2f228b8 100644 --- a/boards/espectro32.json +++ b/boards/espectro32.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 2000000, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://shop.makestro.com/product/espectro32", "vendor": "DycodeX" diff --git a/boards/espino32.json b/boards/espino32.json index ad36d32..2c5668e 100644 --- a/boards/espino32.json +++ b/boards/espino32.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://thaieasyelec.com/products/development-boards/espino-wifi-development-board-detail.html", "vendor": "ThaiEasyElec" diff --git a/boards/featheresp32.json b/boards/featheresp32.json index e3e283e..8478b40 100644 --- a/boards/featheresp32.json +++ b/boards/featheresp32.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://www.adafruit.com/product/3405", "vendor": "Adafruit" diff --git a/boards/firebeetle32.json b/boards/firebeetle32.json index 118617e..fc32da4 100644 --- a/boards/firebeetle32.json +++ b/boards/firebeetle32.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://dfrobotblog.wordpress.com", "vendor": "DFRobot" diff --git a/boards/heltec_wifi_kit_32.json b/boards/heltec_wifi_kit_32.json index abd61d4..4de2cbc 100644 --- a/boards/heltec_wifi_kit_32.json +++ b/boards/heltec_wifi_kit_32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://www.heltec.cn", "vendor": "Heltec Automation" diff --git a/boards/heltec_wifi_lora_32.json b/boards/heltec_wifi_lora_32.json index 89c961f..e744b0c 100644 --- a/boards/heltec_wifi_lora_32.json +++ b/boards/heltec_wifi_lora_32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://www.heltec.cn", "vendor": "Heltec Automation" diff --git a/boards/hornbill32dev.json b/boards/hornbill32dev.json index 135c97e..d6acf1e 100644 --- a/boards/hornbill32dev.json +++ b/boards/hornbill32dev.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://hackaday.io/project/18997-hornbill", "vendor": "Hornbill" diff --git a/boards/hornbill32minima.json b/boards/hornbill32minima.json index e1bb9cf..c6d2f8a 100644 --- a/boards/hornbill32minima.json +++ b/boards/hornbill32minima.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://hackaday.io/project/18997-hornbill", "vendor": "Hornbill" diff --git a/boards/intorobot.json b/boards/intorobot.json index fd5f2d2..8814256 100644 --- a/boards/intorobot.json +++ b/boards/intorobot.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://docs.intorobot.com/zh/hardware/fig/hardware/", "vendor": "IntoRobot" diff --git a/boards/lolin32.json b/boards/lolin32.json index 33f3769..4c415ea 100644 --- a/boards/lolin32.json +++ b/boards/lolin32.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://wemos.cc", "vendor": "WEMOS" diff --git a/boards/m5stack-core-esp32.json b/boards/m5stack-core-esp32.json index 6177d68..84313d8 100644 --- a/boards/m5stack-core-esp32.json +++ b/boards/m5stack-core-esp32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://www.m5stack.com", "vendor": "M5Stack" diff --git a/boards/mhetesp32devkit.json b/boards/mhetesp32devkit.json index 5b7aa19..59cc0df 100644 --- a/boards/mhetesp32devkit.json +++ b/boards/mhetesp32devkit.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://forum.mhetlive.com", "vendor": "MH-ET Live" diff --git a/boards/mhetesp32minikit.json b/boards/mhetesp32minikit.json index 7c8e5e2..ba2e279 100644 --- a/boards/mhetesp32minikit.json +++ b/boards/mhetesp32minikit.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://forum.mhetlive.com", "vendor": "MH-ET Live" diff --git a/boards/microduino-core-esp32.json b/boards/microduino-core-esp32.json index 7ceb214..558a476 100644 --- a/boards/microduino-core-esp32.json +++ b/boards/microduino-core-esp32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 2000000, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "https://microduinoinc.com", "vendor": "Microduino" diff --git a/boards/nano32.json b/boards/nano32.json index 4fd1bce..4632d4d 100644 --- a/boards/nano32.json +++ b/boards/nano32.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf", "simba", @@ -28,7 +28,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://iot-bits.com/nano32-esp32-development-board", "vendor": "MakerAsia" diff --git a/boards/nina_w10.json b/boards/nina_w10.json index 9e6294b..096936e 100644 --- a/boards/nina_w10.json +++ b/boards/nina_w10.json @@ -16,7 +16,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -27,7 +27,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "https://www.u-blox.com/en/product/nina-w10-series", "vendor": "u-blox" diff --git a/boards/node32s.json b/boards/node32s.json index 36c0cf7..884684c 100644 --- a/boards/node32s.json +++ b/boards/node32s.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://www.ayarafun.com", "vendor": "Aiyarafun" diff --git a/boards/nodemcu-32s.json b/boards/nodemcu-32s.json index 581b78f..3031a50 100644 --- a/boards/nodemcu-32s.json +++ b/boards/nodemcu-32s.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://www.nodemcu.com/", "vendor": "NodeMCU" diff --git a/boards/onehorse32dev.json b/boards/onehorse32dev.json index 0fe69da..37fda2f 100644 --- a/boards/onehorse32dev.json +++ b/boards/onehorse32dev.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "https://www.tindie.com/products/onehorse/esp32-development-board/", "vendor": "Onehorse" diff --git a/boards/pocket_32.json b/boards/pocket_32.json index 716a255..db868ec 100644 --- a/boards/pocket_32.json +++ b/boards/pocket_32.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "http://dong-sen.com", "vendor": "Dongsen Technology" diff --git a/boards/quantum.json b/boards/quantum.json index 62e87d4..f33cd12 100644 --- a/boards/quantum.json +++ b/boards/quantum.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://wiki.jackslab.org/Noduino", "vendor": "Noduino" diff --git a/boards/wemosbat.json b/boards/wemosbat.json index e424180..c0f1dfa 100644 --- a/boards/wemosbat.json +++ b/boards/wemosbat.json @@ -15,7 +15,10 @@ "ethernet", "can" ], - "frameworks": [ + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +29,13 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool", + "olimex-arm-usb-tiny-h", + "olimex-arm-usb-ocd-h" + ] }, "url": "https://www.wemos.cc", "vendor": "WEMOS" diff --git a/boards/widora-air.json b/boards/widora-air.json index 148958c..0b4b31a 100644 --- a/boards/widora-air.json +++ b/boards/widora-air.json @@ -15,7 +15,7 @@ "ethernet", "can" ], - "frameworks": [ + "frameworks": [ "arduino", "espidf" ], @@ -26,7 +26,11 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true + "wait_for_upload_port": true, + "protocol": "esptool", + "protocols": [ + "esptool" + ] }, "url": "http://widora.io", "vendor": "Widora" diff --git a/platform.json b/platform.json index a243423..e8317d9 100644 --- a/platform.json +++ b/platform.json @@ -70,6 +70,11 @@ "type": "uploader", "optional": true, "version": "~1.1.0" + }, + "tool-openocd-esp32": { + "type": "uploader", + "optional": true, + "version": "~0.1.0" } } } diff --git a/platform.py b/platform.py index 25c631a..240f892 100644 --- a/platform.py +++ b/platform.py @@ -22,3 +22,44 @@ class Espressif32Platform(PlatformBase): self.packages['toolchain-xtensa32']['version'] = "~2.50200.0" return PlatformBase.configure_default_packages( self, variables, targets) + + def get_boards(self, id_=None): + result = PlatformBase.get_boards(self, id_) + if not result: + return result + if id_: + return self._add_default_debug_tools(result) + else: + for key, value in result.items(): + result[key] = self._add_default_debug_tools(result[key]) + return result + + def _add_default_debug_tools(self, board): + debug = board.manifest.get("debug", {}) + + upload_protocols = board.manifest.get("upload", {}).get( + "protocols", []) + if "tools" not in debug: + debug['tools'] = {} + + # Only FTDI based debug probes + for link in ("olimex-arm-usb-tiny-h", "olimex-arm-usb-ocd-h"): + if link not in upload_protocols or link in debug['tools']: + continue + + server_args = [ + "-s", "$PACKAGE_DIR/share/openocd/scripts", + "-f", "share/openocd/scripts/interface/ftdi/%s.cfg" % link, + "-f", "share/openocd/scripts/board/%s" % debug.get("openocd_board") + ] + + debug['tools'][link] = { + "server": { + "package": "tool-openocd-esp32", + "executable": "bin/openocd", + "arguments": server_args + } + } + + board.manifest['debug'] = debug + return board From d6289f0b47363a4c77e77c3c91a7df68b8f83138 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Thu, 22 Mar 2018 00:12:15 +0200 Subject: [PATCH 04/38] Add default debug configuration --- platform.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform.py b/platform.py index 240f892..df8b605 100644 --- a/platform.py +++ b/platform.py @@ -58,7 +58,17 @@ class Espressif32Platform(PlatformBase): "package": "tool-openocd-esp32", "executable": "bin/openocd", "arguments": server_args - } + }, + "init_cmds": [ + "target extended-remote $DEBUG_PORT", + 'file "$PROG_PATH"', + "$LOAD_CMD", + "mon reset halt", + "$INIT_BREAK", + "x $a1=0" + ], + "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000', + "init_break": "thb app_main" } board.manifest['debug'] = debug From c4254d0996411b68693c1a167696570372cf5e66 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 13 Apr 2018 13:47:46 -0700 Subject: [PATCH 05/38] Change type to "debugger" for openOCD --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index e8317d9..8677d5b 100644 --- a/platform.json +++ b/platform.json @@ -72,7 +72,7 @@ "version": "~1.1.0" }, "tool-openocd-esp32": { - "type": "uploader", + "type": "debugger", "optional": true, "version": "~0.1.0" } From 49b0c1a99d44a7b0b99a6c618b6d6d75811e8d04 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 19 Apr 2018 16:29:09 +0300 Subject: [PATCH 06/38] Update openOCD --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index 8677d5b..4bec670 100644 --- a/platform.json +++ b/platform.json @@ -74,7 +74,7 @@ "tool-openocd-esp32": { "type": "debugger", "optional": true, - "version": "~0.1.0" + "version": "~1.1000.0" } } } From f92711de776cd38df0310b39a057e72ce1d358f2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 2 May 2018 17:04:36 +0300 Subject: [PATCH 07/38] Compatibility with a new PIO Unified Debugger for VSCode --- platform.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/platform.py b/platform.py index df8b605..a167f9f 100644 --- a/platform.py +++ b/platform.py @@ -59,16 +59,23 @@ class Espressif32Platform(PlatformBase): "executable": "bin/openocd", "arguments": server_args }, + "init_break": "thb app_main", "init_cmds": [ + "define pio_reset_halt_target", + " mon reset halt", + " x $a1=0", + "end", + "define pio_reset_target", + " mon reset", + "end", "target extended-remote $DEBUG_PORT", - 'file "$PROG_PATH"', - "$LOAD_CMD", - "mon reset halt", "$INIT_BREAK", - "x $a1=0" + "mon reset halt", + "$LOAD_CMD", + "pio_reset_halt_target", + "continue" ], - "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000', - "init_break": "thb app_main" + "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' } board.manifest['debug'] = debug From 218faa1b7363e3e9c26ff0d259a2d6733810d468 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Sat, 5 May 2018 20:34:19 +0300 Subject: [PATCH 08/38] Update build script for ESP-IDF v3.0 --- builder/frameworks/espidf.py | 37 +++- examples/espidf-ble-adv/src/main.c | 23 ++- examples/espidf-ble-adv/src/sdkconfig.h | 138 +++++++++++-- examples/espidf-coap-server/src/main.c | 10 +- examples/espidf-coap-server/src/sdkconfig.h | 138 +++++++++++-- examples/espidf-hello-world/src/main.c | 27 ++- examples/espidf-hello-world/src/sdkconfig.h | 138 +++++++++++-- examples/espidf-http-request/src/main.c | 26 ++- examples/espidf-http-request/src/sdkconfig.h | 138 +++++++++++-- examples/espidf-peripherals-uart/src/main.c | 185 +++--------------- .../espidf-peripherals-uart/src/sdkconfig.h | 138 +++++++++++-- examples/espidf-storage-sdcard/src/main.c | 63 +++++- .../espidf-storage-sdcard/src/sdkconfig.h | 138 +++++++++++-- 13 files changed, 885 insertions(+), 314 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 1c806a8..53d5793 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -88,9 +88,9 @@ def build_component(path): src_dirs = params.get("COMPONENT_SRCDIRS") if "." in src_dirs: src_dirs.remove(".") - src_filter += " +<*.c*>" + src_filter += " +<*.[sSc]*>" for f in src_dirs: - src_filter += " +<%s/*.c*>" % f + src_filter += " +<%s/*.[sSc]*>" % f return envsafe.BuildLibrary( join("$BUILD_DIR", "%s" % basename(path)), path, @@ -105,7 +105,7 @@ def build_espidf_bootloader(): LIBPATH=[ join(FRAMEWORK_DIR, "components", "esp32", "ld"), join(FRAMEWORK_DIR, "components", "esp32", "lib"), - join(FRAMEWORK_DIR, "components", "bootloader", "src", "main") + join(FRAMEWORK_DIR, "components", "bootloader", "subproject", "main") ], LINKFLAGS=[ @@ -115,8 +115,9 @@ def build_espidf_bootloader(): "-Wl,--gc-sections", "-T", "esp32.bootloader.ld", "-T", "esp32.rom.ld", + "-T", "esp32.rom.spiram_incompatible_fns.ld", "-T", "esp32.peripherals.ld", - "-T", "esp32.bootloader.rom.ld" + "-T", "esp32.bootloader.rom.ld", ] ), @@ -160,7 +161,7 @@ def build_espidf_bootloader(): join("$BUILD_DIR", "bootloader.elf"), envsafe.CollectBuildFiles( join("$BUILD_DIR", "bootloader"), - join(FRAMEWORK_DIR, "components", "bootloader", "src", "main") + join(FRAMEWORK_DIR, "components", "bootloader", "subproject", "main") ) ) @@ -183,9 +184,11 @@ env.Prepend( join(FRAMEWORK_DIR, "components", "coap", "libcoap", "include"), join(FRAMEWORK_DIR, "components", "coap", "libcoap", "include", "coap"), + join(FRAMEWORK_DIR, "components", "console"), join(FRAMEWORK_DIR, "components", "cxx", "include"), join(FRAMEWORK_DIR, "components", "driver", "include"), join(FRAMEWORK_DIR, "components", "driver", "include", "driver"), + join(FRAMEWORK_DIR, "components", "esp_adc_cal", "include"), join(FRAMEWORK_DIR, "components", "esp32", "include"), join(FRAMEWORK_DIR, "components", "ethernet", "include"), join(FRAMEWORK_DIR, "components", "expat", "include", "expat"), @@ -219,6 +222,7 @@ env.Prepend( join(FRAMEWORK_DIR, "components", "openssl", "include", "openssl"), join(FRAMEWORK_DIR, "components", "sdmmc", "include"), join(FRAMEWORK_DIR, "components", "spi_flash", "include"), + join(FRAMEWORK_DIR, "components", "spiffs", "include"), join(FRAMEWORK_DIR, "components", "tcpip_adapter", "include"), join(FRAMEWORK_DIR, "components", "soc", "esp32", "include"), join(FRAMEWORK_DIR, "components", "soc", "include"), @@ -241,7 +245,7 @@ env.Prepend( LIBS=[ "btdm_app", "hal", "coexist", "core", "net80211", "phy", "rtc", "pp", - "wpa", "wpa2", "wps", "smartconfig", "m", "c", "gcc", "stdc++" + "wpa", "wpa2", "espnow", "wps", "smartconfig", "m", "c", "gcc", "stdc++" ] ) @@ -277,9 +281,12 @@ env.Prepend( env.Append( LINKFLAGS=[ "-u", "__cxa_guard_dummy", + "-u", "ld_include_panic_highint_hdl", + "-u", "__cxx_fatal_exception", "-T", "esp32.common.ld", "-T", "esp32.rom.ld", - "-T", "esp32.peripherals.ld" + "-T", "esp32.peripherals.ld", + "-T", "esp32.rom.spiram_incompatible_fns.ld" ], UPLOADERFLAGS=[ @@ -353,8 +360,11 @@ env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", env.ElfToBin( libs = [] ignore_dirs = ( + "app_trace", + "aws_iot", + "espcoredump", "bootloader", - "bootloader_support", + "heap", "esptool_py", "idf_test", "partition_table", @@ -382,7 +392,7 @@ libs.append(env.BuildLibrary( libs.append(env.BuildLibrary( join("$BUILD_DIR", "app_trace"), join(FRAMEWORK_DIR, "components", "app_trace"), - src_filter="+<*> - -" + src_filter="+<*> - - -" )) libs.append(env.BuildLibrary( @@ -391,14 +401,21 @@ libs.append(env.BuildLibrary( src_filter="+<*> - -" )) +libs.append(env.BuildLibrary( + join("$BUILD_DIR", "heap"), + join(FRAMEWORK_DIR, "components", "heap"), + src_filter="+<*> - -" +)) + envsafe = env.Clone() envsafe.Prepend( CPPDEFINES=[ "CONFIGURED", "NATIVE_LITTLE_ENDIAN", "HAVE_WEAK_SYMBOLS", - "__STDC_LIMIT_MACROS", "__STDC_CONSTANT_MACROS" + "__STDC_LIMIT_MACROS", "__STDC_CONSTANT_MACROS", "-DRANDOMBYTES_DEFAULT_IMPLEMENTATION" ], CCFLAGS=["-Wno-type-limits", "-Wno-unknown-pragmas"], CPPPATH=[ + join(FRAMEWORK_DIR, "components", "libsodium", "port"), join(FRAMEWORK_DIR, "components", "libsodium", "port_include", "sodium") ] diff --git a/examples/espidf-ble-adv/src/main.c b/examples/espidf-ble-adv/src/main.c index 6d0ef24..7469784 100644 --- a/examples/espidf-ble-adv/src/main.c +++ b/examples/espidf-ble-adv/src/main.c @@ -16,7 +16,7 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "bt.h" +#include "esp_bt.h" #include "esp_log.h" #include "nvs_flash.h" @@ -227,16 +227,35 @@ void app_main() ESP_ERROR_CHECK( ret ); esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); + ret = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT); + if (ret) { + ESP_LOGI(tag, "Bluetooth controller release classic bt memory failed"); + return; + } + if (esp_bt_controller_init(&bt_cfg) != ESP_OK) { ESP_LOGI(tag, "Bluetooth controller initialize failed"); return; } - if (esp_bt_controller_enable(ESP_BT_MODE_BTDM) != ESP_OK) { + if (esp_bt_controller_enable(ESP_BT_MODE_BLE) != ESP_OK) { ESP_LOGI(tag, "Bluetooth controller enable failed"); return; } + /* + * If call mem release here, also work. Input ESP_BT_MODE_CLASSIC_BT, the function will + * release the memory of classic bt mode. + * esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT); + * + */ + + /* + * If call mem release here, also work. Input ESP_BT_MODE_BTDM, the function will calculate + * that the BLE mode is already used, so it will release of only classic bt mode. + * esp_bt_controller_mem_release(ESP_BT_MODE_BTDM); + */ + xTaskCreatePinnedToCore(&bleAdvtTask, "bleAdvtTask", 2048, NULL, 5, NULL, 0); } diff --git a/examples/espidf-ble-adv/src/sdkconfig.h b/examples/espidf-ble-adv/src/sdkconfig.h index 64ef778..67391da 100644 --- a/examples/espidf-ble-adv/src/sdkconfig.h +++ b/examples/espidf-ble-adv/src/sdkconfig.h @@ -6,120 +6,218 @@ */ #define CONFIG_GATTC_ENABLE 1 #define CONFIG_ESP32_PHY_MAX_TX_POWER 20 -#define CONFIG_PHY_ENABLED 1 #define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" -#define CONFIG_NEWLIB_STDOUT_ADDCR 1 -#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 #define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 -#define CONFIG_ETHERNET 1 +#define CONFIG_SPIFFS_CACHE 1 #define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 -#define CONFIG_AWS_IOT_MQTT_PORT 8883 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 #define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 #define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 #define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 #define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 #define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 #define CONFIG_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_EMAC_TASK_PRIORITY 20 #define CONFIG_TIMER_TASK_STACK_DEPTH 2048 -#define CONFIG_FATFS_CODEPAGE 1 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 #define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_ESPTOOLPY_BAUD 115200 #define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 -#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 #define CONFIG_ESPTOOLPY_BAUD_115200B 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 +#define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 -#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0 -#define CONFIG_TCPIP_TASK_STACK_SIZE 2560 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 4096 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 3072 #define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 #define CONFIG_ESPTOOLPY_BEFORE "default_reset" #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 #define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 #define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 -#define CONFIG_AWS_IOT_SDK 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 #define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 #define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 #define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 #define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 #define CONFIG_ESPTOOLPY_COMPRESSED 1 #define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_WIFI_ENABLED 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 -#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 4096 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 #define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 -#define CONFIG_FATFS_CODEPAGE_ASCII 1 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 #define CONFIG_FREERTOS_HZ 100 #define CONFIG_LOG_COLORS 1 #define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 #define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 #define CONFIG_MONITOR_BAUD_115200B 1 #define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 #define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 -#define CONFIG_ESP32_XTAL_FREQ_AUTO 1 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 #define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_ESP32_DEBUG_OCDAWARE 1 #define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 #define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_FREERTOS_CORETIMER_0 1 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 #define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 #define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 #define CONFIG_FREERTOS_ISR_STACKSIZE 1536 #define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 -#define CONFIG_AWS_IOT_MQTT_HOST "" +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 #define CONFIG_BT_ACL_CONNECTIONS 4 -#define CONFIG_FATFS_MAX_LFN 255 #define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 #define CONFIG_APP_OFFSET 0x10000 #define CONFIG_MEMMAP_SMP 1 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 #define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 #define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" -#define CONFIG_OPTIMIZATION_LEVEL_RELEASE 1 +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 diff --git a/examples/espidf-coap-server/src/main.c b/examples/espidf-coap-server/src/main.c index 998f06d..b3ea703 100644 --- a/examples/espidf-coap-server/src/main.c +++ b/examples/espidf-coap-server/src/main.c @@ -80,7 +80,7 @@ async_handler(coap_context_t *ctx, struct coap_resource_t *resource, async = coap_register_async(ctx, peer, request, COAP_ASYNC_SEPARATE | COAP_ASYNC_CONFIRM, (void*)"no data"); } -static void coap_demo_thread(void *p) +static void coap_example_thread(void *p) { coap_context_t* ctx = NULL; coap_address_t serv_addr; @@ -120,7 +120,7 @@ static void coap_demo_thread(void *p) FD_CLR( ctx->sockfd, &readfds); FD_SET( ctx->sockfd, &readfds); - int result = select( FD_SETSIZE, &readfds, 0, 0, &tv ); + int result = select( ctx->sockfd+1, &readfds, 0, 0, &tv ); if (result > 0){ if (FD_ISSET( ctx->sockfd, &readfds )) coap_read(ctx); @@ -185,8 +185,8 @@ static void wifi_conn_init(void) void app_main(void) { - nvs_flash_init(); + ESP_ERROR_CHECK( nvs_flash_init() ); wifi_conn_init(); - xTaskCreate(coap_demo_thread, "coap", 2048, NULL, 5, NULL); -} \ No newline at end of file + xTaskCreate(coap_example_thread, "coap", 2048, NULL, 5, NULL); +} diff --git a/examples/espidf-coap-server/src/sdkconfig.h b/examples/espidf-coap-server/src/sdkconfig.h index 64ef778..67391da 100644 --- a/examples/espidf-coap-server/src/sdkconfig.h +++ b/examples/espidf-coap-server/src/sdkconfig.h @@ -6,120 +6,218 @@ */ #define CONFIG_GATTC_ENABLE 1 #define CONFIG_ESP32_PHY_MAX_TX_POWER 20 -#define CONFIG_PHY_ENABLED 1 #define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" -#define CONFIG_NEWLIB_STDOUT_ADDCR 1 -#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 #define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 -#define CONFIG_ETHERNET 1 +#define CONFIG_SPIFFS_CACHE 1 #define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 -#define CONFIG_AWS_IOT_MQTT_PORT 8883 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 #define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 #define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 #define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 #define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 #define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 #define CONFIG_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_EMAC_TASK_PRIORITY 20 #define CONFIG_TIMER_TASK_STACK_DEPTH 2048 -#define CONFIG_FATFS_CODEPAGE 1 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 #define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_ESPTOOLPY_BAUD 115200 #define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 -#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 #define CONFIG_ESPTOOLPY_BAUD_115200B 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 +#define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 -#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0 -#define CONFIG_TCPIP_TASK_STACK_SIZE 2560 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 4096 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 3072 #define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 #define CONFIG_ESPTOOLPY_BEFORE "default_reset" #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 #define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 #define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 -#define CONFIG_AWS_IOT_SDK 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 #define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 #define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 #define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 #define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 #define CONFIG_ESPTOOLPY_COMPRESSED 1 #define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_WIFI_ENABLED 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 -#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 4096 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 #define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 -#define CONFIG_FATFS_CODEPAGE_ASCII 1 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 #define CONFIG_FREERTOS_HZ 100 #define CONFIG_LOG_COLORS 1 #define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 #define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 #define CONFIG_MONITOR_BAUD_115200B 1 #define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 #define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 -#define CONFIG_ESP32_XTAL_FREQ_AUTO 1 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 #define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_ESP32_DEBUG_OCDAWARE 1 #define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 #define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_FREERTOS_CORETIMER_0 1 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 #define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 #define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 #define CONFIG_FREERTOS_ISR_STACKSIZE 1536 #define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 -#define CONFIG_AWS_IOT_MQTT_HOST "" +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 #define CONFIG_BT_ACL_CONNECTIONS 4 -#define CONFIG_FATFS_MAX_LFN 255 #define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 #define CONFIG_APP_OFFSET 0x10000 #define CONFIG_MEMMAP_SMP 1 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 #define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 #define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" -#define CONFIG_OPTIMIZATION_LEVEL_RELEASE 1 +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 diff --git a/examples/espidf-hello-world/src/main.c b/examples/espidf-hello-world/src/main.c index 0e87252..c17eb1b 100644 --- a/examples/espidf-hello-world/src/main.c +++ b/examples/espidf-hello-world/src/main.c @@ -10,22 +10,31 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" -#include "nvs_flash.h" +#include "esp_spi_flash.h" -void hello_task(void *pvParameter) + +void app_main() { printf("Hello world!\n"); + + /* Print chip information */ + esp_chip_info_t chip_info; + esp_chip_info(&chip_info); + printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ", + chip_info.cores, + (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", + (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); + + printf("silicon revision %d, ", chip_info.revision); + + printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024), + (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); + for (int i = 10; i >= 0; i--) { printf("Restarting in %d seconds...\n", i); - vTaskDelay(1000 / portTICK_RATE_MS); + vTaskDelay(1000 / portTICK_PERIOD_MS); } printf("Restarting now.\n"); fflush(stdout); esp_restart(); } - -void app_main() -{ - nvs_flash_init(); - xTaskCreate(&hello_task, "hello_task", 2048, NULL, 5, NULL); -} diff --git a/examples/espidf-hello-world/src/sdkconfig.h b/examples/espidf-hello-world/src/sdkconfig.h index 64ef778..67391da 100644 --- a/examples/espidf-hello-world/src/sdkconfig.h +++ b/examples/espidf-hello-world/src/sdkconfig.h @@ -6,120 +6,218 @@ */ #define CONFIG_GATTC_ENABLE 1 #define CONFIG_ESP32_PHY_MAX_TX_POWER 20 -#define CONFIG_PHY_ENABLED 1 #define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" -#define CONFIG_NEWLIB_STDOUT_ADDCR 1 -#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 #define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 -#define CONFIG_ETHERNET 1 +#define CONFIG_SPIFFS_CACHE 1 #define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 -#define CONFIG_AWS_IOT_MQTT_PORT 8883 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 #define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 #define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 #define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 #define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 #define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 #define CONFIG_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_EMAC_TASK_PRIORITY 20 #define CONFIG_TIMER_TASK_STACK_DEPTH 2048 -#define CONFIG_FATFS_CODEPAGE 1 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 #define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_ESPTOOLPY_BAUD 115200 #define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 -#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 #define CONFIG_ESPTOOLPY_BAUD_115200B 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 +#define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 -#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0 -#define CONFIG_TCPIP_TASK_STACK_SIZE 2560 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 4096 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 3072 #define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 #define CONFIG_ESPTOOLPY_BEFORE "default_reset" #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 #define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 #define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 -#define CONFIG_AWS_IOT_SDK 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 #define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 #define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 #define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 #define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 #define CONFIG_ESPTOOLPY_COMPRESSED 1 #define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_WIFI_ENABLED 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 -#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 4096 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 #define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 -#define CONFIG_FATFS_CODEPAGE_ASCII 1 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 #define CONFIG_FREERTOS_HZ 100 #define CONFIG_LOG_COLORS 1 #define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 #define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 #define CONFIG_MONITOR_BAUD_115200B 1 #define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 #define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 -#define CONFIG_ESP32_XTAL_FREQ_AUTO 1 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 #define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_ESP32_DEBUG_OCDAWARE 1 #define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 #define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_FREERTOS_CORETIMER_0 1 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 #define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 #define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 #define CONFIG_FREERTOS_ISR_STACKSIZE 1536 #define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 -#define CONFIG_AWS_IOT_MQTT_HOST "" +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 #define CONFIG_BT_ACL_CONNECTIONS 4 -#define CONFIG_FATFS_MAX_LFN 255 #define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 #define CONFIG_APP_OFFSET 0x10000 #define CONFIG_MEMMAP_SMP 1 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 #define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 #define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" -#define CONFIG_OPTIMIZATION_LEVEL_RELEASE 1 +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 diff --git a/examples/espidf-http-request/src/main.c b/examples/espidf-http-request/src/main.c index 3831ae6..c51205e 100644 --- a/examples/espidf-http-request/src/main.c +++ b/examples/espidf-http-request/src/main.c @@ -46,10 +46,10 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "example"; -static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" - "Host: "WEB_SERVER"\n" - "User-Agent: esp-idf/1.0 esp32\n" - "\n"; +static const char *REQUEST = "GET " WEB_URL " HTTP/1.0\r\n" + "Host: "WEB_SERVER"\r\n" + "User-Agent: esp-idf/1.0 esp32\r\n" + "\r\n"; static esp_err_t event_handler(void *ctx, system_event_t *event) { @@ -132,7 +132,7 @@ static void http_get_task(void *pvParameters) vTaskDelay(1000 / portTICK_PERIOD_MS); continue; } - ESP_LOGI(TAG, "... allocated socket\r\n"); + ESP_LOGI(TAG, "... allocated socket"); if(connect(s, res->ai_addr, res->ai_addrlen) != 0) { ESP_LOGE(TAG, "... socket connect failed errno=%d", errno); @@ -153,6 +153,18 @@ static void http_get_task(void *pvParameters) } ESP_LOGI(TAG, "... socket send success"); + struct timeval receiving_timeout; + receiving_timeout.tv_sec = 5; + receiving_timeout.tv_usec = 0; + if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &receiving_timeout, + sizeof(receiving_timeout)) < 0) { + ESP_LOGE(TAG, "... failed to set socket receiving timeout"); + close(s); + vTaskDelay(4000 / portTICK_PERIOD_MS); + continue; + } + ESP_LOGI(TAG, "... set socket receiving timeout success"); + /* Read HTTP response */ do { bzero(recv_buf, sizeof(recv_buf)); @@ -174,7 +186,7 @@ static void http_get_task(void *pvParameters) void app_main() { - nvs_flash_init(); + ESP_ERROR_CHECK( nvs_flash_init() ); initialise_wifi(); - xTaskCreate(&http_get_task, "http_get_task", 2048, NULL, 5, NULL); + xTaskCreate(&http_get_task, "http_get_task", 4096, NULL, 5, NULL); } diff --git a/examples/espidf-http-request/src/sdkconfig.h b/examples/espidf-http-request/src/sdkconfig.h index 64ef778..67391da 100644 --- a/examples/espidf-http-request/src/sdkconfig.h +++ b/examples/espidf-http-request/src/sdkconfig.h @@ -6,120 +6,218 @@ */ #define CONFIG_GATTC_ENABLE 1 #define CONFIG_ESP32_PHY_MAX_TX_POWER 20 -#define CONFIG_PHY_ENABLED 1 #define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" -#define CONFIG_NEWLIB_STDOUT_ADDCR 1 -#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 #define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 -#define CONFIG_ETHERNET 1 +#define CONFIG_SPIFFS_CACHE 1 #define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 -#define CONFIG_AWS_IOT_MQTT_PORT 8883 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 #define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 #define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 #define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 #define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 #define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 #define CONFIG_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_EMAC_TASK_PRIORITY 20 #define CONFIG_TIMER_TASK_STACK_DEPTH 2048 -#define CONFIG_FATFS_CODEPAGE 1 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 #define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_ESPTOOLPY_BAUD 115200 #define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 -#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 #define CONFIG_ESPTOOLPY_BAUD_115200B 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 +#define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 -#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0 -#define CONFIG_TCPIP_TASK_STACK_SIZE 2560 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 4096 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 3072 #define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 #define CONFIG_ESPTOOLPY_BEFORE "default_reset" #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 #define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 #define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 -#define CONFIG_AWS_IOT_SDK 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 #define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 #define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 #define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 #define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 #define CONFIG_ESPTOOLPY_COMPRESSED 1 #define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_WIFI_ENABLED 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 -#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 4096 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 #define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 -#define CONFIG_FATFS_CODEPAGE_ASCII 1 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 #define CONFIG_FREERTOS_HZ 100 #define CONFIG_LOG_COLORS 1 #define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 #define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 #define CONFIG_MONITOR_BAUD_115200B 1 #define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 #define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 -#define CONFIG_ESP32_XTAL_FREQ_AUTO 1 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 #define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_ESP32_DEBUG_OCDAWARE 1 #define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 #define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_FREERTOS_CORETIMER_0 1 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 #define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 #define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 #define CONFIG_FREERTOS_ISR_STACKSIZE 1536 #define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 -#define CONFIG_AWS_IOT_MQTT_HOST "" +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 #define CONFIG_BT_ACL_CONNECTIONS 4 -#define CONFIG_FATFS_MAX_LFN 255 #define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 #define CONFIG_APP_OFFSET 0x10000 #define CONFIG_MEMMAP_SMP 1 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 #define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 #define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" -#define CONFIG_OPTIMIZATION_LEVEL_RELEASE 1 +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 diff --git a/examples/espidf-peripherals-uart/src/main.c b/examples/espidf-peripherals-uart/src/main.c index 61faf2b..4c19dbf 100644 --- a/examples/espidf-peripherals-uart/src/main.c +++ b/examples/espidf-peripherals-uart/src/main.c @@ -1,4 +1,4 @@ -/* Uart Example +/* UART Echo Example This example code is in the Public Domain (or CC0 licensed, at your option.) @@ -7,177 +7,56 @@ CONDITIONS OF ANY KIND, either express or implied. */ #include -#include -#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_system.h" -#include "nvs_flash.h" #include "driver/uart.h" -#include "freertos/queue.h" -#include "esp_log.h" -#include "soc/uart_struct.h" -static const char *TAG = "uart_example"; /** - * Test code brief - * This example shows how to configure uart settings and install uart driver. + * This is an example which echos any data it receives on UART1 back to the sender, + * with hardware flow control turned off. It does not use UART driver event queue. * - * uart_evt_test() is an example that read and write data on UART0, and handler some of the special events. - * - port: UART0 - * - rx buffer: on - * - tx buffer: on - * - flow control: off - * - event queue: on - * - pin assignment: txd(default), rxd(default) - * - * uart_echo_test() is an example that read and write data on UART1, with hardware flow control turning on. - * - port: UART1 - * - rx buffer: on - * - tx buffer: off - * - flow control: on - * - event queue: off - * - pin assignment: txd(io4), rxd(io5), rts(18), cts(19) + * - Port: UART1 + * - Receive (Rx) buffer: on + * - Transmit (Tx) buffer: off + * - Flow control: off + * - Event queue: off + * - Pin assignment: see defines below */ +#define ECHO_TEST_TXD (GPIO_NUM_4) +#define ECHO_TEST_RXD (GPIO_NUM_5) +#define ECHO_TEST_RTS (UART_PIN_NO_CHANGE) +#define ECHO_TEST_CTS (UART_PIN_NO_CHANGE) + #define BUF_SIZE (1024) -#define ECHO_TEST_TXD (4) -#define ECHO_TEST_RXD (5) -#define ECHO_TEST_RTS (18) -#define ECHO_TEST_CTS (19) -QueueHandle_t uart0_queue; -void uart_task(void *pvParameters) +static void echo_task() { - int uart_num = (int) pvParameters; - uart_event_t event; - size_t buffered_size; - uint8_t* dtmp = (uint8_t*) malloc(BUF_SIZE); - for(;;) { - //Waiting for UART event. - if(xQueueReceive(uart0_queue, (void * )&event, (portTickType)portMAX_DELAY)) { - ESP_LOGI(TAG, "uart[%d] event:", uart_num); - switch(event.type) { - //Event of UART receving data - /*We'd better handler data event fast, there would be much more data events than - other types of events. If we take too much time on data event, the queue might - be full. - in this example, we don't process data in event, but read data outside.*/ - case UART_DATA: - uart_get_buffered_data_len(uart_num, &buffered_size); - ESP_LOGI(TAG, "data, len: %d; buffered len: %d", event.size, buffered_size); - break; - //Event of HW FIFO overflow detected - case UART_FIFO_OVF: - ESP_LOGI(TAG, "hw fifo overflow\n"); - //If fifo overflow happened, you should consider adding flow control for your application. - //We can read data out out the buffer, or directly flush the rx buffer. - uart_flush(uart_num); - break; - //Event of UART ring buffer full - case UART_BUFFER_FULL: - ESP_LOGI(TAG, "ring buffer full\n"); - //If buffer full happened, you should consider encreasing your buffer size - //We can read data out out the buffer, or directly flush the rx buffer. - uart_flush(uart_num); - break; - //Event of UART RX break detected - case UART_BREAK: - ESP_LOGI(TAG, "uart rx break\n"); - break; - //Event of UART parity check error - case UART_PARITY_ERR: - ESP_LOGI(TAG, "uart parity error\n"); - break; - //Event of UART frame error - case UART_FRAME_ERR: - ESP_LOGI(TAG, "uart frame error\n"); - break; - //UART_PATTERN_DET - case UART_PATTERN_DET: - ESP_LOGI(TAG, "uart pattern detected\n"); - break; - //Others - default: - ESP_LOGI(TAG, "uart event type: %d\n", event.type); - break; - } - } - } - free(dtmp); - dtmp = NULL; - vTaskDelete(NULL); -} - -void uart_evt_test() -{ - int uart_num = UART_NUM_0; - uart_config_t uart_config = { - .baud_rate = 115200, - .data_bits = UART_DATA_8_BITS, - .parity = UART_PARITY_DISABLE, - .stop_bits = UART_STOP_BITS_1, - .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, - .rx_flow_ctrl_thresh = 122, - }; - //Set UART parameters - uart_param_config(uart_num, &uart_config); - //Set UART log level - esp_log_level_set(TAG, ESP_LOG_INFO); - //Install UART driver, and get the queue. - uart_driver_install(uart_num, BUF_SIZE * 2, BUF_SIZE * 2, 10, &uart0_queue, 0); - //Set UART pins,(-1: default pin, no change.) - //For UART0, we can just use the default pins. - //uart_set_pin(uart_num, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); - //Set uart pattern detect function. - uart_enable_pattern_det_intr(uart_num, '+', 3, 10000, 10, 10); - //Create a task to handler UART event from ISR - xTaskCreate(uart_task, "uart_task", 2048, (void*)uart_num, 12, NULL); - //process data - uint8_t* data = (uint8_t*) malloc(BUF_SIZE); - do { - int len = uart_read_bytes(uart_num, data, BUF_SIZE, 100 / portTICK_RATE_MS); - if(len > 0) { - ESP_LOGI(TAG, "uart read : %d", len); - uart_write_bytes(uart_num, (const char*)data, len); - } - } while(1); -} - -//an example of echo test with hardware flow control on UART1 -void uart_echo_test() -{ - int uart_num = UART_NUM_1; + /* Configure parameters of an UART driver, + * communication pins and install the driver */ uart_config_t uart_config = { .baud_rate = 115200, .data_bits = UART_DATA_8_BITS, - .parity = UART_PARITY_DISABLE, + .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, - .flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS, - .rx_flow_ctrl_thresh = 122, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE }; - //Configure UART1 parameters - uart_param_config(uart_num, &uart_config); - //Set UART1 pins(TX: IO4, RX: I05, RTS: IO18, CTS: IO19) - uart_set_pin(uart_num, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS); - //Install UART driver( We don't need an event queue here) - //In this example we don't even use a buffer for sending data. - uart_driver_install(uart_num, BUF_SIZE * 2, 0, 0, NULL, 0); + uart_param_config(UART_NUM_1, &uart_config); + uart_set_pin(UART_NUM_1, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS); + uart_driver_install(UART_NUM_1, BUF_SIZE * 2, 0, 0, NULL, 0); - uint8_t* data = (uint8_t*) malloc(BUF_SIZE); - while(1) { - //Read data from UART - int len = uart_read_bytes(uart_num, data, BUF_SIZE, 20 / portTICK_RATE_MS); - //Write data back to UART - uart_write_bytes(uart_num, (const char*) data, len); + // Configure a temporary buffer for the incoming data + uint8_t *data = (uint8_t *) malloc(BUF_SIZE); + + while (1) { + // Read data from the UART + int len = uart_read_bytes(UART_NUM_1, data, BUF_SIZE, 20 / portTICK_RATE_MS); + // Write data back to the UART + uart_write_bytes(UART_NUM_1, (const char *) data, len); } } void app_main() { - //A uart read/write example without event queue; - xTaskCreate(uart_echo_test, "uart_echo_test", 1024, NULL, 10, NULL); - - //A uart example with event queue. - uart_evt_test(); -} \ No newline at end of file + xTaskCreate(echo_task, "uart_echo_task", 1024, NULL, 10, NULL); +} diff --git a/examples/espidf-peripherals-uart/src/sdkconfig.h b/examples/espidf-peripherals-uart/src/sdkconfig.h index 64ef778..67391da 100644 --- a/examples/espidf-peripherals-uart/src/sdkconfig.h +++ b/examples/espidf-peripherals-uart/src/sdkconfig.h @@ -6,120 +6,218 @@ */ #define CONFIG_GATTC_ENABLE 1 #define CONFIG_ESP32_PHY_MAX_TX_POWER 20 -#define CONFIG_PHY_ENABLED 1 #define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" -#define CONFIG_NEWLIB_STDOUT_ADDCR 1 -#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 #define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 -#define CONFIG_ETHERNET 1 +#define CONFIG_SPIFFS_CACHE 1 #define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 -#define CONFIG_AWS_IOT_MQTT_PORT 8883 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 #define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 #define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 #define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 #define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 #define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 #define CONFIG_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_EMAC_TASK_PRIORITY 20 #define CONFIG_TIMER_TASK_STACK_DEPTH 2048 -#define CONFIG_FATFS_CODEPAGE 1 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 #define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_ESPTOOLPY_BAUD 115200 #define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 -#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 #define CONFIG_ESPTOOLPY_BAUD_115200B 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 +#define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 -#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0 -#define CONFIG_TCPIP_TASK_STACK_SIZE 2560 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 4096 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 3072 #define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 #define CONFIG_ESPTOOLPY_BEFORE "default_reset" #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 #define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 #define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 -#define CONFIG_AWS_IOT_SDK 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 #define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 #define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 #define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 #define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 #define CONFIG_ESPTOOLPY_COMPRESSED 1 #define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_WIFI_ENABLED 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 -#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 4096 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 #define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 -#define CONFIG_FATFS_CODEPAGE_ASCII 1 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 #define CONFIG_FREERTOS_HZ 100 #define CONFIG_LOG_COLORS 1 #define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 #define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 #define CONFIG_MONITOR_BAUD_115200B 1 #define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 #define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 -#define CONFIG_ESP32_XTAL_FREQ_AUTO 1 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 #define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_ESP32_DEBUG_OCDAWARE 1 #define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 #define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_FREERTOS_CORETIMER_0 1 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 #define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 #define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 #define CONFIG_FREERTOS_ISR_STACKSIZE 1536 #define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 -#define CONFIG_AWS_IOT_MQTT_HOST "" +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 #define CONFIG_BT_ACL_CONNECTIONS 4 -#define CONFIG_FATFS_MAX_LFN 255 #define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 #define CONFIG_APP_OFFSET 0x10000 #define CONFIG_MEMMAP_SMP 1 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 #define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 #define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" -#define CONFIG_OPTIMIZATION_LEVEL_RELEASE 1 +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 diff --git a/examples/espidf-storage-sdcard/src/main.c b/examples/espidf-storage-sdcard/src/main.c index 8010685..459673e 100644 --- a/examples/espidf-storage-sdcard/src/main.c +++ b/examples/espidf-storage-sdcard/src/main.c @@ -14,15 +14,37 @@ #include "esp_log.h" #include "esp_vfs_fat.h" #include "driver/sdmmc_host.h" -#include "driver/sdmmc_defs.h" +#include "driver/sdspi_host.h" #include "sdmmc_cmd.h" -static const char* TAG = "example"; +static const char *TAG = "example"; + +// This example can use SDMMC and SPI peripherals to communicate with SD card. +// By default, SDMMC peripheral is used. +// To enable SPI mode, uncomment the following line: + +// #define USE_SPI_MODE + +// When testing SD and SPI modes, keep in mind that once the card has been +// initialized in SPI mode, it can not be reinitialized in SD mode without +// toggling power to the card. + +#ifdef USE_SPI_MODE +// Pin mapping when using SPI mode. +// With this mapping, SD card can be used both in SPI and 1-line SD mode. +// Note that a pull-up on CS line is required in SD mode. +#define PIN_NUM_MISO 2 +#define PIN_NUM_MOSI 15 +#define PIN_NUM_CLK 14 +#define PIN_NUM_CS 13 +#endif //USE_SPI_MODE void app_main(void) { ESP_LOGI(TAG, "Initializing SD card"); +#ifndef USE_SPI_MODE + ESP_LOGI(TAG, "Using SDMMC peripheral"); sdmmc_host_t host = SDMMC_HOST_DEFAULT(); // To use 1-line SD mode, uncomment the following line: @@ -32,9 +54,31 @@ void app_main(void) // Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals. sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT(); + // GPIOs 15, 2, 4, 12, 13 should have external 10k pull-ups. + // Internal pull-ups are not sufficient. However, enabling internal pull-ups + // does make a difference some boards, so we do that here. + gpio_set_pull_mode(15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes + gpio_set_pull_mode(2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes + gpio_set_pull_mode(4, GPIO_PULLUP_ONLY); // D1, needed in 4-line mode only + gpio_set_pull_mode(12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only + gpio_set_pull_mode(13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes + +#else + ESP_LOGI(TAG, "Using SPI peripheral"); + + sdmmc_host_t host = SDSPI_HOST_DEFAULT(); + sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT(); + slot_config.gpio_miso = PIN_NUM_MISO; + slot_config.gpio_mosi = PIN_NUM_MOSI; + slot_config.gpio_sck = PIN_NUM_CLK; + slot_config.gpio_cs = PIN_NUM_CS; + // This initializes the slot without card detect (CD) and write protect (WP) signals. + // Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals. +#endif //USE_SPI_MODE + // Options for mounting the filesystem. - // If format_if_mount_failed is set to true, SD card will be partitioned and formatted - // in case when mounting fails. + // If format_if_mount_failed is set to true, SD card will be partitioned and + // formatted in case when mounting fails. esp_vfs_fat_sdmmc_mount_config_t mount_config = { .format_if_mount_failed = false, .max_files = 5 @@ -46,11 +90,14 @@ void app_main(void) // production applications. sdmmc_card_t* card; esp_err_t ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card); + if (ret != ESP_OK) { if (ret == ESP_FAIL) { - ESP_LOGE(TAG, "Failed to mount filesystem. If you want the card to be formatted, set format_if_mount_failed = true."); + ESP_LOGE(TAG, "Failed to mount filesystem. " + "If you want the card to be formatted, set format_if_mount_failed = true."); } else { - ESP_LOGE(TAG, "Failed to initialize the card (%d). Make sure SD card lines have pull-up resistors in place.", ret); + ESP_LOGE(TAG, "Failed to initialize the card (%d). " + "Make sure SD card lines have pull-up resistors in place.", ret); } return; } @@ -101,7 +148,7 @@ void app_main(void) } ESP_LOGI(TAG, "Read from file: '%s'", line); - // All done, unmount partition and disable SDMMC host peripheral + // All done, unmount partition and disable SDMMC or SPI peripheral esp_vfs_fat_sdmmc_unmount(); ESP_LOGI(TAG, "Card unmounted"); -} \ No newline at end of file +} diff --git a/examples/espidf-storage-sdcard/src/sdkconfig.h b/examples/espidf-storage-sdcard/src/sdkconfig.h index 64ef778..67391da 100644 --- a/examples/espidf-storage-sdcard/src/sdkconfig.h +++ b/examples/espidf-storage-sdcard/src/sdkconfig.h @@ -6,120 +6,218 @@ */ #define CONFIG_GATTC_ENABLE 1 #define CONFIG_ESP32_PHY_MAX_TX_POWER 20 -#define CONFIG_PHY_ENABLED 1 #define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" -#define CONFIG_NEWLIB_STDOUT_ADDCR 1 -#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 #define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 -#define CONFIG_ETHERNET 1 +#define CONFIG_SPIFFS_CACHE 1 #define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 #define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 -#define CONFIG_AWS_IOT_MQTT_PORT 8883 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 #define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 #define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 #define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 #define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 #define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 #define CONFIG_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_EMAC_TASK_PRIORITY 20 #define CONFIG_TIMER_TASK_STACK_DEPTH 2048 -#define CONFIG_FATFS_CODEPAGE 1 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 #define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_ESPTOOLPY_BAUD 115200 #define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 #define CONFIG_FLASHMODE_DIO 1 #define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 #define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 -#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 #define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 #define CONFIG_ESPTOOLPY_BAUD_115200B 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 +#define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 -#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0 -#define CONFIG_TCPIP_TASK_STACK_SIZE 2560 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 4096 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_BTC_TASK_STACK_SIZE 3072 #define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 #define CONFIG_ESPTOOLPY_BEFORE "default_reset" #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 #define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 #define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 #define CONFIG_ESP32_WIFI_NVS_ENABLED 1 -#define CONFIG_AWS_IOT_SDK 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 #define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 #define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 #define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 #define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 #define CONFIG_ESPTOOLPY_COMPRESSED 1 #define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_WIFI_ENABLED 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 -#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 4096 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 #define CONFIG_ESP32_APPTRACE_DEST_NONE 1 #define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 #define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 -#define CONFIG_FATFS_CODEPAGE_ASCII 1 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 #define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 #define CONFIG_FREERTOS_HZ 100 #define CONFIG_LOG_COLORS 1 #define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 #define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 #define CONFIG_MONITOR_BAUD_115200B 1 #define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 #define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 -#define CONFIG_ESP32_XTAL_FREQ_AUTO 1 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_TCP_MAXRTX 12 #define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 #define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_ESP32_DEBUG_OCDAWARE 1 #define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 #define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_FREERTOS_CORETIMER_0 1 #define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" #define CONFIG_MBEDTLS_HAVE_TIME 1 #define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 #define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 #define CONFIG_FREERTOS_ISR_STACKSIZE 1536 #define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 -#define CONFIG_AWS_IOT_MQTT_HOST "" +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 #define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 #define CONFIG_BT_ACL_CONNECTIONS 4 -#define CONFIG_FATFS_MAX_LFN 255 #define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 #define CONFIG_APP_OFFSET 0x10000 #define CONFIG_MEMMAP_SMP 1 #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 #define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 #define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" -#define CONFIG_OPTIMIZATION_LEVEL_RELEASE 1 +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 From 464d71f91825b41f8777fe7ac39be344262d6e58 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Sat, 5 May 2018 21:29:04 +0300 Subject: [PATCH 09/38] Update ESP-IDF package version --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index 4bec670..6a8a1cf 100644 --- a/platform.json +++ b/platform.json @@ -50,7 +50,7 @@ "framework-espidf": { "type": "framework", "optional": true, - "version": "~2.211.0" + "version": "~2.300.0" }, "framework-simba": { "type": "framework", From c53d2cbb3d53009e255835b30bbe1de156b8af5e Mon Sep 17 00:00:00 2001 From: Scott Price Date: Sat, 5 May 2018 15:32:20 -0500 Subject: [PATCH 10/38] The '-' (dash) has been changed to '_' (underscore) in the macro names. (#82) --- boards/esp32-evb.json | 2 +- boards/esp32-gateway.json | 2 +- boards/esp32vn-iot-uno.json | 2 +- boards/m5stack-core-esp32.json | 2 +- boards/nodemcu-32s.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/boards/esp32-evb.json b/boards/esp32-evb.json index 8c75e18..4d546cb 100644 --- a/boards/esp32-evb.json +++ b/boards/esp32-evb.json @@ -1,7 +1,7 @@ { "build": { "core": "esp32", - "extra_flags": "-DARDUINO_ESP32-EVB", + "extra_flags": "-DARDUINO_ESP32_EVB", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", diff --git a/boards/esp32-gateway.json b/boards/esp32-gateway.json index 6a5f038..d88afff 100644 --- a/boards/esp32-gateway.json +++ b/boards/esp32-gateway.json @@ -1,7 +1,7 @@ { "build": { "core": "esp32", - "extra_flags": "-DARDUINO_ESP32-GATEWAY", + "extra_flags": "-DARDUINO_ESP32_GATEWAY", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", diff --git a/boards/esp32vn-iot-uno.json b/boards/esp32vn-iot-uno.json index 2af96b9..58cfbf9 100644 --- a/boards/esp32vn-iot-uno.json +++ b/boards/esp32vn-iot-uno.json @@ -1,7 +1,7 @@ { "build": { "core": "esp32", - "extra_flags": "-DARDUINO_esp32vn-iot-uno", + "extra_flags": "-DARDUINO_esp32vn_iot_uno", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", diff --git a/boards/m5stack-core-esp32.json b/boards/m5stack-core-esp32.json index 84313d8..cdb7b97 100644 --- a/boards/m5stack-core-esp32.json +++ b/boards/m5stack-core-esp32.json @@ -1,7 +1,7 @@ { "build": { "core": "esp32", - "extra_flags": "-DARDUINO_M5Stack-Core-ESP32", + "extra_flags": "-DARDUINO_M5Stack_Core_ESP32", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", diff --git a/boards/nodemcu-32s.json b/boards/nodemcu-32s.json index 3031a50..e3825e3 100644 --- a/boards/nodemcu-32s.json +++ b/boards/nodemcu-32s.json @@ -1,7 +1,7 @@ { "build": { "core": "esp32", - "extra_flags": "-DARDUINO_NodeMCU-32S", + "extra_flags": "-DARDUINO_NodeMCU_32S", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", From 78b5dfe974c2d15e905abb7f2d7d7ac2ec55bad8 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Mon, 7 May 2018 23:40:34 +0300 Subject: [PATCH 11/38] Add support for uploading SPIFFS files // Issue #62 --- builder/frameworks/espidf.py | 11 ++++- builder/main.py | 93 ++++++++++++++++++++++++++++++++++-- 2 files changed, 97 insertions(+), 7 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 53d5793..be689a6 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -322,10 +322,17 @@ if not isfile(join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")): # Generate partition table # +# Export path to the partitions table +env.Append( + PARTITION_TABLE_CSV=join( + FRAMEWORK_DIR, "components", "partition_table", + "%s.csv" % env.BoardConfig().get("build.partitions", "partitions_singleapp") + ) +) + partition_table = env.Command( join("$BUILD_DIR", "partitions_table.bin"), - join(FRAMEWORK_DIR, "components", "partition_table", - "partitions_singleapp.csv"), + "$PARTITION_TABLE_CSV", env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join( FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py"), "Generating partitions $TARGET")) diff --git a/builder/main.py b/builder/main.py index 9043c57..15aca0c 100644 --- a/builder/main.py +++ b/builder/main.py @@ -13,7 +13,8 @@ # limitations under the License. import re -from os.path import join +import sys +from os.path import isfile, join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) @@ -113,6 +114,11 @@ env.Replace( UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE', UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', + # + # Misc + # + + MKSPIFFSTOOL="mkspiffs_${PIOPLATFORM}_${PIOFRAMEWORK}", SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES', PROGSUFFIX=".elf" @@ -124,6 +130,52 @@ env.Append( ASFLAGS=env.get("CCFLAGS", [])[:] ) +# +# SPIFFS +# + +def fetch_spiffs_size(env): + path_to_patition_table = env.get("PARTITION_TABLE_CSV", "") + if not isfile(path_to_patition_table): + sys.stderr.write("Could not find the file %s with paritions table." % path_to_patition_table) + env.Exit(1) + + with open(path_to_patition_table) as fp: + for l in fp.readlines(): + if l.startswith("spiffs"): + spiffs_config = [s.strip() for s in l.split(",")] + env["SPIFFS_START"] = spiffs_config[3] + env["SPIFFS_SIZE"] = spiffs_config[4] + env["SPIFFS_PAGE"] = "0x100" + env["SPIFFS_BLOCK"] = "0x1000" + return + + sys.stderr.write("Could not find the spiffs section in the paritions file %s" % path_to_patition_table) + env.Exit(1) + +def __fetch_spiffs_size(target, source, env): + fetch_spiffs_size(env) + return (target, source) + + +env.Append( + BUILDERS=dict( + DataToBin=Builder( + action=env.VerboseAction(" ".join([ + '"$MKSPIFFSTOOL"', + "-c", "$SOURCES", + "-p", "${int(SPIFFS_PAGE, 16)}", + "-b", "${int(SPIFFS_BLOCK, 16)}", + "-s", "${int(SPIFFS_SIZE, 16)}", + "$TARGET" + ]), "Building SPIFFS image from '$SOURCES' directory to $TARGET"), + emitter=__fetch_spiffs_size, + source_factory=env.Dir, + suffix=".bin" + ) + ) +) + # Allow user to override via pre:script if env.get("PROGNAME", "program") == "program": env.Replace(PROGNAME="firmware") @@ -142,7 +194,7 @@ env.Append( "--flash_mode", "$BOARD_FLASH_MODE", "--flash_freq", "${__get_board_f_flash(__env__)}", "--flash_size", - env.BoardConfig().get("upload.flash_size", "4MB"), + env.BoardConfig().get("upload.flash_size", "detect"), "-o", "$TARGET", "$SOURCES" ]), "Building $TARGET"), suffix=".bin" @@ -164,15 +216,46 @@ if env.subst("$PIOFRAMEWORK") == "arduino": # Target: Build executable and linkable firmware or SPIFFS image # + target_elf = env.BuildProgram() if "nobuild" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "${PROGNAME}.bin") + if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): + fetch_spiffs_size(env) + target_firm = join("$BUILD_DIR", "spiffs.bin") + else: + target_firm = join("$BUILD_DIR", "${PROGNAME}.bin") else: - target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf) + if set(["buildfs", "uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): + target_firm = env.DataToBin( + join("$BUILD_DIR", "spiffs"), "$PROJECTDATA_DIR") + AlwaysBuild(target_firm) + AlwaysBuild(env.Alias("buildfs", target_firm)) + else: + target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf) AlwaysBuild(env.Alias("nobuild", target_firm)) target_buildprog = env.Alias("buildprog", target_firm, target_firm) +# +# Replace default upload flags +# + +if "uploadfs" in COMMAND_LINE_TARGETS: + env.Replace( + UPLOADERFLAGS=[ + "--chip", "esp32", + "--port", '"$UPLOAD_PORT"', + "--baud", "$UPLOAD_SPEED", + "--before", "default_reset", + "--after", "hard_reset", + "write_flash", "-z", + "--flash_mode", "$BOARD_FLASH_MODE", + "--flash_size", "detect", + "${int(SPIFFS_START, 16)}" + ] + ) + + env.Append(UPLOADEROTAFLAGS=["-s"]) # # Target: Print binary size @@ -188,7 +271,7 @@ AlwaysBuild(target_size) # target_upload = env.Alias( - "upload", target_firm, + ["upload", "uploadfs"], target_firm, [env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."), env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]) env.AlwaysBuild(target_upload) From bdbf125d4dd210b29131ac844ce41cecbeecbf6c Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Mon, 7 May 2018 23:50:32 +0300 Subject: [PATCH 12/38] Replace PARTITION_TABLE_CSV variable instead of appending --- builder/frameworks/espidf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index be689a6..933def6 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -323,7 +323,7 @@ if not isfile(join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")): # # Export path to the partitions table -env.Append( +env.Replace( PARTITION_TABLE_CSV=join( FRAMEWORK_DIR, "components", "partition_table", "%s.csv" % env.BoardConfig().get("build.partitions", "partitions_singleapp") From 137323652ffa1648d58afa916bbeea00e66cbb5a Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Mon, 7 May 2018 23:57:35 +0300 Subject: [PATCH 13/38] Add mkspiffs package --- platform.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform.json b/platform.json index 6a8a1cf..f13d260 100644 --- a/platform.json +++ b/platform.json @@ -75,6 +75,11 @@ "type": "debugger", "optional": true, "version": "~1.1000.0" + }, + "tool-mkspiffs": { + "type": "uploader", + "optional": true, + "version": "~2.230.0" } } } From c1114a9b1338cdf46e4d4c92712850432bc9787f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 8 May 2018 16:16:20 +0300 Subject: [PATCH 14/38] Remove tmp code --- platform.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform.py b/platform.py index a167f9f..b2a1603 100644 --- a/platform.py +++ b/platform.py @@ -72,8 +72,7 @@ class Espressif32Platform(PlatformBase): "$INIT_BREAK", "mon reset halt", "$LOAD_CMD", - "pio_reset_halt_target", - "continue" + "pio_reset_halt_target" ], "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' } From 1ca3930a8f080fece3257b5e29c9d51dec532c14 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Tue, 8 May 2018 22:59:21 +0300 Subject: [PATCH 15/38] Check if the esp-idf configuration file is compatible with the latest framework version --- builder/frameworks/espidf.py | 49 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 933def6..b0f2e1b 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -97,6 +97,20 @@ def build_component(path): src_filter=src_filter ) +def find_valid_config_file(): + search_path = join( + env.subst("$PIOHOME_DIR"), "platforms", + env.subst("$PIOPLATFORM"), "examples", "*", "src", "sdkconfig.h" + ) + + files = glob(search_path) + if not files: + sys.stderr.write( + "Error: Could not find default \"sdkconfig.h\" file\n") + env.Exit(1) + + return files[0] + def build_espidf_bootloader(): envsafe = env.Clone() @@ -302,20 +316,27 @@ env.Append( # if not isfile(join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")): - search_path = join( - env.subst("$PIOHOME_DIR"), "platforms", - env.subst("$PIOPLATFORM"), "examples", "*", "src", "sdkconfig.h" - ) - - files = glob(search_path) - if not files: - sys.stderr.write( - "Error: \"sdkconfig.h\" file is required for esp-idf framework!\n") - env.Exit(1) - - print("Warning! Cannot find \"sdk_config.h\" file. " - "Default \"sdk_config.h\" will be added to your project!") - copy(files[0], join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")) + print("Warning! Cannot find \"sdkconfig.h\" file. " + "Default \"sdkconfig.h\" will be added to your project!") + copy(find_valid_config_file(), join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")) +else: + is_new = False + with open(join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")) as fp: + for l in fp.readlines(): + if "CONFIG_ADC_CAL_LUT_ENABLE" in l: + is_new = True + break + + if not is_new: + print("Warning! Detected an outdated \"sdkconfig.h\" file. " + "The old \"sdkconfig.h\" will be replaced by the new one.") + + new_config = find_valid_config_file() + copy( + join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h"), + join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h.bak") + ) + copy(new_config, join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")) # From 265b02eac0a4caac8703841dc7b7df43a3517aa9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 9 May 2018 19:38:25 +0300 Subject: [PATCH 16/38] Add "minimodule" debug probe --- boards/esp-wrover-kit.json | 3 ++- boards/esp32-evb.json | 3 ++- boards/esp32-gateway.json | 3 ++- boards/esp32dev.json | 3 ++- boards/esp32doit-devkit-v1.json | 3 ++- boards/esp32thing.json | 3 ++- boards/esp32vn-iot-uno.json | 3 ++- boards/espectro32.json | 3 ++- boards/espino32.json | 3 ++- boards/featheresp32.json | 3 ++- boards/firebeetle32.json | 3 ++- boards/hornbill32dev.json | 3 ++- boards/hornbill32minima.json | 3 ++- boards/lolin32.json | 3 ++- boards/mhetesp32devkit.json | 3 ++- boards/mhetesp32minikit.json | 3 ++- boards/node32s.json | 3 ++- boards/nodemcu-32s.json | 3 ++- boards/pocket_32.json | 3 ++- boards/wemosbat.json | 3 ++- platform.py | 10 ++++++++-- 21 files changed, 48 insertions(+), 22 deletions(-) diff --git a/boards/esp-wrover-kit.json b/boards/esp-wrover-kit.json index 1109686..0ed0fbe 100644 --- a/boards/esp-wrover-kit.json +++ b/boards/esp-wrover-kit.json @@ -40,7 +40,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://espressif.com/en/products/hardware/esp-wrover-kit/overview", diff --git a/boards/esp32-evb.json b/boards/esp32-evb.json index 4d546cb..4924a04 100644 --- a/boards/esp32-evb.json +++ b/boards/esp32-evb.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://www.olimex.com/Products/IoT/ESP32-EVB/open-source-hardware", diff --git a/boards/esp32-gateway.json b/boards/esp32-gateway.json index d88afff..ba3223f 100644 --- a/boards/esp32-gateway.json +++ b/boards/esp32-gateway.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://www.olimex.com/Products/IoT/ESP32-GATEWAY/open-source-hardware", diff --git a/boards/esp32dev.json b/boards/esp32dev.json index e5efe8e..ee3ff0d 100644 --- a/boards/esp32dev.json +++ b/boards/esp32dev.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://en.wikipedia.org/wiki/ESP32", diff --git a/boards/esp32doit-devkit-v1.json b/boards/esp32doit-devkit-v1.json index d4f8e16..b48466b 100644 --- a/boards/esp32doit-devkit-v1.json +++ b/boards/esp32doit-devkit-v1.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://www.doit.am/", diff --git a/boards/esp32thing.json b/boards/esp32thing.json index 636f7ae..50930cc 100644 --- a/boards/esp32thing.json +++ b/boards/esp32thing.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://www.sparkfun.com/products/13907", diff --git a/boards/esp32vn-iot-uno.json b/boards/esp32vn-iot-uno.json index 58cfbf9..7c4ee27 100644 --- a/boards/esp32vn-iot-uno.json +++ b/boards/esp32vn-iot-uno.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://esp32.vn/", diff --git a/boards/espectro32.json b/boards/espectro32.json index 2f228b8..664bfd1 100644 --- a/boards/espectro32.json +++ b/boards/espectro32.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://shop.makestro.com/product/espectro32", diff --git a/boards/espino32.json b/boards/espino32.json index 2c5668e..44d8a21 100644 --- a/boards/espino32.json +++ b/boards/espino32.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://thaieasyelec.com/products/development-boards/espino-wifi-development-board-detail.html", diff --git a/boards/featheresp32.json b/boards/featheresp32.json index 8478b40..bfcc0a4 100644 --- a/boards/featheresp32.json +++ b/boards/featheresp32.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://www.adafruit.com/product/3405", diff --git a/boards/firebeetle32.json b/boards/firebeetle32.json index fc32da4..0683a06 100644 --- a/boards/firebeetle32.json +++ b/boards/firebeetle32.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://dfrobotblog.wordpress.com", diff --git a/boards/hornbill32dev.json b/boards/hornbill32dev.json index d6acf1e..4d0d0af 100644 --- a/boards/hornbill32dev.json +++ b/boards/hornbill32dev.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://hackaday.io/project/18997-hornbill", diff --git a/boards/hornbill32minima.json b/boards/hornbill32minima.json index c6d2f8a..3563431 100644 --- a/boards/hornbill32minima.json +++ b/boards/hornbill32minima.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://hackaday.io/project/18997-hornbill", diff --git a/boards/lolin32.json b/boards/lolin32.json index 4c415ea..b620ae7 100644 --- a/boards/lolin32.json +++ b/boards/lolin32.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://wemos.cc", diff --git a/boards/mhetesp32devkit.json b/boards/mhetesp32devkit.json index 59cc0df..2b8c2df 100644 --- a/boards/mhetesp32devkit.json +++ b/boards/mhetesp32devkit.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://forum.mhetlive.com", diff --git a/boards/mhetesp32minikit.json b/boards/mhetesp32minikit.json index ba2e279..cccd9a7 100644 --- a/boards/mhetesp32minikit.json +++ b/boards/mhetesp32minikit.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://forum.mhetlive.com", diff --git a/boards/node32s.json b/boards/node32s.json index 884684c..406a58b 100644 --- a/boards/node32s.json +++ b/boards/node32s.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://www.ayarafun.com", diff --git a/boards/nodemcu-32s.json b/boards/nodemcu-32s.json index e3825e3..dbd0d98 100644 --- a/boards/nodemcu-32s.json +++ b/boards/nodemcu-32s.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://www.nodemcu.com/", diff --git a/boards/pocket_32.json b/boards/pocket_32.json index db868ec..ddfc0c5 100644 --- a/boards/pocket_32.json +++ b/boards/pocket_32.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "http://dong-sen.com", diff --git a/boards/wemosbat.json b/boards/wemosbat.json index c0f1dfa..2aab99e 100644 --- a/boards/wemosbat.json +++ b/boards/wemosbat.json @@ -34,7 +34,8 @@ "protocols": [ "esptool", "olimex-arm-usb-tiny-h", - "olimex-arm-usb-ocd-h" + "olimex-arm-usb-ocd-h", + "minimodule" ] }, "url": "https://www.wemos.cc", diff --git a/platform.py b/platform.py index b2a1603..e5c573b 100644 --- a/platform.py +++ b/platform.py @@ -42,14 +42,20 @@ class Espressif32Platform(PlatformBase): if "tools" not in debug: debug['tools'] = {} + available_tools = ( + "olimex-arm-usb-ocd-h", "olimex-arm-usb-tiny-h", "minimodule" + ) + # Only FTDI based debug probes - for link in ("olimex-arm-usb-tiny-h", "olimex-arm-usb-ocd-h"): + for link in available_tools: if link not in upload_protocols or link in debug['tools']: continue + ftdi_interface = "mbftdi" if link == "minimodule" else link + server_args = [ "-s", "$PACKAGE_DIR/share/openocd/scripts", - "-f", "share/openocd/scripts/interface/ftdi/%s.cfg" % link, + "-f", "share/openocd/scripts/interface/ftdi/%s.cfg" % ftdi_interface, "-f", "share/openocd/scripts/board/%s" % debug.get("openocd_board") ] From 0e9013788ce61f8a5ff2ac03139b11e8e3adec64 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 9 May 2018 20:02:18 +0300 Subject: [PATCH 17/38] Temporary switch to "preload" --- platform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform.py b/platform.py index e5c573b..11dd019 100644 --- a/platform.py +++ b/platform.py @@ -80,7 +80,8 @@ class Espressif32Platform(PlatformBase): "$LOAD_CMD", "pio_reset_halt_target" ], - "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' + "load_cmd": 'preload' + # "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' } board.manifest['debug'] = debug From a585ee77652e1abc6178f3f5fec2857fdce88c93 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 9 May 2018 20:08:20 +0300 Subject: [PATCH 18/38] Revert back to "program_esp32' --- platform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.py b/platform.py index 11dd019..41cc4e2 100644 --- a/platform.py +++ b/platform.py @@ -80,8 +80,8 @@ class Espressif32Platform(PlatformBase): "$LOAD_CMD", "pio_reset_halt_target" ], - "load_cmd": 'preload' - # "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' + # "load_cmd": 'preload' + "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' } board.manifest['debug'] = debug From f94205296a681bd211537b227eebea750c54031d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 10 May 2018 23:06:24 +0300 Subject: [PATCH 19/38] Update esptool to 2.3.1 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index f13d260..46b6e7d 100644 --- a/platform.json +++ b/platform.json @@ -64,7 +64,7 @@ }, "tool-esptoolpy": { "type": "uploader", - "version": "~1.20100.0" + "version": "~1.20310.0" }, "tool-espotapy": { "type": "uploader", From 124a5cbd3ebb36e779b67ce00e76ad5803ffb9b1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 10 May 2018 23:08:50 +0300 Subject: [PATCH 20/38] Switch to the latest toolchain for ESP-IDF --- builder/frameworks/espidf.py | 12 ++++++------ platform.json | 2 +- platform.py | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index b0f2e1b..b7369d4 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -110,7 +110,7 @@ def find_valid_config_file(): env.Exit(1) return files[0] - + def build_espidf_bootloader(): envsafe = env.Clone() @@ -303,7 +303,7 @@ env.Append( "-T", "esp32.rom.spiram_incompatible_fns.ld" ], - UPLOADERFLAGS=[ + EXTRA_ESPTOOL_UPLOADFLAGS=[ "0x1000", join("$BUILD_DIR", "bootloader.bin"), "0x8000", join("$BUILD_DIR", "partitions_table.bin"), "0x10000" @@ -324,13 +324,13 @@ else: with open(join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")) as fp: for l in fp.readlines(): if "CONFIG_ADC_CAL_LUT_ENABLE" in l: - is_new = True + is_new = True break - + if not is_new: print("Warning! Detected an outdated \"sdkconfig.h\" file. " - "The old \"sdkconfig.h\" will be replaced by the new one.") - + "The old \"sdkconfig.h\" will be replaced by the new one.") + new_config = find_valid_config_file() copy( join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h"), diff --git a/platform.json b/platform.json index 46b6e7d..d1be4bf 100644 --- a/platform.json +++ b/platform.json @@ -40,7 +40,7 @@ "packages": { "toolchain-xtensa32": { "type": "toolchain", - "version": "~1.50200.2" + "version": "~2.50200.0" }, "framework-arduinoespressif32": { "type": "framework", diff --git a/platform.py b/platform.py index 41cc4e2..87eaa8c 100644 --- a/platform.py +++ b/platform.py @@ -18,8 +18,10 @@ from platformio.managers.platform import PlatformBase class Espressif32Platform(PlatformBase): def configure_default_packages(self, variables, targets): - if "arduino" in variables.get("pioframework"): - self.packages['toolchain-xtensa32']['version'] = "~2.50200.0" + if "buildfs" in targets: + self.packages['tool-mkspiffs']['optional'] = False + if variables.get("upload_protocol"): + self.packages['tool-openocd-esp32']['optional'] = False return PlatformBase.configure_default_packages( self, variables, targets) From 4c1014aa451f4d7b483468785e896f56a6365067 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 02:15:43 +0300 Subject: [PATCH 21/38] Remove unused "wait_for_upload_port" option --- boards/esp-wrover-kit.json | 1 - boards/esp32-evb.json | 1 - boards/esp32-gateway.json | 1 - boards/esp320.json | 1 - boards/esp32dev.json | 1 - boards/esp32doit-devkit-v1.json | 1 - boards/esp32thing.json | 1 - boards/esp32vn-iot-uno.json | 1 - boards/espea32.json | 1 - boards/espectro32.json | 1 - boards/espino32.json | 1 - boards/featheresp32.json | 1 - boards/firebeetle32.json | 1 - boards/heltec_wifi_kit_32.json | 1 - boards/heltec_wifi_lora_32.json | 1 - boards/hornbill32dev.json | 1 - boards/hornbill32minima.json | 1 - boards/intorobot.json | 1 - boards/lolin32.json | 1 - boards/m5stack-core-esp32.json | 3 +-- boards/mhetesp32devkit.json | 1 - boards/mhetesp32minikit.json | 1 - boards/microduino-core-esp32.json | 1 - boards/nano32.json | 1 - boards/nina_w10.json | 1 - boards/node32s.json | 1 - boards/nodemcu-32s.json | 1 - boards/onehorse32dev.json | 1 - boards/pocket_32.json | 1 - boards/quantum.json | 1 - boards/wemosbat.json | 1 - boards/widora-air.json | 1 - 32 files changed, 1 insertion(+), 33 deletions(-) diff --git a/boards/esp-wrover-kit.json b/boards/esp-wrover-kit.json index 0ed0fbe..f320644 100644 --- a/boards/esp-wrover-kit.json +++ b/boards/esp-wrover-kit.json @@ -35,7 +35,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/esp32-evb.json b/boards/esp32-evb.json index 4924a04..19aefa2 100644 --- a/boards/esp32-evb.json +++ b/boards/esp32-evb.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/esp32-gateway.json b/boards/esp32-gateway.json index ba3223f..dccfd6a 100644 --- a/boards/esp32-gateway.json +++ b/boards/esp32-gateway.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/esp320.json b/boards/esp320.json index 84f0dbe..4ff912e 100644 --- a/boards/esp320.json +++ b/boards/esp320.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/esp32dev.json b/boards/esp32dev.json index ee3ff0d..d0620de 100644 --- a/boards/esp32dev.json +++ b/boards/esp32dev.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/esp32doit-devkit-v1.json b/boards/esp32doit-devkit-v1.json index b48466b..b5ff28c 100644 --- a/boards/esp32doit-devkit-v1.json +++ b/boards/esp32doit-devkit-v1.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/esp32thing.json b/boards/esp32thing.json index 50930cc..358bf9c 100644 --- a/boards/esp32thing.json +++ b/boards/esp32thing.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/esp32vn-iot-uno.json b/boards/esp32vn-iot-uno.json index 7c4ee27..81fa9c2 100644 --- a/boards/esp32vn-iot-uno.json +++ b/boards/esp32vn-iot-uno.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/espea32.json b/boards/espea32.json index 71fe3cf..7dca70c 100644 --- a/boards/espea32.json +++ b/boards/espea32.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/espectro32.json b/boards/espectro32.json index 664bfd1..d4aab70 100644 --- a/boards/espectro32.json +++ b/boards/espectro32.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 2000000, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/espino32.json b/boards/espino32.json index 44d8a21..808aae1 100644 --- a/boards/espino32.json +++ b/boards/espino32.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/featheresp32.json b/boards/featheresp32.json index bfcc0a4..2ead628 100644 --- a/boards/featheresp32.json +++ b/boards/featheresp32.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/firebeetle32.json b/boards/firebeetle32.json index 0683a06..dcbf0de 100644 --- a/boards/firebeetle32.json +++ b/boards/firebeetle32.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/heltec_wifi_kit_32.json b/boards/heltec_wifi_kit_32.json index 4de2cbc..cb8f223 100644 --- a/boards/heltec_wifi_kit_32.json +++ b/boards/heltec_wifi_kit_32.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/heltec_wifi_lora_32.json b/boards/heltec_wifi_lora_32.json index e744b0c..7ffaa30 100644 --- a/boards/heltec_wifi_lora_32.json +++ b/boards/heltec_wifi_lora_32.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/hornbill32dev.json b/boards/hornbill32dev.json index 4d0d0af..3f00ad7 100644 --- a/boards/hornbill32dev.json +++ b/boards/hornbill32dev.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/hornbill32minima.json b/boards/hornbill32minima.json index 3563431..3a0f24d 100644 --- a/boards/hornbill32minima.json +++ b/boards/hornbill32minima.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/intorobot.json b/boards/intorobot.json index 8814256..b54b43e 100644 --- a/boards/intorobot.json +++ b/boards/intorobot.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/lolin32.json b/boards/lolin32.json index b620ae7..457df60 100644 --- a/boards/lolin32.json +++ b/boards/lolin32.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/m5stack-core-esp32.json b/boards/m5stack-core-esp32.json index cdb7b97..98f4e14 100644 --- a/boards/m5stack-core-esp32.json +++ b/boards/m5stack-core-esp32.json @@ -7,7 +7,7 @@ "flash_mode": "dio", "ldscript": "esp32_out.ld", "mcu": "esp32", - "variant": "esp32" + "variant": "m5stack_core_esp32" }, "connectivity": [ "wifi", @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/mhetesp32devkit.json b/boards/mhetesp32devkit.json index 2b8c2df..73384d8 100644 --- a/boards/mhetesp32devkit.json +++ b/boards/mhetesp32devkit.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/mhetesp32minikit.json b/boards/mhetesp32minikit.json index cccd9a7..85a4b64 100644 --- a/boards/mhetesp32minikit.json +++ b/boards/mhetesp32minikit.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/microduino-core-esp32.json b/boards/microduino-core-esp32.json index 558a476..93a8c74 100644 --- a/boards/microduino-core-esp32.json +++ b/boards/microduino-core-esp32.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 2000000, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/nano32.json b/boards/nano32.json index 4632d4d..921cb87 100644 --- a/boards/nano32.json +++ b/boards/nano32.json @@ -28,7 +28,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/nina_w10.json b/boards/nina_w10.json index 096936e..237596c 100644 --- a/boards/nina_w10.json +++ b/boards/nina_w10.json @@ -27,7 +27,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/node32s.json b/boards/node32s.json index 406a58b..04b8b1f 100644 --- a/boards/node32s.json +++ b/boards/node32s.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/nodemcu-32s.json b/boards/nodemcu-32s.json index dbd0d98..0f7d49c 100644 --- a/boards/nodemcu-32s.json +++ b/boards/nodemcu-32s.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/onehorse32dev.json b/boards/onehorse32dev.json index 37fda2f..0dfa0c2 100644 --- a/boards/onehorse32dev.json +++ b/boards/onehorse32dev.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/pocket_32.json b/boards/pocket_32.json index ddfc0c5..361e071 100644 --- a/boards/pocket_32.json +++ b/boards/pocket_32.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/quantum.json b/boards/quantum.json index f33cd12..b77bb67 100644 --- a/boards/quantum.json +++ b/boards/quantum.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" diff --git a/boards/wemosbat.json b/boards/wemosbat.json index 2aab99e..761235c 100644 --- a/boards/wemosbat.json +++ b/boards/wemosbat.json @@ -29,7 +29,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool", diff --git a/boards/widora-air.json b/boards/widora-air.json index 0b4b31a..2b2ed91 100644 --- a/boards/widora-air.json +++ b/boards/widora-air.json @@ -26,7 +26,6 @@ "maximum_size": 1310720, "require_upload_port": true, "speed": 115200, - "wait_for_upload_port": true, "protocol": "esptool", "protocols": [ "esptool" From 2bd3cdf21925894df87ad0e8eaa9028166974971 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 02:16:13 +0300 Subject: [PATCH 22/38] Add support for ESP32 Pico Kit --- boards/pico32.json | 36 ++++++++++++++++++++++++++++++++++++ platform.json | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 boards/pico32.json diff --git a/boards/pico32.json b/boards/pico32.json new file mode 100644 index 0000000..459857b --- /dev/null +++ b/boards/pico32.json @@ -0,0 +1,36 @@ +{ + "build": { + "core": "esp32", + "extra_flags": "-DARDUINO_ESP32_PICO", + "f_cpu": "240000000L", + "f_flash": "40000000L", + "flash_mode": "dio", + "ldscript": "esp32_out.ld", + "mcu": "esp32", + "variant": "pico32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "frameworks": [ + "arduino", + "espidf" + ], + "name": "ESP32 Pico Kit", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 294912, + "maximum_size": 1310720, + "require_upload_port": true, + "speed": 115200, + "protocol": "esptool", + "protocols": [ + "esptool" + ] + }, + "url": "http://esp-idf.readthedocs.io/en/latest/get-started/get-started-pico-kit.html", + "vendor": "Espressif" +} diff --git a/platform.json b/platform.json index d1be4bf..7384944 100644 --- a/platform.json +++ b/platform.json @@ -45,7 +45,7 @@ "framework-arduinoespressif32": { "type": "framework", "optional": true, - "version": "~1.4.0" + "version": "~1.5.0" }, "framework-espidf": { "type": "framework", From ea3dfd8d2df8f34a81500209231513a20b763823 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 02:16:58 +0300 Subject: [PATCH 23/38] Initial support for external JTAG and Custom programmers --- builder/frameworks/espidf.py | 1 + builder/main.py | 284 +++++++++++++++++++---------------- 2 files changed, 155 insertions(+), 130 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index b7369d4..a01816c 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -97,6 +97,7 @@ def build_component(path): src_filter=src_filter ) + def find_valid_config_file(): search_path = join( env.subst("$PIOHOME_DIR"), "platforms", diff --git a/builder/main.py b/builder/main.py index 15aca0c..d6f1ed5 100644 --- a/builder/main.py +++ b/builder/main.py @@ -26,11 +26,51 @@ def _get_board_f_flash(env): return str(int(int(frequency) / 1000000)) + "m" +def _get_board_flash_mode(env): + mode = env.subst("$BOARD_FLASH_MODE") + if mode == "qio": + return "dio" + elif mode == "qout": + return "dout" + return mode + +# +# SPIFFS helpers +# + +def fetch_spiffs_size(env): + path_to_patition_table = env.get("PARTITION_TABLE_CSV") + if not isfile(path_to_patition_table): + sys.stderr.write("Could not find the file %s with paritions table." % + path_to_patition_table) + env.Exit(1) + + with open(path_to_patition_table) as fp: + for l in fp.readlines(): + if l.startswith("spiffs"): + spiffs_config = [s.strip() for s in l.split(",")] + env["SPIFFS_START"] = spiffs_config[3] + env["SPIFFS_SIZE"] = spiffs_config[4] + env["SPIFFS_PAGE"] = "0x100" + env["SPIFFS_BLOCK"] = "0x1000" + return + + sys.stderr.write("Could not find the spiffs section in the paritions " + "file %s" % path_to_patition_table) + env.Exit(1) + + +def __fetch_spiffs_size(target, source, env): + fetch_spiffs_size(env) + return (target, source) + + env = DefaultEnvironment() platform = env.PioPlatform() env.Replace( __get_board_f_flash=_get_board_f_flash, + __get_board_flash_mode=_get_board_flash_mode, AR="xtensa-esp32-elf-ar", AS="xtensa-esp32-elf-as", @@ -83,40 +123,6 @@ env.Replace( "-Wl,--gc-sections" ], - # - # Upload - # - - UPLOADER=join( - platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"), - UPLOADEROTA=join(platform.get_package_dir("tool-espotapy") or "", - "espota.py"), - - UPLOADERFLAGS=[ - "--chip", "esp32", - "--port", '"$UPLOAD_PORT"', - "--baud", "$UPLOAD_SPEED", - "--before", "default_reset", - "--after", "hard_reset", - "write_flash", "-z", - "--flash_mode", "$BOARD_FLASH_MODE", - "--flash_freq", "${__get_board_f_flash(__env__)}", - "--flash_size", "detect" - ], - UPLOADEROTAFLAGS=[ - "--debug", - "--progress", - "-i", "$UPLOAD_PORT", - "-p", "3232", - "$UPLOAD_FLAGS" - ], - - UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE', - UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', - - # - # Misc - # MKSPIFFSTOOL="mkspiffs_${PIOPLATFORM}_${PIOFRAMEWORK}", SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES', @@ -124,42 +130,29 @@ env.Replace( PROGSUFFIX=".elf" ) - -# Clone actual CCFLAGS to ASFLAGS -env.Append( - ASFLAGS=env.get("CCFLAGS", [])[:] -) - -# -# SPIFFS -# - -def fetch_spiffs_size(env): - path_to_patition_table = env.get("PARTITION_TABLE_CSV", "") - if not isfile(path_to_patition_table): - sys.stderr.write("Could not find the file %s with paritions table." % path_to_patition_table) - env.Exit(1) - - with open(path_to_patition_table) as fp: - for l in fp.readlines(): - if l.startswith("spiffs"): - spiffs_config = [s.strip() for s in l.split(",")] - env["SPIFFS_START"] = spiffs_config[3] - env["SPIFFS_SIZE"] = spiffs_config[4] - env["SPIFFS_PAGE"] = "0x100" - env["SPIFFS_BLOCK"] = "0x1000" - return - - sys.stderr.write("Could not find the spiffs section in the paritions file %s" % path_to_patition_table) - env.Exit(1) - -def __fetch_spiffs_size(target, source, env): - fetch_spiffs_size(env) - return (target, source) - +# Allow user to override via pre:script +if env.get("PROGNAME", "program") == "program": + env.Replace(PROGNAME="firmware") env.Append( + # Clone actual CCFLAGS to ASFLAGS + ASFLAGS=env.get("CCFLAGS", [])[:], + BUILDERS=dict( + ElfToBin=Builder( + action=env.VerboseAction(" ".join([ + '"$PYTHONEXE" "$OBJCOPY"', + "--chip", "esp32", + "elf2image", + "--flash_mode", "$BOARD_FLASH_MODE", + "--flash_freq", "${__get_board_f_flash(__env__)}", + "--flash_size", + env.BoardConfig().get("upload.flash_size", "detect"), + "-o", "$TARGET", "$SOURCES" + ]), "Building $TARGET"), + suffix=".bin" + ), + DataToBin=Builder( action=env.VerboseAction(" ".join([ '"$MKSPIFFSTOOL"', @@ -176,47 +169,11 @@ env.Append( ) ) -# Allow user to override via pre:script -if env.get("PROGNAME", "program") == "program": - env.Replace(PROGNAME="firmware") - -# -# Framework and SDK specific configuration -# - -env.Append( - BUILDERS=dict( - ElfToBin=Builder( - action=env.VerboseAction(" ".join([ - '"$PYTHONEXE" "$OBJCOPY"', - "--chip", "esp32", - "elf2image", - "--flash_mode", "$BOARD_FLASH_MODE", - "--flash_freq", "${__get_board_f_flash(__env__)}", - "--flash_size", - env.BoardConfig().get("upload.flash_size", "detect"), - "-o", "$TARGET", "$SOURCES" - ]), "Building $TARGET"), - suffix=".bin" - ) - ) -) - -if env.subst("$PIOFRAMEWORK") == "arduino": - # Handle uploading via OTA - ota_port = None - if env.get("UPLOAD_PORT"): - ota_port = re.match( - r"\"?((([0-9]{1,3}\.){3}[0-9]{1,3})|.+\.local)\"?$", - env.get("UPLOAD_PORT")) - if ota_port: - env.Replace(UPLOADCMD="$UPLOADOTACMD") # # Target: Build executable and linkable firmware or SPIFFS image # - target_elf = env.BuildProgram() if "nobuild" in COMMAND_LINE_TARGETS: if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): @@ -231,32 +188,12 @@ else: AlwaysBuild(target_firm) AlwaysBuild(env.Alias("buildfs", target_firm)) else: - target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf) + target_firm = env.ElfToBin( + join("$BUILD_DIR", "${PROGNAME}"), target_elf) AlwaysBuild(env.Alias("nobuild", target_firm)) target_buildprog = env.Alias("buildprog", target_firm, target_firm) -# -# Replace default upload flags -# - -if "uploadfs" in COMMAND_LINE_TARGETS: - env.Replace( - UPLOADERFLAGS=[ - "--chip", "esp32", - "--port", '"$UPLOAD_PORT"', - "--baud", "$UPLOAD_SPEED", - "--before", "default_reset", - "--after", "hard_reset", - "write_flash", "-z", - "--flash_mode", "$BOARD_FLASH_MODE", - "--flash_size", "detect", - "${int(SPIFFS_START, 16)}" - ] - ) - - env.Append(UPLOADEROTAFLAGS=["-s"]) - # # Target: Print binary size # @@ -270,11 +207,98 @@ AlwaysBuild(target_size) # Target: Upload firmware or SPIFFS image # -target_upload = env.Alias( - ["upload", "uploadfs"], target_firm, - [env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."), - env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]) -env.AlwaysBuild(target_upload) +upload_protocol = env.subst("$UPLOAD_PROTOCOL") +debug_tools = env.BoardConfig().get("debug.tools", {}) +upload_actions = [] + +if upload_protocol == "esptool": + env.Replace( + UPLOADER=join( + platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"), + UPLOADEROTA=join(platform.get_package_dir("tool-espotapy") or "", + "espota.py"), + UPLOADERFLAGS=[ + "--chip", "esp32", + "--port", '"$UPLOAD_PORT"', + "--baud", "$UPLOAD_SPEED", + "--before", "default_reset", + "--after", "hard_reset", + "write_flash", "-z", + "--flash_mode", "${__get_board_flash_mode(__env__)}", + "--flash_freq", "${__get_board_f_flash(__env__)}", + "--flash_size", "detect" + ], + UPLOADEROTAFLAGS=[ + "--debug", + "--progress", + "-i", "$UPLOAD_PORT", + "-p", "3232", + "$UPLOAD_FLAGS" + ], + + UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $EXTRA_ESPTOOL_UPLOADFLAGS $SOURCE', + UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', + ) + + if env.subst("$PIOFRAMEWORK") == "arduino": + # Handle uploading via OTA + ota_port = None + if env.get("UPLOAD_PORT"): + ota_port = re.match( + r"\"?((([0-9]{1,3}\.){3}[0-9]{1,3})|.+\.local)\"?$", + env.get("UPLOAD_PORT")) + if ota_port: + env.Replace(UPLOADCMD="$UPLOADOTACMD") + + if "uploadfs" in COMMAND_LINE_TARGETS: + env.Replace( + UPLOADERFLAGS=[ + "--chip", "esp32", + "--port", '"$UPLOAD_PORT"', + "--baud", "$UPLOAD_SPEED", + "--before", "default_reset", + "--after", "hard_reset", + "write_flash", "-z", + "--flash_mode", "$BOARD_FLASH_MODE", + "--flash_size", "detect", + "${int(SPIFFS_START, 16)}" + ] + ) + env.Append(UPLOADEROTAFLAGS=["-s"]) + + upload_actions = [ + env.VerboseAction( + env.AutodetectUploadPort, "Looking for upload port..."), + env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE") + ] + +elif upload_protocol in debug_tools: + openocd_dir = platform.get_package_dir("tool-openocd-esp32") or "" + uploader_flags = ["-s", openocd_dir] + uploader_flags.extend(debug_tools.get(upload_protocol).get( + "server").get("arguments", [])) + uploader_flags.extend([ + "-c", + "program_esp32 {{$SOURCE}} 0x10000 verify reset; shutdown;" + ]) + for i, item in enumerate(uploader_flags): + if "$PACKAGE_DIR" in item: + uploader_flags[i] = item.replace("$PACKAGE_DIR",openocd_dir) + + env.Replace( + UPLOADER="openocd", + UPLOADERFLAGS=uploader_flags, + UPLOADCMD="$UPLOADER $UPLOADERFLAGS") + upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")] + +# custom upload tool +elif "UPLOADCMD" in env: + upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")] + +else: + sys.stderr.write("Warning! Unknown upload protocol %s\n" % upload_protocol) + +AlwaysBuild(env.Alias(["upload", "uploadfs"], target_firm, upload_actions)) # # Default targets From 757fdf75c3461d54c9226450e76f0d11d9feb220 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 02:31:11 +0300 Subject: [PATCH 24/38] Make extra images independent from a prog tool --- builder/frameworks/espidf.py | 7 +++---- builder/main.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index a01816c..edc2e90 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -304,10 +304,9 @@ env.Append( "-T", "esp32.rom.spiram_incompatible_fns.ld" ], - EXTRA_ESPTOOL_UPLOADFLAGS=[ - "0x1000", join("$BUILD_DIR", "bootloader.bin"), - "0x8000", join("$BUILD_DIR", "partitions_table.bin"), - "0x10000" + FLASH_EXTRA_IMAGES=[ + ("0x1000", join("$BUILD_DIR", "bootloader.bin")), + ("0x8000", join("$BUILD_DIR", "partitions_table.bin")) ] ) diff --git a/builder/main.py b/builder/main.py index d6f1ed5..e3f6c4e 100644 --- a/builder/main.py +++ b/builder/main.py @@ -236,7 +236,7 @@ if upload_protocol == "esptool": "$UPLOAD_FLAGS" ], - UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $EXTRA_ESPTOOL_UPLOADFLAGS $SOURCE', + UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $FLASH_EXTRA_IMAGES 0x10000 $SOURCE', UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', ) From 982198344c3ef50a5651c2c135778c51208b6dc5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 02:47:54 +0300 Subject: [PATCH 25/38] Switch to PRELOAD/MODIFIED load mode --- platform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.py b/platform.py index 87eaa8c..2703c92 100644 --- a/platform.py +++ b/platform.py @@ -82,8 +82,8 @@ class Espressif32Platform(PlatformBase): "$LOAD_CMD", "pio_reset_halt_target" ], - # "load_cmd": 'preload' - "load_cmd": 'mon program_esp32 "$PROG_DIR/firmware.bin" 0x10000 verify' + "load_cmd": "preload", + "load_mode": "modified" } board.manifest['debug'] = debug From 423117f74d07eaac778ea4e35f5e0c08c4ece1b9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 03:07:32 +0300 Subject: [PATCH 26/38] Flash extra images when external JTAG is used --- builder/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/builder/main.py b/builder/main.py index e3f6c4e..b9c06c6 100644 --- a/builder/main.py +++ b/builder/main.py @@ -278,12 +278,16 @@ elif upload_protocol in debug_tools: uploader_flags.extend(debug_tools.get(upload_protocol).get( "server").get("arguments", [])) uploader_flags.extend([ - "-c", - "program_esp32 {{$SOURCE}} 0x10000 verify reset; shutdown;" + "-c", "program_esp32 {{$SOURCE}} 0x10000 verify" ]) + for image in env.get("FLASH_EXTRA_IMAGES", []): + uploader_flags.extend([ + "-c", "program_esp32 %s %s verify" % (image[1], image[0]) + ]) + uploader_flags.extend(["-c", "reset run; shutdown"]) for i, item in enumerate(uploader_flags): if "$PACKAGE_DIR" in item: - uploader_flags[i] = item.replace("$PACKAGE_DIR",openocd_dir) + uploader_flags[i] = item.replace("$PACKAGE_DIR", openocd_dir) env.Replace( UPLOADER="openocd", From 8f9fd0078a76065ffc3fb2260744bf9412fa7325 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 May 2018 19:24:06 +0300 Subject: [PATCH 27/38] Backward compatibility for obsolete Pumbaa build script --- builder/frameworks/pumbaa.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/builder/frameworks/pumbaa.py b/builder/frameworks/pumbaa.py index 4283113..66d221d 100644 --- a/builder/frameworks/pumbaa.py +++ b/builder/frameworks/pumbaa.py @@ -53,8 +53,18 @@ env.AddMethod(LookupSources) env.AddMethod(VariantDirWrap) env.Replace( - PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-pumbaa") + PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-pumbaa"), + UPLOADERFLAGS=[], # Backward compatibility for obsolete build script ) SConscript( [env.subst(join("$PLATFORMFW_DIR", "make", "platformio.sconscript"))]) + +env.Replace( + FLASH_EXTRA_IMAGES=[ + ("0x1000", join("$PLATFORMFW_DIR", "simba", "3pp", "esp32", + "bin", "bootloader.bin")), + ("0x8000", join("$PLATFORMFW_DIR", "simba", "3pp", "esp32", + "bin", "partitions_singleapp.bin")) + ] +) From 2096d5b350a27137d15aeec2ee5f86c29d861987 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 14 May 2018 15:55:43 -0700 Subject: [PATCH 28/38] Use the actual dev/platform directory when looking for "sdkconfig.h" // Resolve #86 --- builder/frameworks/espidf.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index edc2e90..f8b2a2b 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -100,16 +100,12 @@ def build_component(path): def find_valid_config_file(): search_path = join( - env.subst("$PIOHOME_DIR"), "platforms", - env.subst("$PIOPLATFORM"), "examples", "*", "src", "sdkconfig.h" - ) - + platform.get_dir(), "examples", "*", "src", "sdkconfig.h") files = glob(search_path) if not files: sys.stderr.write( "Error: Could not find default \"sdkconfig.h\" file\n") env.Exit(1) - return files[0] From 442546c3de0a21c3cfe892a90f2d889a5624a11a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 15 May 2018 15:25:04 -0700 Subject: [PATCH 29/38] Default debugging configuration for ESP-WROVER-KIT --- boards/esp-wrover-kit.json | 5 ++++- platform.py | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/boards/esp-wrover-kit.json b/boards/esp-wrover-kit.json index f320644..107cf9b 100644 --- a/boards/esp-wrover-kit.json +++ b/boards/esp-wrover-kit.json @@ -22,7 +22,9 @@ "can" ], "debug": { - "openocd_board": "esp32-wrover.cfg" + "openocd_board": "esp32-wrover.cfg", + "onboard_tools": ["ft2232h"], + "default_tools": ["ft2232h"] }, "frameworks": [ "arduino", @@ -38,6 +40,7 @@ "protocol": "esptool", "protocols": [ "esptool", + "ft2232h", "olimex-arm-usb-tiny-h", "olimex-arm-usb-ocd-h", "minimodule" diff --git a/platform.py b/platform.py index 2703c92..07b2973 100644 --- a/platform.py +++ b/platform.py @@ -45,7 +45,8 @@ class Espressif32Platform(PlatformBase): debug['tools'] = {} available_tools = ( - "olimex-arm-usb-ocd-h", "olimex-arm-usb-tiny-h", "minimodule" + "ft2232h", "minimodule", + "olimex-arm-usb-ocd-h", "olimex-arm-usb-tiny-h" ) # Only FTDI based debug probes @@ -53,12 +54,15 @@ class Espressif32Platform(PlatformBase): if link not in upload_protocols or link in debug['tools']: continue - ftdi_interface = "mbftdi" if link == "minimodule" else link + openocd_board = debug.get("openocd_board") + openocd_interface = "mbftdi" if link == "minimodule" else link + if board == "esp-wrover-kit": + openocd_interface = "esp32_devkitj_v1" server_args = [ "-s", "$PACKAGE_DIR/share/openocd/scripts", - "-f", "share/openocd/scripts/interface/ftdi/%s.cfg" % ftdi_interface, - "-f", "share/openocd/scripts/board/%s" % debug.get("openocd_board") + "-f", "share/openocd/scripts/interface/ftdi/%s.cfg" % openocd_interface, + "-f", "share/openocd/scripts/board/%s" % openocd_board ] debug['tools'][link] = { @@ -83,7 +87,10 @@ class Espressif32Platform(PlatformBase): "pio_reset_halt_target" ], "load_cmd": "preload", - "load_mode": "modified" + "load_mode": "modified", + "onboard": link in debug.get("onboard_tools", []), + "default": link in debug.get("default_tools", []) + } board.manifest['debug'] = debug From 5be3821691491ee80a7ab8a79c98bea603767a15 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 15 May 2018 17:35:22 -0700 Subject: [PATCH 30/38] Escape a path for flash extra images // Resolve #79 --- builder/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/builder/main.py b/builder/main.py index b9c06c6..ba0b5cb 100644 --- a/builder/main.py +++ b/builder/main.py @@ -236,9 +236,11 @@ if upload_protocol == "esptool": "$UPLOAD_FLAGS" ], - UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $FLASH_EXTRA_IMAGES 0x10000 $SOURCE', + UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS 0x10000 $SOURCE', UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', ) + for image in env.get("FLASH_EXTRA_IMAGES", []): + env.Append(UPLOADERFLAGS=[image[0], '"%s"' % image[1]]) if env.subst("$PIOFRAMEWORK") == "arduino": # Handle uploading via OTA @@ -278,11 +280,11 @@ elif upload_protocol in debug_tools: uploader_flags.extend(debug_tools.get(upload_protocol).get( "server").get("arguments", [])) uploader_flags.extend([ - "-c", "program_esp32 {{$SOURCE}} 0x10000 verify" + "-c", 'program_esp32 "{{$SOURCE}}" 0x10000 verify' ]) for image in env.get("FLASH_EXTRA_IMAGES", []): uploader_flags.extend([ - "-c", "program_esp32 %s %s verify" % (image[1], image[0]) + "-c", 'program_esp32 "%s" %s verify' % (image[1], image[0]) ]) uploader_flags.extend(["-c", "reset run; shutdown"]) for i, item in enumerate(uploader_flags): From fb1c8d18e07c86fa23854c808d4c672a9956a888 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 15 May 2018 17:51:26 -0700 Subject: [PATCH 31/38] Fix typo --- platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.py b/platform.py index 07b2973..c9210a4 100644 --- a/platform.py +++ b/platform.py @@ -56,7 +56,7 @@ class Espressif32Platform(PlatformBase): openocd_board = debug.get("openocd_board") openocd_interface = "mbftdi" if link == "minimodule" else link - if board == "esp-wrover-kit": + if board.id == "esp-wrover-kit": openocd_interface = "esp32_devkitj_v1" server_args = [ From 1ea5afdd653bf488fc66440b648fa1cbdb813e2e Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Mon, 21 May 2018 22:08:26 +0300 Subject: [PATCH 32/38] Add custom UPLOADCMD command for SPIFFS // Issue #62 --- builder/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index ba0b5cb..380abd7 100644 --- a/builder/main.py +++ b/builder/main.py @@ -264,7 +264,8 @@ if upload_protocol == "esptool": "--flash_mode", "$BOARD_FLASH_MODE", "--flash_size", "detect", "${int(SPIFFS_START, 16)}" - ] + ], + UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE', ) env.Append(UPLOADEROTAFLAGS=["-s"]) From 87017533e7b3df2764363e1112c40eace5c1932d Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Thu, 24 May 2018 23:38:54 +0300 Subject: [PATCH 33/38] Fix upload flags when there is a space in path // Issue #79 --- builder/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index 380abd7..56e5fe2 100644 --- a/builder/main.py +++ b/builder/main.py @@ -240,7 +240,7 @@ if upload_protocol == "esptool": UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', ) for image in env.get("FLASH_EXTRA_IMAGES", []): - env.Append(UPLOADERFLAGS=[image[0], '"%s"' % image[1]]) + env.Append(UPLOADERFLAGS=[image[0], "%s" % image[1]]) if env.subst("$PIOFRAMEWORK") == "arduino": # Handle uploading via OTA From 9080ace7acb81dccabfb6f58927bb2fc56431dba Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 25 May 2018 16:55:24 +0300 Subject: [PATCH 34/38] Minor fixes --- boards/esp32vn-iot-uno.json | 2 +- builder/main.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/esp32vn-iot-uno.json b/boards/esp32vn-iot-uno.json index 81fa9c2..0997da8 100644 --- a/boards/esp32vn-iot-uno.json +++ b/boards/esp32vn-iot-uno.json @@ -7,7 +7,7 @@ "flash_mode": "dio", "ldscript": "esp32_out.ld", "mcu": "esp32", - "variant": "esp32vn-iot-uno" + "variant": "esp32vn_iot_uno" }, "connectivity": [ "wifi", diff --git a/builder/main.py b/builder/main.py index 56e5fe2..d7016dd 100644 --- a/builder/main.py +++ b/builder/main.py @@ -89,8 +89,8 @@ env.Replace( CFLAGS=["-std=gnu99"], CCFLAGS=[ - "%s" % "-Os" if env.subst("$PIOFRAMEWORK") == "arduino" else "-Og", - "-g3", + "-Os", + "-Wall", "-nostdlib", "-Wpointer-arith", "-Wno-error=unused-but-set-variable", From fd9ed71c4f32351e908eed0ad8f1920d0c7b4c12 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 26 May 2018 01:13:54 +0300 Subject: [PATCH 35/38] Custom Partition Tables // Resolve #58 --- boards/nina_w10.json | 2 +- builder/frameworks/espidf.py | 17 +++---- builder/frameworks/pumbaa.py | 2 +- builder/frameworks/simba.py | 22 ++++---- builder/main.py | 97 +++++++++++++++++++++++++++--------- 5 files changed, 95 insertions(+), 45 deletions(-) diff --git a/boards/nina_w10.json b/boards/nina_w10.json index 237596c..91ca4d7 100644 --- a/boards/nina_w10.json +++ b/boards/nina_w10.json @@ -7,7 +7,7 @@ "flash_mode": "dio", "ldscript": "esp32_out.ld", "mcu": "esp32", - "partitions": "minimal", + "partitions": "minimal.csv", "variant": "nina_w10" }, "connectivity": [ diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index f8b2a2b..6beaace 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -302,7 +302,7 @@ env.Append( FLASH_EXTRA_IMAGES=[ ("0x1000", join("$BUILD_DIR", "bootloader.bin")), - ("0x8000", join("$BUILD_DIR", "partitions_table.bin")) + ("0x8000", join("$BUILD_DIR", "partitions.bin")) ] ) @@ -339,17 +339,16 @@ else: # Generate partition table # -# Export path to the partitions table +fwpartitions_dir = join(FRAMEWORK_DIR, "components", "partition_table") +partitions_csv = env.BoardConfig().get("build.partitions", + "partitions_singleapp.csv") env.Replace( - PARTITION_TABLE_CSV=join( - FRAMEWORK_DIR, "components", "partition_table", - "%s.csv" % env.BoardConfig().get("build.partitions", "partitions_singleapp") - ) -) + PARTITIONS_TABLE_CSV=join(fwpartitions_dir, partitions_csv) if isfile( + join(fwpartitions_dir, partitions_csv)) else partitions_csv) partition_table = env.Command( - join("$BUILD_DIR", "partitions_table.bin"), - "$PARTITION_TABLE_CSV", + join("$BUILD_DIR", "partitions.bin"), + "$PARTITIONS_TABLE_CSV", env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join( FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py"), "Generating partitions $TARGET")) diff --git a/builder/frameworks/pumbaa.py b/builder/frameworks/pumbaa.py index 66d221d..c9b77c0 100644 --- a/builder/frameworks/pumbaa.py +++ b/builder/frameworks/pumbaa.py @@ -54,7 +54,7 @@ env.AddMethod(VariantDirWrap) env.Replace( PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-pumbaa"), - UPLOADERFLAGS=[], # Backward compatibility for obsolete build script + UPLOADERFLAGS=[] # Backward compatibility for obsolete build script ) SConscript( diff --git a/builder/frameworks/simba.py b/builder/frameworks/simba.py index c854e38..0def12d 100644 --- a/builder/frameworks/simba.py +++ b/builder/frameworks/simba.py @@ -51,18 +51,18 @@ env.AddMethod(LookupSources) env.AddMethod(VariantDirWrap) env.Replace( - PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-simba") -) - -env.Append( - UPLOADERFLAGS=[ - "0x1000", join("$PLATFORMFW_DIR", "3pp", "esp32", - "bin", "bootloader.bin"), - "0x4000", join("$PLATFORMFW_DIR", "3pp", "esp32", - "bin", "partitions_singleapp.bin"), - "0x10000" - ] + PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-simba"), + UPLOADERFLAGS=[] # Backward compatibility for obsolete build script ) SConscript( [env.subst(join("$PLATFORMFW_DIR", "make", "platformio.sconscript"))]) + +env.Replace( + FLASH_EXTRA_IMAGES=[ + ("0x1000", join("$PLATFORMFW_DIR", "3pp", "esp32", + "bin", "bootloader.bin")), + ("0x8000", join("$PLATFORMFW_DIR", "3pp", "esp32", + "bin", "partitions_singleapp.bin")) + ] +) diff --git a/builder/main.py b/builder/main.py index d7016dd..7159caa 100644 --- a/builder/main.py +++ b/builder/main.py @@ -20,6 +20,10 @@ from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) +# +# Helpers +# + def _get_board_f_flash(env): frequency = env.subst("$BOARD_F_FLASH") frequency = str(frequency).replace("L", "") @@ -34,30 +38,73 @@ def _get_board_flash_mode(env): return "dout" return mode + +def _parse_size(value): + if value.isdigit(): + return int(value) + elif value.startswith("0x"): + return int(value, 16) + elif value[-1] in ("K", "M"): + base = 1024 if value[-1] == "K" else 1024 * 1024 + return int(value[:-1]) * base + return value + + +def _parse_partitions(env): + partitions_csv = env.subst("$PARTITIONS_TABLE_CSV") + if not isfile(partitions_csv): + sys.stderr.write("Could not find the file %s with partitions " + "table.\n" % partitions_csv) + env.Exit(1) + + result = [] + with open(partitions_csv) as fp: + for line in fp.readlines(): + line = line.strip() + if not line or line.startswith("#"): + continue + tokens = [t.strip() for t in line.split(",") if t.strip()] + if len(tokens) < 5: + continue + result.append({ + "name": tokens[0], + "type": tokens[1], + "subtype": tokens[2], + "offset": tokens[3], + "size": tokens[4], + "flags": tokens[5] if len(tokens) > 5 else None + }) + return result + + +def _update_max_upload_size(env): + if not env.get("PARTITIONS_TABLE_CSV"): + return + sizes = [ + _parse_size(p['size']) for p in _parse_partitions(env) + if p['type'] in ("0", "app") + ] + if sizes: + env.BoardConfig().update("upload.maximum_size", max(sizes)) + + # # SPIFFS helpers # def fetch_spiffs_size(env): - path_to_patition_table = env.get("PARTITION_TABLE_CSV") - if not isfile(path_to_patition_table): - sys.stderr.write("Could not find the file %s with paritions table." % - path_to_patition_table) - env.Exit(1) - - with open(path_to_patition_table) as fp: - for l in fp.readlines(): - if l.startswith("spiffs"): - spiffs_config = [s.strip() for s in l.split(",")] - env["SPIFFS_START"] = spiffs_config[3] - env["SPIFFS_SIZE"] = spiffs_config[4] - env["SPIFFS_PAGE"] = "0x100" - env["SPIFFS_BLOCK"] = "0x1000" - return - - sys.stderr.write("Could not find the spiffs section in the paritions " - "file %s" % path_to_patition_table) - env.Exit(1) + spiffs = None + for p in _parse_partitions(env): + if p['type'] == "data" and p['subtype'] == "spiffs": + spiffs = p + if not spiffs: + sys.stderr.write( + env.subst("Could not find the `spiffs` section in the partitions " + "table $PARTITIONS_TABLE_CSV\n")) + env["SPIFFS_START"] = _parse_size(spiffs['offset']) + env["SPIFFS_SIZE"] = _parse_size(spiffs['size']) + env["SPIFFS_PAGE"] = int("0x100", 16) + env["SPIFFS_BLOCK"] = int("0x1000", 16) def __fetch_spiffs_size(target, source, env): @@ -157,9 +204,9 @@ env.Append( action=env.VerboseAction(" ".join([ '"$MKSPIFFSTOOL"', "-c", "$SOURCES", - "-p", "${int(SPIFFS_PAGE, 16)}", - "-b", "${int(SPIFFS_BLOCK, 16)}", - "-s", "${int(SPIFFS_SIZE, 16)}", + "-p", "$SPIFFS_PAGE", + "-b", "$SPIFFS_BLOCK", + "-s", "$SPIFFS_SIZE", "$TARGET" ]), "Building SPIFFS image from '$SOURCES' directory to $TARGET"), emitter=__fetch_spiffs_size, @@ -194,6 +241,10 @@ else: AlwaysBuild(env.Alias("nobuild", target_firm)) target_buildprog = env.Alias("buildprog", target_firm, target_firm) +# update max upload size based on CSV file +if "upload" in COMMAND_LINE_TARGETS: + _update_max_upload_size(env) + # # Target: Print binary size # @@ -263,7 +314,7 @@ if upload_protocol == "esptool": "write_flash", "-z", "--flash_mode", "$BOARD_FLASH_MODE", "--flash_size", "detect", - "${int(SPIFFS_START, 16)}" + "$SPIFFS_START" ], UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE', ) From 139a97b50966d3337d283ad5bdf36f7ed5d25c5b Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Wed, 30 May 2018 00:06:09 +0300 Subject: [PATCH 36/38] Add initial support for exceptions in ESP-IDF framework // Issue #88 --- .travis.yml | 1 + appveyor.yml | 1 + builder/frameworks/espidf.py | 24 ++- examples/espidf-exceptions/.gitignore | 3 + examples/espidf-exceptions/.travis.yml | 65 ++++++ examples/espidf-exceptions/README.rst | 38 ++++ examples/espidf-exceptions/lib/readme.txt | 38 ++++ examples/espidf-exceptions/platformio.ini | 26 +++ examples/espidf-exceptions/src/main.cpp | 15 ++ examples/espidf-exceptions/src/sdkconfig.h | 223 +++++++++++++++++++++ 10 files changed, 433 insertions(+), 1 deletion(-) create mode 100644 examples/espidf-exceptions/.gitignore create mode 100644 examples/espidf-exceptions/.travis.yml create mode 100644 examples/espidf-exceptions/README.rst create mode 100644 examples/espidf-exceptions/lib/readme.txt create mode 100644 examples/espidf-exceptions/platformio.ini create mode 100644 examples/espidf-exceptions/src/main.cpp create mode 100644 examples/espidf-exceptions/src/sdkconfig.h diff --git a/.travis.yml b/.travis.yml index de393fb..a76e910 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: - PLATFORMIO_PROJECT_DIR=examples/arduino-wifiscan - PLATFORMIO_PROJECT_DIR=examples/espidf-ble-adv - PLATFORMIO_PROJECT_DIR=examples/espidf-coap-server + - PLATFORMIO_PROJECT_DIR=examples/espidf-exceptions - PLATFORMIO_PROJECT_DIR=examples/espidf-hello-world - PLATFORMIO_PROJECT_DIR=examples/espidf-http-request - PLATFORMIO_PROJECT_DIR=examples/espidf-peripherals-uart diff --git a/appveyor.yml b/appveyor.yml index 0baa9ee..54477b0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,6 +6,7 @@ environment: - PLATFORMIO_PROJECT_DIR: "examples/arduino-wifiscan" - PLATFORMIO_PROJECT_DIR: "examples/espidf-ble-adv" - PLATFORMIO_PROJECT_DIR: "examples/espidf-coap-server" + - PLATFORMIO_PROJECT_DIR: "examples/espidf-exceptions" - PLATFORMIO_PROJECT_DIR: "examples/espidf-hello-world" - PLATFORMIO_PROJECT_DIR: "examples/espidf-http-request" - PLATFORMIO_PROJECT_DIR: "examples/espidf-peripherals-uart" diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 6beaace..b5b6a21 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -293,7 +293,6 @@ env.Append( LINKFLAGS=[ "-u", "__cxa_guard_dummy", "-u", "ld_include_panic_highint_hdl", - "-u", "__cxx_fatal_exception", "-T", "esp32.common.ld", "-T", "esp32.rom.ld", "-T", "esp32.peripherals.ld", @@ -307,6 +306,29 @@ env.Append( ) +if "PIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS" in env.Flatten( + env.get("CPPDEFINES", [])): + + # remove unnecessary flag defined in main.py that disables exceptions + try: + index = env['CXXFLAGS'].index("-fno-exceptions") + if index > 0: + env['CXXFLAGS'].remove("-fno-exceptions") + except IndexError: + pass + + env.Append( + CPPDEFINES=[ + ("CONFIG_CXX_EXCEPTIONS", 1), + ("CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE", 0) + ], + + CXXFLAGS=["-fexceptions"] + ) + +else: + env.Append(LINKFLAGS=["-u", "__cxx_fatal_exception"]) + # # Handle missing sdkconfig.h # diff --git a/examples/espidf-exceptions/.gitignore b/examples/espidf-exceptions/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/espidf-exceptions/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/espidf-exceptions/.travis.yml b/examples/espidf-exceptions/.travis.yml new file mode 100644 index 0000000..2c4ff5c --- /dev/null +++ b/examples/espidf-exceptions/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/page/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/page/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/page/userguide/cmd_ci.html > +# +# +# Please choice one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/espidf-exceptions/README.rst b/examples/espidf-exceptions/README.rst new file mode 100644 index 0000000..c8e1759 --- /dev/null +++ b/examples/espidf-exceptions/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present PlatformIO + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO Core `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-espressif32/examples/espidf-exceptions + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e esp32dev + + # Upload firmware for the specific environment + > platformio run -e esp32dev --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/espidf-exceptions/lib/readme.txt b/examples/espidf-exceptions/lib/readme.txt new file mode 100644 index 0000000..6581e73 --- /dev/null +++ b/examples/espidf-exceptions/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organised `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/page/projectconf.html#lib-install + diff --git a/examples/espidf-exceptions/platformio.ini b/examples/espidf-exceptions/platformio.ini new file mode 100644 index 0000000..6ace92b --- /dev/null +++ b/examples/espidf-exceptions/platformio.ini @@ -0,0 +1,26 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter, extra scripting +; Upload options: custom port, speed and extra flags +; Library options: dependencies, extra library storages +; +; Please visit documentation for the other options and examples +; http://docs.platformio.org/page/projectconf.html + +[env:esp32dev] +platform = espressif32 +framework = espidf +board = esp32dev +build_flags = -DPIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS + +[env:quantum] +platform = espressif32 +framework = espidf +board = quantum +build_flags = -DPIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS + +[env:lolin32] +platform = espressif32 +framework = espidf +board = lolin32 +build_flags = -DPIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS diff --git a/examples/espidf-exceptions/src/main.cpp b/examples/espidf-exceptions/src/main.cpp new file mode 100644 index 0000000..ca28ed5 --- /dev/null +++ b/examples/espidf-exceptions/src/main.cpp @@ -0,0 +1,15 @@ +#include "esp_log.h" +#define tag "ExceptionsTest" + +extern "C" void app_main(void) +{ + ESP_LOGI(tag, "Before try"); + try { + ESP_LOGI(tag, "Before throw"); + throw false; + ESP_LOGI(tag, "After throw"); + } catch ( bool val ){ + ESP_LOGI(tag, "catch"); + } + ESP_LOGI(tag, "After try"); +} \ No newline at end of file diff --git a/examples/espidf-exceptions/src/sdkconfig.h b/examples/espidf-exceptions/src/sdkconfig.h new file mode 100644 index 0000000..67391da --- /dev/null +++ b/examples/espidf-exceptions/src/sdkconfig.h @@ -0,0 +1,223 @@ +/* + * + * Automatically generated file; DO NOT EDIT. + * Espressif IoT Development Framework Configuration + * + */ +#define CONFIG_GATTC_ENABLE 1 +#define CONFIG_ESP32_PHY_MAX_TX_POWER 20 +#define CONFIG_TRACEMEM_RESERVE_DRAM 0x0 +#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 +#define CONFIG_BLE_SMP_ENABLE 1 +#define CONFIG_FATFS_LFN_NONE 1 +#define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_FATFS_CODEPAGE_437 1 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 +#define CONFIG_TCP_WND_DEFAULT 5744 +#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 +#define CONFIG_IPC_TASK_STACK_SIZE 1024 +#define CONFIG_FATFS_PER_FILE_CACHE 1 +#define CONFIG_ESPTOOLPY_FLASHFREQ "40m" +#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 +#define CONFIG_UDP_RECVMBOX_SIZE 6 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_MBEDTLS_AES_C 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1 +#define CONFIG_MBEDTLS_GCM_C 1 +#define CONFIG_ESPTOOLPY_FLASHSIZE "2MB" +#define CONFIG_HEAP_POISONING_DISABLED 1 +#define CONFIG_SPIFFS_CACHE_WR 1 +#define CONFIG_BROWNOUT_DET_LVL_SEL_0 1 +#define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER 1 +#define CONFIG_SPIFFS_CACHE 1 +#define CONFIG_INT_WDT 1 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 +#define CONFIG_MBEDTLS_ECDSA_C 1 +#define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 +#define CONFIG_LOG_BOOTLOADER_LEVEL_INFO 1 +#define CONFIG_ESPTOOLPY_FLASHSIZE_2MB 1 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0 +#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_MBEDTLS_ECDH_C 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1 +#define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10 +#define CONFIG_MBEDTLS_SSL_ALPN 1 +#define CONFIG_MBEDTLS_PEM_WRITE_C 1 +#define CONFIG_LOG_DEFAULT_LEVEL_INFO 1 +#define CONFIG_BT_RESERVE_DRAM 0x10000 +#define CONFIG_FATFS_FS_LOCK 0 +#define CONFIG_IP_LOST_TIMER_INTERVAL 120 +#define CONFIG_SPIFFS_META_LENGTH 4 +#define CONFIG_ESP32_PANIC_PRINT_REBOOT 1 +#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1 +#define CONFIG_CONSOLE_UART_BAUDRATE 115200 +#define CONFIG_LWIP_MAX_SOCKETS 10 +#define CONFIG_LWIP_NETIF_LOOPBACK 1 +#define CONFIG_EMAC_TASK_PRIORITY 20 +#define CONFIG_TIMER_TASK_STACK_DEPTH 2048 +#define CONFIG_TCP_MSS 1436 +#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 +#define CONFIG_FATFS_CODEPAGE 437 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_160 1 +#define CONFIG_ULP_COPROC_RESERVE_MEM 0 +#define CONFIG_LWIP_MAX_UDP_PCBS 16 +#define CONFIG_ESPTOOLPY_BAUD 115200 +#define CONFIG_INT_WDT_CHECK_CPU1 1 +#define CONFIG_ADC_CAL_LUT_ENABLE 1 +#define CONFIG_FLASHMODE_DIO 1 +#define CONFIG_ESPTOOLPY_AFTER_RESET 1 +#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1 +#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 +#define CONFIG_TOOLPREFIX "xtensa-esp32-elf-" +#define CONFIG_MBEDTLS_ECP_C 1 +#define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024 +#define CONFIG_MBEDTLS_RC4_DISABLED 1 +#define CONFIG_CONSOLE_UART_NUM 0 +#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 +#define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 +#define CONFIG_ESPTOOLPY_BAUD_115200B 1 +#define CONFIG_TCP_OVERSIZE_MSS 1 +#define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 +#define CONFIG_CONSOLE_UART_DEFAULT 1 +#define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 +#define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 +#define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1 +#define CONFIG_TIMER_TASK_STACK_SIZE 3584 +#define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1 +#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 +#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 +#define CONFIG_SPIFFS_USE_MAGIC 1 +#define CONFIG_TCPIP_TASK_STACK_SIZE 2048 +#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1 +#define CONFIG_TASK_WDT 1 +#define CONFIG_MAIN_TASK_STACK_SIZE 3584 +#define CONFIG_SPIFFS_PAGE_CHECK 1 +#define CONFIG_LWIP_MAX_ACTIVE_TCP 16 +#define CONFIG_TASK_WDT_TIMEOUT_S 5 +#define CONFIG_INT_WDT_TIMEOUT_MS 300 +#define CONFIG_ESPTOOLPY_FLASHMODE "dio" +#define CONFIG_BTC_TASK_STACK_SIZE 3072 +#define CONFIG_BLUEDROID_ENABLED 1 +#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1 +#define CONFIG_ESPTOOLPY_BEFORE "default_reset" +#define CONFIG_LOG_DEFAULT_LEVEL 3 +#define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1 +#define CONFIG_TIMER_QUEUE_LENGTH 10 +#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1 +#define CONFIG_FATFS_TIMEOUT_MS 10000 +#define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_CCM_C 1 +#define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20 +#define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024 +#define CONFIG_ESP32_WIFI_TX_BA_WIN 6 +#define CONFIG_ESP32_WIFI_NVS_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1 +#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 +#define CONFIG_DMA_RX_BUF_NUM 10 +#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1 +#define CONFIG_TCP_SYNMAXRTX 6 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1 +#define CONFIG_PYTHON "python" +#define CONFIG_MBEDTLS_ECP_NIST_OPTIM 1 +#define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1 +#define CONFIG_ESPTOOLPY_COMPRESSED 1 +#define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv" +#define CONFIG_TCP_SND_BUF_DEFAULT 5744 +#define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 +#define CONFIG_TCP_MSL 60000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 +#define CONFIG_LWIP_SO_REUSE_RXTOALL 1 +#define CONFIG_PARTITION_TABLE_SINGLE_APP 1 +#define CONFIG_ESP32_WIFI_RX_BA_WIN 6 +#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 +#define CONFIG_SPIFFS_USE_MTIME 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1 +#define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 +#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 +#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 +#define CONFIG_BROWNOUT_DET_LVL 0 +#define CONFIG_MBEDTLS_PEM_PARSE_C 1 +#define CONFIG_SPIFFS_GC_MAX_RUNS 10 +#define CONFIG_ESP32_APPTRACE_DEST_NONE 1 +#define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000 +#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA 1 +#define CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM 32 +#define CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 1 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_MBEDTLS_HARDWARE_AES 1 +#define CONFIG_FREERTOS_HZ 100 +#define CONFIG_LOG_COLORS 1 +#define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1 +#define CONFIG_STACK_CHECK_NONE 1 +#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1 +#define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1 +#define CONFIG_BROWNOUT_DET 1 +#define CONFIG_ESP32_XTAL_FREQ 40 +#define CONFIG_MONITOR_BAUD_115200B 1 +#define CONFIG_LOG_BOOTLOADER_LEVEL 3 +#define CONFIG_MBEDTLS_TLS_ENABLED 1 +#define CONFIG_LWIP_MAX_RAW_PCBS 16 +#define CONFIG_SMP_ENABLE 1 +#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1 +#define CONFIG_SPIFFS_MAX_PARTITIONS 3 +#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1 +#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1 +#define CONFIG_ESPTOOLPY_BEFORE_RESET 1 +#define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 +#define CONFIG_SPIFFS_OBJ_NAME_LEN 32 +#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 +#define CONFIG_TCP_MAXRTX 12 +#define CONFIG_ESPTOOLPY_AFTER "hard_reset" +#define CONFIG_LWIP_SO_REUSE 1 +#define CONFIG_ESP32_XTAL_FREQ_40 1 +#define CONFIG_DMA_TX_BUF_NUM 10 +#define CONFIG_LWIP_MAX_LISTENING_TCP 16 +#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1 +#define CONFIG_WL_SECTOR_SIZE 4096 +#define CONFIG_ESP32_DEBUG_OCDAWARE 1 +#define CONFIG_TIMER_TASK_PRIORITY 1 +#define CONFIG_MBEDTLS_TLS_CLIENT 1 +#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1 +#define CONFIG_BT_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 +#define CONFIG_MONITOR_BAUD 115200 +#define CONFIG_FREERTOS_CORETIMER_0 1 +#define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv" +#define CONFIG_MBEDTLS_HAVE_TIME 1 +#define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1 +#define CONFIG_TCP_QUEUE_OOSEQ 1 +#define CONFIG_GATTS_ENABLE 1 +#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1 +#define CONFIG_MBEDTLS_TLS_SERVER 1 +#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1 +#define CONFIG_FREERTOS_ISR_STACKSIZE 1536 +#define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1 +#define CONFIG_WL_SECTOR_SIZE_4096 1 +#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1 +#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1 +#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1 +#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1 +#define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32 +#define CONFIG_BT_ACL_CONNECTIONS 4 +#define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1 +#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1 +#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 +#define CONFIG_APP_OFFSET 0x10000 +#define CONFIG_MEMMAP_SMP 1 +#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 +#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1 +#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1 +#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 3072 +#define CONFIG_MONITOR_BAUD_OTHER_VAL 115200 +#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1 +#define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0" +#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1 +#define CONFIG_BLUEDROID_PINNED_TO_CORE 0 From 7bf1984f94e553bccf4858c53b47e4681ffc148e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 May 2018 00:25:12 +0300 Subject: [PATCH 37/38] Typo fix --- builder/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builder/main.py b/builder/main.py index 7159caa..f4b3793 100644 --- a/builder/main.py +++ b/builder/main.py @@ -56,6 +56,7 @@ def _parse_partitions(env): sys.stderr.write("Could not find the file %s with partitions " "table.\n" % partitions_csv) env.Exit(1) + return result = [] with open(partitions_csv) as fp: @@ -101,6 +102,8 @@ def fetch_spiffs_size(env): sys.stderr.write( env.subst("Could not find the `spiffs` section in the partitions " "table $PARTITIONS_TABLE_CSV\n")) + env.Exit(1) + return env["SPIFFS_START"] = _parse_size(spiffs['offset']) env["SPIFFS_SIZE"] = _parse_size(spiffs['size']) env["SPIFFS_PAGE"] = int("0x100", 16) From aa064b8b794689c7445537afe3c8a02e9e6c4100 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 May 2018 19:17:20 +0300 Subject: [PATCH 38/38] Bump version to 1.0.0 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index 7384944..fff8d46 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/platformio/platform-espressif32.git" }, - "version": "0.12.0", + "version": "1.0.0", "packageRepositories": [ "https://dl.bintray.com/platformio/dl-packages/manifest.json", "http://dl.platformio.org/packages/manifest.json",