FlashX vs Flash_LDD for using MFS with internal flash.

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

FlashX vs Flash_LDD for using MFS with internal flash.

Jump to solution
1,688 Views
ironsean
Contributor V

Hello,

I've been working on this for a while, and did my best to read up and search for the information I need on here, but I'm in over my head and haven't been able to clearly figure out what's going on.

I'm working on a project using MQX 4.x and Kinetis K60DN512 chips and a custom board and just am not sure how to go about implementing some local file storage on the internal Flash on the chip. The goal is just to be able to open and write simple files locally, and then be able to read them to either export via ethernet or write to SD card on a later revision. Some of my main confusions are as follows:

1) FlashX vs Flash_LDD (from processor expert). It seems FlashX can be used to access the internal flash, but I also got the impression it was more suited for external flash devices and/or NAND flash (unlike the internal NOR). Does the Flash_LDD work with, or instead of, the FlashX driver? Which would be the preferred choice for this use?

2) I can view the Memory Map for RAM use, but is there a way to see the Flash Allocation to better understand where and how to access each Flash bank, and what space is available?

3) MFS: Does it make sense to use MFS internally or does it add more overhead then necessary for a small internal flash space like this? Because the Flash could just be written to directly without implementing the filesystem, but using MFS would be a good learning practice for future implementations on external flash or SD cards if used. I am aware MFS is not ideal for flash memory without a wear levelling driver, because the FAT is repeatedly re-written for every file change, but for our uses we shouldn't have to worry about running into the 100,000 writes that cause flash failure.

4) What is the preferred implementation of something like this?

     - Would it be low Level Flash Driver (flash_LDD) accessing the Flash Bank which isn't being used to store the application code itself?

     - Then use a Partition driver to create a partition in that bank.

     - Then install MFS on that partition.

     - From there, use MFS functions to open, read, and write data?

I'm sorry of some of this should be obvious and common knowledge, but I'm still fairly new to embedded development in general and really was not able to clear up what needed doing after much searching through semi-related questions here.

Thank you for any help you're able to give me,

Sean

Labels (1)
0 Kudos
Reply
1 Solution
764 Views
perlam_i_au
Senior Contributor I

After some research I found some information, I hope you find it useful:

1) Flash_X is the MQX component for read/write flash, Flash_LDD is the processor expert component to read/write without MQX. If you are already using MQX i think it will be better to use Flash_X.

2) I am not pretty sure about what you want to know here, you mean you want to know how Flash memory is distributed?? you can find that information on your project, search for Project_Settings folder and inside it you will find this file.

3) Regard file system, it totally depends on how much information you want to handle on Flash, if you are going to use variables and small information banks, the MFS could be overkill, in the other hand if you are going to use files (formally) I think the MFS could help you to handle them clearly and safety.

4) - I suggest you to use Flash_X to access data flash memory

    - Once you installed MFS it will be stored in specific part of the flash then as you can read on the MQX_MFS_User_Guide:

"The partition manager device driver is designed to be installed under the MFS device driver. It lets the MFS work independently of the multiple partitions on a disk"

    - After that, MFS will do the write/read work

Please let me know if this is useful or if I misunderstood something.


Have a nice day :P,
Perla

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
2 Replies
764 Views
ironsean
Contributor V

As an update to what I've found out:

1) FlashX can be used on it's own to access internal memory after enabling it in the BSP user_config.h and pointing to an appropriate bank as described in init_flashx.c in the BSP. Thanks Perla for explaining the difference between it and Flash_LDD, as now I understand why both seem to work.

2) I did not word my question well, but I was looking for two things:

First, address space information about where the flash banks are and how to access them, which I found in the K60 Sub-Family Reference Manual Describing for my K60DN512 ship that bank0 is allocated to 0x00000000 and bank1 is 0x00040000 and extend sto 0x0007FFFF. This was also confirmed in the linker file which had ROM allocated to that space for infflash builds.

And second, how much of the flash memory was being used by our code, and how much was available to use for storage. I had not even realized that banks 0 and 1 were contiguous in memory and both in use for our code. I still don't know how to find exact allocation, but by changing the allocation space in the linker for the rom I determined that our code would overflow from a single flash bank (0x00040000 of space) and needed a little more. I've now allocated a chunk 0x00020000 in size at the second half of bank1 to use for storage. Now I'm trying to see if I can add an entry in structure in init_flashx.x in the BSP to define my storage area there instead of working on the bank level currently described there.

3) I believe for our uses MFS is the best choice, especially to be familiar with it's use and writing code for it that can be portable to other storage sources going forward on future hardware iterations.

4) Updated understanding of the software layers at work:

- Flash Driver (FlashX in MQX)

- Then Partition

- Then MFS

0 Kudos
Reply
765 Views
perlam_i_au
Senior Contributor I

After some research I found some information, I hope you find it useful:

1) Flash_X is the MQX component for read/write flash, Flash_LDD is the processor expert component to read/write without MQX. If you are already using MQX i think it will be better to use Flash_X.

2) I am not pretty sure about what you want to know here, you mean you want to know how Flash memory is distributed?? you can find that information on your project, search for Project_Settings folder and inside it you will find this file.

3) Regard file system, it totally depends on how much information you want to handle on Flash, if you are going to use variables and small information banks, the MFS could be overkill, in the other hand if you are going to use files (formally) I think the MFS could help you to handle them clearly and safety.

4) - I suggest you to use Flash_X to access data flash memory

    - Once you installed MFS it will be stored in specific part of the flash then as you can read on the MQX_MFS_User_Guide:

"The partition manager device driver is designed to be installed under the MFS device driver. It lets the MFS work independently of the multiple partitions on a disk"

    - After that, MFS will do the write/read work

Please let me know if this is useful or if I misunderstood something.


Have a nice day :P,
Perla

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply