-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Description
Hardware:
Board: TTGO ESP32-WROVER-B T8 V1.8 ESP32 4MB PSRAM
Core Installation version: Latest git
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: yes, at least I THINK SO, by boards.txt (using board 'ESP32 Wrover Module'
Upload Speed: 921600
Computer OS: Ubuntu
Description:
I can allocate a large block (900,000 uint8_t) with malloc() but not with new()
Sketch: (leave the backquotes for code formatting)
//Change the code below by your sketch
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("\nStarted\n");
Serial.printf("Internal Total heap %d, internal Free Heap %d\n", ESP.getHeapSize(), ESP.getFreeHeap());
Serial.printf("SPIRam Total heap %d, SPIRam Free Heap %d\n", ESP.getPsramSize(), ESP.getFreePsram());
Serial.printf("ChipRevision %d, Cpu Freq %d, SDK Version %s\n",ESP.getChipRevision(), ESP.getCpuFreqMHz(), ESP.getSdkVersion());
Serial.printf("Flash Size %d, Flash Speed %d\n",ESP.getFlashChipSize(), ESP.getFlashChipSpeed());
#if defined(BOARD_HAS_PSRAM)
Serial.printf("Board has PSRAM\n");
#else
Serial.printf("Board doesn't have PSRAM\n");
#endif
Serial.printf("Test malloc()...\n");
uint8_t *testMallocBuffer = (uint8_t*)ps_malloc(900000);
if(testMallocBuffer != NULL) Serial.printf("NOT NULL\n"); else Serial.printf("NULL\n");
free(testMallocBuffer);
Serial.printf("Test new()...\n");
uint8_t *testNewBuffer = new uint8_t[900000];
if(testNewBuffer) Serial.printf("test NOT NULL\n"); else Serial.printf("test NULL\n");
delete testNewBuffer;
}
void loop() {
// put your main code here, to run repeatedly:
}
Debug Messages:
Started
Internal Total heap 378424, internal Free Heap 348176
SPIRam Total heap 4194252, SPIRam Free Heap 4194252
ChipRevision 1, Cpu Freq 240, SDK Version v3.2-111-g524308c98
Flash Size 4194304, Flash Speed 80000000
Board has PSRAM
Test malloc()...
NOT NULL
Test new()...
abort() was called at PC 0x400e9163 on core 1
Backtrace: 0x4008dce8:0x3ffb1ea0 0x4008df15:0x3ffb1ec0 0x400e9163:0x3ffb1ee0 0x400e91aa:0x3ffb1f00 0x400e8bd7:0x3ffb1f20 0x400e8dfa:0x3ffb1f40 0x400e8db1:0x3ffb1f60 0x400d0dec:0x3ffb1f80 0x400d209f:0x3ffb1fb0 0x4008c681:0x3ffb1fd0
Rebooting...
Decoding stack results:
0x4008dce8: invoke_abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 155
0x4008df15: abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 170
0x400e9163: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc line 47
0x400e91aa: std::terminate() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc line 57
0x400e8bd7: __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*)) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc line 87
0x400e8dfa: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_op.cc line 54
0x400e8db1: operator new[](unsigned int) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_opv.cc line 32
0x400d0dec: setup() at /home/jeroen/Arduino/Test_PSRAM_malloc_new/Test_PSRAM_malloc_new.ino line 21
0x400d209f: loopTask(void*) at /home/jeroen/Downloads/arduino-1.8.9-linux64/arduino-1.8.9/hardware/espressif/esp32/cores/esp32/main.cpp line 14
0x4008c681: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143
Metadata
Metadata
Assignees
Labels
No labels