MFS in Flash Memory

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

MFS in Flash Memory

2,600 Views
ramstell
Contributor III

I'm using a TWR-K64F120M board and would like to use MFS in Flash Memory.

 

Does the KSDK support creating a file system in a section of flash memory?

 

If so, are there some examples of how this is achieved?

 

Kind regards

Roger

Labels (1)
0 Kudos
9 Replies

1,675 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi!

Actually using a HTTP server in flash is not that similar to using a Memory File System in flash. In the HTTP Server it is not necessary to write to the flash and you can use CGI for file transfer but it does not implement file system.

Please note that using a files system in flash will hardly impact the flash life cycle and endurance because you will need to write constantly to flash. Besides this writing into the flash is not that easy because you may need flash routines any time you save a file in the flash. As this is not common we do not provide an example. But what we have in KSDK are RAM, USB and SD examples

You can find SD and USB examples with the stand alone FAT File system:

C:\Freescale\KSDK_1.2.0\middleware\filesystem\fatfs

You can also find RAM, SD and USB examples with the MQX RTOS MFS:

C:\Freescale\KSDK_1.2.0\middleware\filesystem\mfs\examples

If you really need to have a Flash file system you may use as base the RAM file system, switch the address to a flash address and call flash routines to write to flash. You can find flash routines in any of our bootloader application notes for the same target you are using.

I hope this helps.

Best regards,

Carlos

0 Kudos

1,675 Views
ramstell
Contributor III

Hi Carlos

I do really need a flash based file system. This is primary used for storing configuration files etc. These would normally be transferred using ftp. Most the time its for reading rather than writing. In more higher end products it may be acceptable to use USB or SD based storage, but not really in lower end ones.

We are hoping to replace a range of products, including developing new ones, with Kinetics based processors. Our current implementation has a flash based embedded file system for this purpose.

Looking at the MQX 4.2 classic it does appear to support a flash based file system. If this is the case, do you know if it supports the TWR-K64F120M board?

As a flash based file system does seem to be supported already to some degree, is this functionality going to find its way into the KSDK in the near future?

Kind regards

Roger

0 Kudos

1,675 Views
DavidS
NXP Employee
NXP Employee

Hi Roger,

I agree with others that MFS is not right approach and using NAND flash controller with FFS way over kill.

What is the architecture of your current embedded flash based file system? How do you implement it?

If the number of configuration files is small and not changing often (i.e. on-chip Flash has limited erase/program cycles) say less than 10K cycles, just using your flash based file system should work.

A more formal filesystem for this might be using TFS with MQX (or specifically the OSA_Abstraction layer):

C:\Freescale\KSDK_1.2.0\rtos\mqx\mqx\source\nio\drivers\nio_tfs\src

It does require OSA function calls such as OSA _MemAlloc, OSA_MemFree, OSA_SemaDestroy, etc...

A MQX httpsrv example of having web pages in on-chip flash using a TFS (Trivial File System) is at:

C:\Freescale\KSDK_1.2.0\middleware\tcpip\rtcs\examples\httpsrv

Look at the _readme.txt in the folder.

Files can be place into the ./filesystem/web folder and when the mktfs.bat is run a new nio_tfs_data.c is generated.  Compile it into your application and you are good to go.

Regards,

David

0 Kudos

1,675 Views
ThomNet
Contributor III

Hi David,

in the KSDK 1.2.0 httpsrv example (frdm-K64-build) mktfs creates tfs_data.c. But how do I create nio_tfs_data.c.

You write:

Look at the _readme.txt in the folder.

Files can be place into the ./filesystem/web folder and when the mktfs.bat is run a new nio_tfs_data.c is generated.  Compile it into your application and you are good to go.

Any idea, what I'm doing wrong?

Best

Thomas

0 Kudos

1,675 Views
ramstell
Contributor III

Hi David

Our current implementation uses NOR Flash together with an embedded file system which implements the flash wear levelling in software. This is very convenient for holding configuration files etc. These files are downloaded by the customer when configuring the product. Once configured very few writes to the flash occur during normal running. Program code and flash file system are contained in the same flash, but the program code is copied to RAM at start-up for execution. The embedded file system is not our own and cannot be transferred.

We can set-up a TFS with most of the files we need that will not change, but will have to design some way of saving user downloaded ones. For products with larger data requirements I guess we could consider using the SDHC interface.

Kind regards

Roger

0 Kudos

1,675 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Roger,

What do you exactly mean with MFS in flash memory? I thought you mean internal MCU Flash memory.

As you said in in MQX4.2 there is a Compact Flash card MFS example (cfcard).

C:\Freescale\Freescale_MQX_4_2\mfs\examples

If you are interested in this example but in MQX for KSDK you can find a porting guide here:

http://www.freescale.com/files/soft_dev_tools/doc/support_info/MQXKSDKPUG.pdf?fsrch=1

Next KSDK release is targeted for September. Unfortuanatelly this example is not going to be migrated.

Best regards,

Carlos

0 Kudos

1,675 Views
ramstell
Contributor III

Hi Carlos

I mean internal flash memory.

The example and documentation for MQX 4.2 is here:

C:\Freescale\Freescale_MQX_4_2\ffs\examples\mfs_nandflash

This example provide MFS file system on internal NAND Flash memory - exactly what I require.

The question is does this support the TWR-K64F120M board and will this functionality be migrated into the KSDK?

Kind regards

Roger

0 Kudos

1,675 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Roger,

Internal flash in Kinetis devices is not NAND flash, actually the example you point is not for internal flash. It is for external NAND flash and it is targeted for the Kinetis devices that feature NAND flash controller module such as K70. K70_120 |Kinetis K70 120/150 MHz MCUs|Freescale

K64 does not provide NAND flash controller.

All the options I mentioned in my previous replies are available for TWR-K64 but they are not exactly what you need. You may need to reuse some code and adapt the example for your needs.

Regards,

Carlos

0 Kudos

1,675 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Roger,

you can try example for HTTP server application. The example demonstrate different features of the

RTCS HTTP server. The example allows to start one or more HTTP servers on IPv4 and/or IPv6 addresses, demonstrating use of both static and dynamic web pages with CGI and server WebSocket plugin.

The example is stored in Flash Memory and is read only.

It is located at c:\Freescale\KSDK_1.2.0\middleware\tcpip\rtcs\examples\httpsrv\

I hope it helps you,

Best Regards,

Iva

0 Kudos