From 9265b8ebae0d5043a149205b26191acd943facd1 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 13 Jan 2022 18:34:26 -0300 Subject: [PATCH 1/2] Allows user to bypass PSRAM test and boot faster with WROVER --- cores/esp32/Arduino.h | 6 +++++- cores/esp32/esp32-hal-misc.c | 6 ++++++ cores/esp32/esp32-hal-psram.c | 3 ++- cores/esp32/esp32-hal.h | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cores/esp32/Arduino.h b/cores/esp32/Arduino.h index 8014d3c8342..b1e8f7cd7de 100644 --- a/cores/esp32/Arduino.h +++ b/cores/esp32/Arduino.h @@ -166,6 +166,7 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); #include "Udp.h" #include "HardwareSerial.h" #include "Esp.h" +#include "esp32/spiram.h" using std::abs; using std::isinf; @@ -181,7 +182,10 @@ uint16_t makeWord(uint8_t h, uint8_t l); size_t getArduinoLoopTaskStackSize(void); #define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;} - + +// allows user to bypass esp_spiram_test() +#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_spiram_test(); } + unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 102ff6947a4..c4685fe7448 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -56,6 +56,12 @@ #ifdef CONFIG_IDF_TARGET_ESP32 uint8_t temprature_sens_read(); +//allows user to bypass SPI RAM test routine +__attribute__((weak)) bool testSPIRAM(void) +{ + return esp_spiram_test(); +} + float temperatureRead() { return (temprature_sens_read() - 32) / 1.8; diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 7a8cc0befef..4dcfc074420 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -66,7 +66,8 @@ bool psramInit(){ return false; } esp_spiram_init_cache(); - if (!esp_spiram_test()) { + //testSPIRAM() allows user to bypass SPI RAM test routine + if (!testSPIRAM()) { spiramFailed = true; log_e("PSRAM test failed!"); return false; diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 115a050b172..55e9f95769b 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -95,6 +95,9 @@ void analogWrite(uint8_t pin, int value); //returns chip temperature in Celsius float temperatureRead(); +//allows user to bypass SPI RAM test routine +bool testSPIRAM(void); + #if CONFIG_AUTOSTART_ARDUINO //enable/disable WDT for Arduino's setup and loop functions void enableLoopWDT(); From 165ecf8d4430c49f5a5b5b352682d826268d9793 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 13 Jan 2022 19:01:23 -0300 Subject: [PATCH 2/2] Allows user to bypass PSRAM test and boot faster with WROVER --- cores/esp32/esp32-hal-misc.c | 6 ------ cores/esp32/esp32-hal-psram.c | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index c4685fe7448..102ff6947a4 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -56,12 +56,6 @@ #ifdef CONFIG_IDF_TARGET_ESP32 uint8_t temprature_sens_read(); -//allows user to bypass SPI RAM test routine -__attribute__((weak)) bool testSPIRAM(void) -{ - return esp_spiram_test(); -} - float temperatureRead() { return (temprature_sens_read() - 32) / 1.8; diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 4dcfc074420..44612562977 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -35,6 +35,13 @@ static volatile bool spiramDetected = false; static volatile bool spiramFailed = false; +//allows user to bypass SPI RAM test routine +__attribute__((weak)) bool testSPIRAM(void) +{ + return esp_spiram_test(); +} + + bool psramInit(){ if (spiramDetected) { return true;