2021-06-01 07:05 PM
#else
static uint8_t l_datastoreStorage[2048];
#endif
static uint32_t l_head = 0;
static uint32_t l_tail = 0;
void hal_datastore_init()
{
memset(l_datastoreStorage, 0, sizeof(l_datastoreStorage));
memset(l_datastoreStorage, 0, sizeof(l_datastoreStorage));
memset(l_datastoreStorage, 0, sizeof(l_datastoreStorage));
}
When the optimize is set to none the fault occurs. When optimization is set to debug, no fault occurs. If I increase the buffer to 8K, the fault occurs regardless of the optimization level. Does anybody know why this is?
2021-06-01 07:22 PM
Unlikely to be a problem with memset, but rather changing the optimization settings causes an existing bug to crash the code. Could be stack overflow, could be something else. Look at SCB registers and debug the hard fault.
You can step through the assembly code in memset to verify it isn't causing the issue.