Pointer value changes when not debugging, causing hardfault.
Target device STM32F407VG
I am getting a hardfault that occurs only when not debugging.
Using RTC_BKP registers I have tracked the problem down to a function call that passes a pointer to a struct.
This struct contains a pointer to dynamically allocated array and info about the array's size.
The function call in question is the last in a chain. I have tracked the address of the struct through the call chain and at the last moment it changes from 0x20001f54 (SRAM) to 0x100057c8 (CCMRAM). This only occurs when not debugging, and usually only after a power reset. When running with the debugger it executes correctly and as expected.
I am baffled.
I also have a deadline to meet.
If anyone has experienced this before and can shed some light onto what may be happening, I'd much appreciate it.
Cheers.