--- Close. Cannot continue this case due to inability to share code (company policy). ---
Hi, I am writing an application where I need to parse data into dynamically allocated structs at system initialization.
I have observed that some of my dynamically allocated uint8_t array got their first elements somehow overwritten. I am 100% certain I do not directly do anything to change the data.
For more detail, take a look at this UART log here.
parse key 0 return: 0x00
parse key 0 return: 0x00
parse key 0 return: 0x30
parse key 1 return: 0x11 0xDA 0x27 0x00 0xC5 0x00 0x00 0xD7
parse key 1 return: 0x10 0x00 0x00 0x00 0xC5 0x00 0x00 0xD7
parse key 1 return: 0x10 0x00 0x00 0x00 0xC5 0x00 0x00 0xD7
parse key 2 return: 0x11 0xDA 0x27 0x00 0x42 0x00 0x00 0x54
parse key 2 return: 0x11 0xDA 0x27 0x00 0x42 0x00 0x00 0x54
parse key 2 return: 0x11 0xDA 0x27 0x00 0x42 0x00 0x00 0x54
parse key 3 return: 0x11 0xDA 0x27 0x00 0x00 0x08 0x00 0x00 0x00 0x00 0x00 0x06 0x60 0x00 0x00 0xC1 0x80 0x00 0x00
parse key 3 return: 0x11 0xDA 0x27 0x00 0x00 0x08 0x00 0x00 0x00 0x00 0x00 0x06 0x60 0x00 0x00 0xC1 0x80 0x00 0x00
parse key 3 return: 0x11 0xDA 0x27 0x00 0x00 0x08 0x00 0x00 0x00 0x00 0x00 0x06 0x60 0x00 0x00 0xC1 0x80 0x00 0x00
The log is printed at various point of the data initialization process. Each data is finished initialized before my application work on the next one (parse #2 is not started until parse #1 is done, etc.).
As you can see for parse #0, the data got corrupted before the 3rd log point. But for parse #1, the corruption happened before the 2nd log. Yet for parse #2 and #3, no corruption happened at all.
I was suspecting that this is due to a stack overflow. But given that data #2 and #3 which was parsed AFTER the corruption for data #0 and #1 happen, that seems not to be the case.
Any pointer to debug this issue is greatly appreciated.
I am working on a nrf51 DK without any SoftDevice.