Arm Mbed OS support forum

LocalFileSysten and Mbed OS 6.4.0 - HARD FAULT

Hi folks, I’m trying to use the LocalFileSystem on Mbed OS 6.4 however it is causing a Hard Fault error.

I would like to log some variables that can not be debugged by serial port since the program has hard time constraints and the communication delay is prohibitive.

Is there a solution for this problem? Someone already used LocalFileSystem on Mbed OS 6? Is there any other file system, as simple as LocalFileSytem, to log data in the same way that LocalFileSystem does?

Thank you in advance for any clue.

Regards,


I’m using a LPC1768 with the following code (for testing):

include “mbed.h”

#define WAIT_TIME_MS 500
DigitalOut led1(LED1);
LocalFileSystem local(“local”);
int main()
{
printf(“This is the bare metal blinky example running on Mbed OS %d.%d.%d.\n”, MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);

FILE *fp = fopen("/local/out.txt", “a”);

fprintf(fp, “Hello World!”);

fclose(fp);

while (true)

{
    led1 = !led1;
    thread_sleep_for(WAIT_TIME_MS);
}

}


Below is the console message when the microcontroller is reseted:

This is the bare metal blinky example running on Mbed OS 6.4.0.

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0: 402
R1: 2E67
R2: D
R3: 6C
R4: 0
R5: C
R6: C
R7: 409
R8: 2E64
R9: 0
R10: 1
R11: 53A0
R12: 65
SP : 10007FD8
LR : 1203
PC : 91E
xPSR : 81000000
PSP : 467F5800
MSP : 10007FB8
CPUID: 412FC230
HFSR : 40000000
MMFSR: 0
BFSR : 4
UFSR : 0
DFSR : 8
AFSR : 0
Mode : Thread
Priv : Privileged
Stack: MSP

– MbedOS Fault Handler –

++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x91E
Error Value: 0x10000338
For more info, visit: https://mbed.com/s/error?error=0x80FF013D&tgt=LPC1768
– MbedOS Error Info –

Hi @rafael210,

Thank you for reporting this issue. I’ve notified Mbed OS team about it. This issue is not new and should be present only on the LPC1768 board. Here is an original ticket for it in Mbed OS https://github.com/ARMmbed/mbed-os/issues/6624

Thanks,
Arek - Mbed Studio team