Hardfault in fmount() using Keil MDK with CMSIS-RTOS2

Aloha !

I'm working with an NXP LPC4337, using Keil MDK (latest version) and CMSIS-RTOS2 with Keil RTX.

Calls to fmount() randomly results in hardfaults. Using the EventRecorder, a few rather obtuse errors are logged shortly before the hardfault (see below)

The hardfault happens right upon return from a call to osDelay() from within fmount() (the RTX Wait event listed near the end of the event list in the attached capture).

We have been using the same setup for years on many boards, the hardware design around the LPC4337 is always almost identical, and we've never faced this issue before. The mounted device is a FAT SD-MMC on-board flash memory that can also be exposed to a computer over USB via the µC using the USB MSC component. Upon boot, the USB MSC is not configured and should not interfere. The filesystem is initialized only after the USART interface, so not many things happen prior to the calls to finit() and fmount(). Whenever the hardfault does not happens, everything functions as expected, and especially the Filesystem component exhibits no unexpected behaviour (and the flash can be unmounted, exposed over USB, and later remounted without issues). Sometimes the hardfault also happens at the fmount() call when changing ownership from USB to FS, and not only during early boot.

Furthermore this hardfault happens in a variety of different memory configurations (either running from the LPC4337 internal flash memory or loaded into an external SDRAM).

I'll provide additional info if requested !

Thanks by advance !