Is there a way to save a text file (used for configuration) to internal flash on FRDM-K22F without mounting the file system?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is there a way to save a text file (used for configuration) to internal flash on FRDM-K22F without mounting the file system?

1,131 Views
priya_dwivedula
Contributor III

Please let me know if there is any way to save a text file to the flash memory. I read that I might be able to mount the file system to internal flash. I am not sure how difficult it is and if there are any examples for the same? I would prefer not to mount any file system if possible. I know I can also create a header file with the text defined as char array and then write it to flash but I was wondering if any body else has any other suggestions?

 

Thanks,

Priya

Labels (1)
0 Kudos
Reply
1 Reply

914 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,Priya,

There are two options to implement to save text to internal flash.

1)as you said you can save the text in an char array and call the flash api function to save the char array into the internal flash without any file system.

2)we provide the fat file system, I think it is okay to write a file into internal flash. Pls refer to the directory:

Driver:\Freescale\KSDK_1.3.0\middleware\filesystem\fatfs, there are two files:ff.c and diskio.c. The diskio.c file is an IO interface, which includes disk_initialize(),disk_status(),disk_read() and disk_write(), different physical media needs different implementation of the above 4 api function. For the internal flash, you can use flash drive the SDK provides to inplement the above 4 api function. For example, for the disk_write(), the sector size is 1K bytes for Kinetis family, you can erase a sector, afterwords, you can program a sector with the data in buffer, it is okay. The high level api function is provided in ff.c, which do not need any modification for customers.

Hope it can help you.

BR

xiangjun rong

0 Kudos
Reply