compilation support for IDF4.4.3, plus compiling for ESP32-S3

- Updated ESP32 targets to use IDF 4.4.3 (thanks tasmota!)
- Fixed a compilation problem in ARTI (WLED_FS instead of LITTLEFS)

- Initial compilation support for ESP32-S3. Warning: there are still many problems to be solved before -S3 becomes usable!
- audioreactive: added #ifdef for features not yet supported on ESP32-S3
This commit is contained in:
Frank
2022-09-02 21:29:05 +02:00
parent 66d3802f0f
commit 4162d8fdfa
5 changed files with 112 additions and 12 deletions

View File

@@ -115,6 +115,7 @@ build_flags =
-D DECODE_SONY=true -D DECODE_SONY=true
-D DECODE_SAMSUNG=true -D DECODE_SAMSUNG=true
-D DECODE_LG=true -D DECODE_LG=true
-D DECODE_RC5=true
-DWLED_USE_MY_CONFIG -DWLED_USE_MY_CONFIG
; -D USERMOD_SENSORSTOMQTT ; -D USERMOD_SENSORSTOMQTT
@@ -129,6 +130,7 @@ build_flags_all_features =
build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags} build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags}
build_flags_esp32 = ${common.build_flags} ${esp32.build_flags} build_flags_esp32 = ${common.build_flags} ${esp32.build_flags}
build_flags_esp32s3 = ${common.build_flags} ${esp32s3.build_flags}
ldscript_1m128k = eagle.flash.1m128.ld ldscript_1m128k = eagle.flash.1m128.ld
ldscript_2m512k = eagle.flash.2m512.ld ldscript_2m512k = eagle.flash.2m512.ld
@@ -208,25 +210,30 @@ lib_deps =
makuna/NeoPixelBus @ 2.6.9 makuna/NeoPixelBus @ 2.6.9
[esp32] [esp32]
#platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.3/platform-espressif32-2.0.2.3.zip #platform = espressif32@3.5.0
platform = espressif32@3.5.0 #platform_packages = framework-arduinoespressif32 @ https://github.com/Aircoookie/arduino-esp32.git#1.0.6.4
platform_packages = framework-arduinoespressif32 @ https://github.com/Aircoookie/arduino-esp32.git#1.0.6.4 ;; use latest tasmota framework, including IDF v4.4.3 and arduino-esp32 v2.0.4
framework = arduino
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.4.1/platform-espressif32-2.0.4.1.zip
platform_packages =
build_flags = -g build_flags = -g
-DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32
#-DCONFIG_LITTLEFS_FOR_IDF_3_2 ; -DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D CONFIG_LITTLEFS_SPIFFS_COMPAT=1 -D CONFIG_LITTLEFS_CACHE_SIZE=512
-D WLED_WATCHDOG_TIMEOUT=0
-D CONFIG_ASYNC_TCP_USE_WDT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
#use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x #use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x
-D LOROL_LITTLEFS ; -D LOROL_LITTLEFS
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
; https://github.com/lorol/LITTLEFS.git ; https://github.com/lorol/LITTLEFS.git
; WLEDSR specific: use patched version of lorol LittleFS ; WLEDSR specific: use patched version of lorol LittleFS - unless using IDF v4
https://github.com/softhack007/LITTLEFS-threadsafe.git#master ; https://github.com/softhack007/LITTLEFS-threadsafe.git#master
makuna/NeoPixelBus @ 2.6.9 makuna/NeoPixelBus @ 2.6.9
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
@@ -236,6 +243,7 @@ build_flags = -g
-DARDUINO_ARCH_ESP32S2 -DARDUINO_ARCH_ESP32S2
-DCONFIG_IDF_TARGET_ESP32S2 -DCONFIG_IDF_TARGET_ESP32S2
-D CONFIG_ASYNC_TCP_USE_WDT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
-D WLED_NO_I2S1_BUS
-DCO -DCO
lib_deps = lib_deps =
@@ -243,12 +251,35 @@ lib_deps =
makuna/NeoPixelBus @ 2.6.9 makuna/NeoPixelBus @ 2.6.9
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
[esp32s3]
build_flags = -g
-DESP32
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32S3
-DCONFIG_IDF_TARGET_ESP32S3
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D CONFIG_LITTLEFS_SPIFFS_COMPAT=1 -D CONFIG_LITTLEFS_CACHE_SIZE=512
-D WLED_NO_I2S0_BUS
-D WLED_NO_I2S1_BUS
-D WLED_RELEASE_NAME=ESP32S3 -D WLED_DISABLE_BROWNOUT_DET -D WLED_WATCHDOG_TIMEOUT=0
-D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0
-DCO
lib_deps =
${env.lib_deps}
https://github.com/Makuna/NeoPixelBus.git#master @ 2.7.0
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
[esp32c3] [esp32c3]
build_flags = -g build_flags = -g
-DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32C3 -DARDUINO_ARCH_ESP32C3
-DCONFIG_IDF_TARGET_ESP32C3 -DCONFIG_IDF_TARGET_ESP32C3
-D CONFIG_ASYNC_TCP_USE_WDT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
-D WLED_NO_I2S0_BUS
-D WLED_NO_I2S1_BUS
-DCO -DCO
lib_deps = lib_deps =
@@ -444,6 +475,26 @@ lib_deps = ${esp8266.lib_deps}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# custom board configurations # custom board configurations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:esp32s3-mdev]
board = esp32-s3-devkitc-1
platform = ${esp32.platform}
upload_speed = 460800 ; or 921600
platform_packages = ${esp32.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32s3}
-D WLED_RELEASE_NAME=ESP32S3 #-D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
-D USERMOD_AUDIOREACTIVE
-D UM_AUDIOREACTIVE_USE_NEW_FFT
-D USERMOD_CUSTOMEFFECTS
lib_deps = ${esp32s3.lib_deps}
; https://github.com/blazoncek/arduinoFFT.git ; arduinoFFT @ 1.5.6
https://github.com/kosme/arduinoFFT#develop @ 1.9.2
board_build.partitions = tools/WLED_ESP32_8MB.csv
board_build.f_flash = 80000000L
board_build.flash_mode = dio
[env:esp32mdev] [env:esp32mdev]
board = esp32dev board = esp32dev

