StoreProhibited error when equating two pointers
Posted: Fri Apr 01, 2022 2:07 am
Hello, I am using the ESP-WROOM-32 with the latest version of ESP-IDF and have run into an error. I am trying to set a double pointer in a struct equal to another double pointer. My code works fine until it encounters this line of code (it works if it is commented out) where it will cause the core to panic and say StoreProhibited.
Here is the error message:
Here is the line that causes the error:
To my understanding, StoreProhibited normally means that you are trying to write to non-existent memory, however, I have allocated memory for both of these pointers in a separate task that definitely runs before the line of code in question.
Here is the struct to show the double pointer:
This could very well be just a misunderstanding of how pointers work, but any help would be appreciated.
Here is the error message:
- Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
- Core 1 register dump:
- PC : 0x400d2882 PS : 0x00060b30 A0 : 0x80088ea8 A1 : 0x3ffc7fd0
- A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00000f9f
- A6 : 0x3ffc46dc A7 : 0x00000000 A8 : 0x800d2878 A9 : 0x3ffc7f80
- A10 : 0x00000001 A11 : 0x3f401440 A12 : 0x3f40136c A13 : 0x00005080
- A14 : 0x3f401440 A15 : 0x3ffb32b8 SAR : 0x00000004 EXCCAUSE: 0x0000001d
- EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd
- Backtrace:0x400d287f:0x3ffc7fd0 0x40088ea5:0x3ffc8020
- Timeptr->data = tPtr;
- tPtr = malloc(4000 * sizeof(double));
- Timeptr->data = malloc(sizeof(*Timeptr->data)*4000);
- struct emxArray_real_T {
- double *data;
- int *size;
- int allocatedSize;
- int numDimensions;
- boolean_T canFreeData;
- };