Skip to content

Commit

Permalink
Allows user to bypass PSRAM test and boot faster with WROVER (#6135)
Browse files Browse the repository at this point in the history
Fixes #5737
  • Loading branch information
SuGlider authored Jan 17, 2022
1 parent 841599c commit 1bbe61a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cores/esp32/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down
10 changes: 9 additions & 1 deletion cores/esp32/esp32-hal-psram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions cores/esp32/esp32-hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1bbe61a

Please sign in to comment.