View File

@@ -917,6 +917,12 @@ class AudioReactive : public Usermod {
delay(100); // Give that poor microphone some time to setup. delay(100); // Give that poor microphone some time to setup.
switch (dmType) { switch (dmType) {
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
// stub cases for not-yet-supported I2S modes on other ESP32 chips
case 0: //ADC analog
case 3: //MCLK
case 4: //SPH0645
#endif
case 1: case 1:
DEBUGSR_PRINT(F("AR: Generic I2S Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); DEBUGSR_PRINT(F("AR: Generic I2S Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE);
@@ -929,24 +935,32 @@ class AudioReactive : public Usermod {
delay(100); delay(100);
if (audioSource) audioSource->initialize(sdaPin, sclPin, i2swsPin, i2ssdPin, i2sckPin, mclkPin); if (audioSource) audioSource->initialize(sdaPin, sclPin, i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break; break;
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// SPH0645 is currently only possible on "classic" ESP32
case 3: case 3:
DEBUGSR_PRINT(F("AR: SPH0645 Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); DEBUGSR_PRINT(F("AR: SPH0645 Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
audioSource = new SPH0654(SAMPLE_RATE, BLOCK_SIZE); audioSource = new SPH0654(SAMPLE_RATE, BLOCK_SIZE);
delay(100); delay(100);
audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin); audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin);
break; break;
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// MCLK routing currently only works on "classic" ESP32
case 4: case 4:
DEBUGSR_PRINT(F("AR: Generic I2S Microphone with Master Clock - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); DEBUGSR_PRINT(F("AR: Generic I2S Microphone with Master Clock - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE);
delay(100); delay(100);
if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin); if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break; break;
#endif
case 5: case 5:
DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE);
delay(100); delay(100);
if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin); if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin);
break; break;
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// ADC over I2S is only possible on "classic" ESP32
case 0: case 0:
default: default:
DEBUGSR_PRINTLN(F("AR: Analog Microphone (left channel only).")); DEBUGSR_PRINTLN(F("AR: Analog Microphone (left channel only)."));
@@ -954,6 +968,7 @@ class AudioReactive : public Usermod {
delay(100); delay(100);
if (audioSource) audioSource->initialize(audioPin); if (audioSource) audioSource->initialize(audioPin);
break; break;
#endif
} }
delay(250); // give microphone enough time to initialise delay(250); // give microphone enough time to initialise
@@ -1481,11 +1496,15 @@ class AudioReactive : public Usermod {
void appendConfigData() void appendConfigData()
{ {
oappend(SET_F("dd=addDropdown('AudioReactive','digitalmic:type');")); oappend(SET_F("dd=addDropdown('AudioReactive','digitalmic:type');"));
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
oappend(SET_F("addOption(dd,'Generic Analog',0);")); oappend(SET_F("addOption(dd,'Generic Analog',0);"));
#endif
oappend(SET_F("addOption(dd,'Generic I2S',1);")); oappend(SET_F("addOption(dd,'Generic I2S',1);"));
oappend(SET_F("addOption(dd,'ES7243',2);")); oappend(SET_F("addOption(dd,'ES7243',2);"));
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
oappend(SET_F("addOption(dd,'SPH0654',3);")); oappend(SET_F("addOption(dd,'SPH0654',3);"));
oappend(SET_F("addOption(dd,'Generic I2S with Mclk',4);")); oappend(SET_F("addOption(dd,'Generic I2S with Mclk',4);"));
#endif
oappend(SET_F("addOption(dd,'Generic I2S PDM',5);")); oappend(SET_F("addOption(dd,'Generic I2S PDM',5);"));
oappend(SET_F("dd=addDropdown('AudioReactive','cfg:AGC');")); oappend(SET_F("dd=addDropdown('AudioReactive','cfg:AGC');"));
oappend(SET_F("addOption(dd,'Off',0);")); oappend(SET_F("addOption(dd,'Off',0);"));

View File

@@ -13,6 +13,11 @@
//#include <driver/i2s_pdm.h> //#include <driver/i2s_pdm.h>
//#include <driver/gpio.h> //#include <driver/gpio.h>
// see https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/chip-series-comparison.html#related-documents
// and https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/i2s.html#overview-of-all-modes
#if defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32S2)
#error This audio reactive usermod does not support the ESP32-C2 or ESP32-S2, because the device has too limited I2S capabilities
#endif
/* ToDo: remove. ES7243 is controlled via compiler defines /* ToDo: remove. ES7243 is controlled via compiler defines
Until this configuration is moved to the webinterface Until this configuration is moved to the webinterface
@@ -222,6 +227,9 @@ class I2SSource : public AudioSource {
protected: protected:
void _routeMclk(int8_t mclkPin) { void _routeMclk(int8_t mclkPin) {
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// this way of MCLK routing only works on "classic" ESP32
/* Enable the mclk routing depending on the selected mclk pin /* Enable the mclk routing depending on the selected mclk pin
Only I2S_NUM_0 is supported Only I2S_NUM_0 is supported
*/ */
@@ -235,6 +243,9 @@ class I2SSource : public AudioSource {
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2);
WRITE_PERI_REG(PIN_CTRL, 0xFF00); WRITE_PERI_REG(PIN_CTRL, 0xFF00);
} }
#else
#warning FIX ME!
#endif
} }
i2s_config_t _config; i2s_config_t _config;
@@ -307,6 +318,9 @@ public:
int8_t pin_ES7243_SCL; int8_t pin_ES7243_SCL;
}; };
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// ADC over I2S is only availeable in "claasic" ESP32
/* ADC over I2S Microphone /* ADC over I2S Microphone
This microphone is an ADC pin sampled via the I2S interval This microphone is an ADC pin sampled via the I2S interval
This allows to use the I2S API to obtain ADC samples with high sample rates This allows to use the I2S API to obtain ADC samples with high sample rates
@@ -489,6 +503,7 @@ class I2SAdcSource : public I2SSource {
int8_t _audioPin; int8_t _audioPin;
int8_t _myADCchannel = 0x0F; // current ADC channel for analog input. 0x0F means "undefined" int8_t _myADCchannel = 0x0F; // current ADC channel for analog input. 0x0F means "undefined"
}; };
#endif
/* SPH0645 Microphone /* SPH0645 Microphone
This is an I2S microphone with some timing quirks that need This is an I2S microphone with some timing quirks that need
@@ -502,7 +517,12 @@ class SPH0654 : public I2SSource {
void initialize(uint8_t i2swsPin, uint8_t i2ssdPin, uint8_t i2sckPin, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE) { void initialize(uint8_t i2swsPin, uint8_t i2ssdPin, uint8_t i2sckPin, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE) {
I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin); I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin);
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// these registers are only existing in "claasic" ESP32
REG_SET_BIT(I2S_TIMING_REG(I2S_NUM_0), BIT(9)); REG_SET_BIT(I2S_TIMING_REG(I2S_NUM_0), BIT(9));
REG_SET_BIT(I2S_CONF_REG(I2S_NUM_0), I2S_RX_MSB_SHIFT); REG_SET_BIT(I2S_CONF_REG(I2S_NUM_0), I2S_RX_MSB_SHIFT);
#else
#warning FIX ME! Please.
#endif
} }
}; };

View File

@@ -2450,7 +2450,7 @@ public:
strcat(logFileName, ".log"); strcat(logFileName, ".log");
#if ARTI_PLATFORM == ARTI_ARDUINO #if ARTI_PLATFORM == ARTI_ARDUINO
logFile = LITTLEFS.open(logFileName,"w"); logFile = WLED_FS.open(logFileName,"w");
#else #else
logFile = fopen (logFileName,"w"); logFile = fopen (logFileName,"w");
#endif #endif
@@ -2463,7 +2463,7 @@ public:
#if ARTI_PLATFORM == ARTI_ARDUINO #if ARTI_PLATFORM == ARTI_ARDUINO
File definitionFile; File definitionFile;
definitionFile = LITTLEFS.open(definitionName, "r"); definitionFile = WLED_FS.open(definitionName, "r");
#else #else
std::fstream definitionFile; std::fstream definitionFile;
definitionFile.open(definitionName, std::ios::in); definitionFile.open(definitionName, std::ios::in);
@@ -2517,7 +2517,7 @@ public:
#if ARTI_PLATFORM == ARTI_ARDUINO #if ARTI_PLATFORM == ARTI_ARDUINO
File programFile; File programFile;
programFile = LITTLEFS.open(programName, "r"); programFile = WLED_FS.open(programName, "r");
#else #else
std::fstream programFile; std::fstream programFile;
programFile.open(programName, std::ios::in); programFile.open(programName, std::ios::in);
@@ -2564,7 +2564,7 @@ public:
#ifdef ARTI_DEBUG // only read write file if debug is on #ifdef ARTI_DEBUG // only read write file if debug is on
#if ARTI_PLATFORM == ARTI_ARDUINO #if ARTI_PLATFORM == ARTI_ARDUINO
File parseTreeFile; File parseTreeFile;
parseTreeFile = LITTLEFS.open(parseTreeName, loadParseTreeFile?"r":"w"); parseTreeFile = WLED_FS.open(parseTreeName, loadParseTreeFile?"r":"w");
#else #else
std::fstream parseTreeFile; std::fstream parseTreeFile;
parseTreeFile.open(parseTreeName, loadParseTreeFile?std::ios::in:std::ios::out); parseTreeFile.open(parseTreeName, loadParseTreeFile?std::ios::in:std::ios::out);
@@ -2711,7 +2711,7 @@ public:
closeLog(); closeLog();
#if ARTI_PLATFORM == ARTI_ARDUINO #if ARTI_PLATFORM == ARTI_ARDUINO
LITTLEFS.remove(logFileName); //cleanup the /edit folder a bit WLED_FS.remove(logFileName); //cleanup the /edit folder a bit
#endif #endif
} }
}; //ARTI }; //ARTI

View File

@@ -113,6 +113,11 @@
#define B_8266_BB_TM2_4 NeoPixelBrightnessBus<NeoBrgFeature, NeoEsp8266BitBangTm1829Method> #define B_8266_BB_TM2_4 NeoPixelBrightnessBus<NeoBrgFeature, NeoEsp8266BitBangTm1829Method>
#endif #endif
// dirty HACK
#if defined(WLED_NO_I2S1_BUS) && defined(WLED_NO_I2S0_BUS) && defined(CONFIG_IDF_TARGET_ESP32S3)
#define CONFIG_IDF_TARGET_ESP32C3
#endif
/*** ESP32 Neopixel methods ***/ /*** ESP32 Neopixel methods ***/
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
//RGB //RGB
@@ -891,3 +896,8 @@ class PolyBus {
}; };
#endif #endif
// dirty HACK
#if defined(WLED_NO_I2S1_BUS) && defined(WLED_NO_I2S0_BUS) && defined(CONFIG_IDF_TARGET_ESP32S3)
#undef CONFIG_IDF_TARGET_ESP32C3
#endif