2024-05-13 11:24 AM
In a previous thread, I saw that the _malloc_r() hardfault bug was fixed in STM32CubeIDE 1.7. However, it is still broken (or broken again) in versions 1.13.1 and 1.15.1 (I didn't try 1.14).
The MCU is an STM32L562.
Snippet to reproduce. For simplicity, I obtained a reasonable value for the time_t argument to localtime() (linux epoch time) by running "date +%s" in a bash shell on a PC .
const time_t recent_epoch = 1715190860; // Wed May 8 13:54:20 EDT 2024
struct tm * local = NULL;
local = localtime(&recent_epoch);
Call stack:
HardFault_Handler() at hard_fault_handler_lock.s:15 0x8030bb0
<signal handler called>() at 0xffffffa8
_malloc_r() at 0x8055876
localtime() at 0x8054012