hash6iron / powadcr

TAP/TZX Digital cassette recorder for 8-bit machines
GNU General Public License v3.0
21 stars 10 forks source link

Read data from file generates a booting reset. #2

Closed hash6iron closed 1 year ago

hash6iron commented 1 year ago

The following code not running well due to read function.

char readFile(SdFile mFile) { char nothing; if (mFile) { int rlen = mFile.available(); Serial.println("Len: "); Serial.print(String(rlen)); char buf[rlen]; int i = 0; while(i < rlen) { buf[i] = mFile.read(); i++; } return buf; } else { Serial.print(F("SD Card: error on opening file")); return nothing; } }

The ESP32 report this from stack. This means that ESP32 WDT do a booting. The boot reset is due to mFile.read()

rst:0x8 (TG1WDT_SYS_RESET),boot:0x1f (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0030,len:1344 load:0x40078000,len:13924 ho 0 tail 12 room 4 load:0x40080400,len:3600 entry 0x400805f0 E (303) esp_coredump����͡� Core dump data check failed: Calculated checksum='6b9e472d'

hash6iron commented 1 year ago

Finally, this issue was solved. The source problem was declaration pointer and dynamic memory using.