Open Red-Owl opened 5 months ago
TL;DR. This looks a lot like a problem with your code. Make a minimal example. This is a pointer memory violation, so those strcpy are almost certainly the problem.
i have disabled a final code strcpy,
this code create a crash:
String gatto_get_serial(){
String str = NVS.getString("serial");
return str;
}
if(com=="ass"){
String ass = gatto_get_serial(); // call a function
USBCOM.write(ass.c_str());
}
-------------this code not crash:-----------------------------
if(com=="ass"){
String ass = NVS.getString("serial"); // this non crash
USBCOM.write(ass.c_str());
}
On linux: Backtrace: 0xfffffffe:0x8037fa38 |<-CORRUPTED ELF file SHA256: e59f49159b024990
Pass pointers, not Strings. You are making lots of extra copies of the objects, and then attaching a local stack variable to your heap function result. In this case, keeping things as char (or even const char) all the way through will be much more efficient.
Verion 4.4 idf (downgrade) this error is identical
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (arduino_usb_eve)
Core 0 register dump:
PC : 0x4038085b PS : 0x00060036 A0 : 0x8037f190 A1 : 0x3fcf1bc0
A2 : 0x3fc97220 A3 : 0xb33fffff A4 : 0x0000abab A5 : 0x00060023
A6 : 0x00060023 A7 : 0x0000cdcd A8 : 0xb33fffff A9 : 0xffffffff
A10 : 0x3fc971f4 A11 : 0x00000001 A12 : 0x00060021 A13 : 0x3fcf1c90
A14 : 0x02c97220 A15 : 0x00ffffff SAR : 0x00000002 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400557e1 LEND : 0x400557e5 LCOUNT : 0x00000000
Backtrace: 0x40380858:0x3fcf1bc0 0x4037f18d:0x3fcf1c00 0x4037d63c:0x3fcf1c30 0x4037d632:0xa5a5a5a5 |<-CORRUPTED
ELF file SHA256: d0c258a0e48ea1a6
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (arduino_usb_eve)
Core 0 register dump:
PC : 0x4038085b PS : 0x00060036 A0 : 0x8037f190 A1 : 0x3fcf1bc0
A2 : 0x3fc97220 A3 : 0xb33fffff A4 : 0x0000abab A5 : 0x00060023
A6 : 0x00060023 A7 : 0x0000cdcd A8 : 0xb33fffff A9 : 0xffffffff
A10 : 0x3fc971f4 A11 : 0x00000001 A12 : 0x00060021 A13 : 0x3fcf1c90
A14 : 0x02c97220 A15 : 0x00ffffff SAR : 0x00000002 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400557e1 LEND : 0x400557e5 LCOUNT : 0x00000000
Backtrace: 0x40380858:0x3fcf1bc0 0x4037f18d:0x3fcf1c00 0x4037d63c:0x3fcf1c30 0x4037d632:0xa5a5a5a5 |<-CORRUPTED
.... this is contenent of arduinoNvs.h
PLEASE update info to string.h #include wstring.h
class ArduinoNvs {
public:
ArduinoNvs();
bool begin(String namespaceNvs = "storage");
void close();
bool eraseAll(bool forceCommit = true);
bool erase(String key, bool forceCommit = true);
bool setInt(String key, uint8_t value, bool forceCommit = true);
bool setInt(String key, int16_t value, bool forceCommit = true);
bool setInt(String key, uint16_t value, bool forceCommit = true);
bool setInt(String key, int32_t value, bool forceCommit = true);
.....
Hello @Red-Owl, sorry for late reply, is this issue still valid?
Board
ESP32 wt32-s3-wrover (wt32sc01 plus)
Device Description
https://github.com/rpolitex/ArduinoNvs
Hardware Configuration
https://api.riot-os.org/group__boards__esp32s3__wt32__sc01__plus.html
Version
v3.0.1
IDE Name
visual studio code
Operating System
win11
Flash frequency
40mhz
PSRAM enabled
yes
Upload speed
115200
Description
return a data
Sketch
Debug Message
Other Steps to Reproduce
connect to usb, send SERIAL, crash
I have checked existing issues, online documentation and the Troubleshooting Guide