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-psram.c b/cores/esp32/esp32-hal-psram.c index 7a8cc0befef..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; @@ -66,7 +73,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();