Skip to content

Commit 1bbe61a

Browse files
authored
Allows user to bypass PSRAM test and boot faster with WROVER (espressif#6135)
Fixes espressif#5737
1 parent 841599c commit 1bbe61a

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Diff for: cores/esp32/Arduino.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
166166
#include "Udp.h"
167167
#include "HardwareSerial.h"
168168
#include "Esp.h"
169+
#include "esp32/spiram.h"
169170

170171
using std::abs;
171172
using std::isinf;
@@ -181,7 +182,10 @@ uint16_t makeWord(uint8_t h, uint8_t l);
181182

182183
size_t getArduinoLoopTaskStackSize(void);
183184
#define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;}
184-
185+
186+
// allows user to bypass esp_spiram_test()
187+
#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_spiram_test(); }
188+
185189
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
186190
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
187191

Diff for: cores/esp32/esp32-hal-psram.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
static volatile bool spiramDetected = false;
3636
static volatile bool spiramFailed = false;
3737

38+
//allows user to bypass SPI RAM test routine
39+
__attribute__((weak)) bool testSPIRAM(void)
40+
{
41+
return esp_spiram_test();
42+
}
43+
44+
3845
bool psramInit(){
3946
if (spiramDetected) {
4047
return true;
@@ -66,7 +73,8 @@ bool psramInit(){
6673
return false;
6774
}
6875
esp_spiram_init_cache();
69-
if (!esp_spiram_test()) {
76+
//testSPIRAM() allows user to bypass SPI RAM test routine
77+
if (!testSPIRAM()) {
7078
spiramFailed = true;
7179
log_e("PSRAM test failed!");
7280
return false;

Diff for: cores/esp32/esp32-hal.h

+3
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ void analogWrite(uint8_t pin, int value);
9595
//returns chip temperature in Celsius
9696
float temperatureRead();
9797

98+
//allows user to bypass SPI RAM test routine
99+
bool testSPIRAM(void);
100+
98101
#if CONFIG_AUTOSTART_ARDUINO
99102
//enable/disable WDT for Arduino's setup and loop functions
100103
void enableLoopWDT();

0 commit comments

Comments
 (0)