Arm Mbed OS support forum

Save/Read files in Nucleo-F767ZI flash

Hi,

I’m trying to find out the way to have a persistent file ( settings.txt ) that I can create and read from my Nucleo-f767ZI board. I’ve tried many different ways without any success.

Also, is there a way to use ( read/write files/dirs) the storage that is mounted by the board ( containing DETAILS.TXT and MBED.HTM ).

Can you help me ?
Thanks
Frédéric

Hello,

ST-link’s 2MB flash memory is used only for ST-link, the board’s chip have no access to it (that feature was available only on LPC1768 I think), how I remember.
If you really need a .txt file you probably need to use a SD card or USB stick.
If you want to store some settings/data and have it available also after reset/power down, then you can try KVStore API.

BR, Jan

Thanks for your answer.
So, that means that there is no way, natively (without extension boars), to save files in a flash of this board ?
I will use KVStore if I have no other file saving options.

You can try to check all Data storage APIs and find a best solution according to your requirements.

Maybe FlashIAPBlockDevice but I tried it and I probably misunderstood something, because the example not work for me I think (Nucleo-F429ZI - MbedOS 6.2.1).

BR, Jan

Hi,

It’s not entirely clear to me what you’re trying to do but…

Our STM32 application has some configuration settings that we keep in internal flash so they persist between resets.

Our settings are held in binary form, i.e. just write the struct to flash. Actually, it’s a bit complicated because we keep to copies and hash them and stuff like that! We thought about using NVStore but decided not to in the end.

The location of the settings structure is hardcoded. They are at the top of flash so the flash size is reduced a bit in the linker script.

In production, we write the default settings to the flash using the JTAG programmer, just like programming the code. We’ve got a little PC app that writes the settings in binary to a binary file on the PC.

You say you want to ‘write a file’. If by that you mean you want to write a file using a file system and you want to just copy a file from your PC to the device, then that’s something different altogether.

Hello Matt,

Our settings are held in binary form, i.e. just write the struct to flash.

You can use the Flash IAP API to write binary data (an array) to the flash memory and then read it back after reset. This thread might help.

Best regards, Zoltan