NodeMcu and Non Mutated C/C++

0

I created a NodeMCU-specific header file which exploits (is built upon) some predefined headers.

I observed very strange things: when I try to use sscanf() on NodeMCU ESP8266, it runs into an exception (run time error). I tested my same code on my Windows machine and it runs fine. Can anyone explain why is it occurring? I am Using Arduino IDE to Upload code to it.

x is a structure variable and all the entries are unsigned int, %d or %u shouldn't make a difference since the number to be extracted is actually an unsigned number of 12 bits being stored in uint16_t and remaining are 6 bits uints being stored in uint8_t.

timeStampVar - it has been generated by sprintf in exact format as mentioned below:

sscanf(timeStampVar,"%d-%d-%d %d:%d:%d",&(x.day),&(x.month),&(x.Year),&(x.hours),&(x.min),&(x.sec));

Also sprintf() works perfectly fine. I am developing my first NodeMCU-specific header and couldn't find internal architecture of NodeMCU or way to interpret the error code.

The exception thrown by the NodeMCU:

SDK:2.2.2-dev(38a443e)/Core:2.7.1=20701000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-30-g92add50/BearSSL:5c771be
Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x402106ec, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3fffff8d, depc=0x00000000

PS: I am already trying to use other methods for debugging and I can easily create a proper method to do the same job. But why isn't sscanf() working my question is this? That specific piece of code works fine on Windows GCC compiler (sscanf() part).

c++
c
arduino-ide
nodemcu
asked on Stack Overflow Jul 2, 2020 by Shivam Saini • edited Jul 2, 2020 by G. Sliepen

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0