How to use two or more banks flashx to store data in them

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

How to use two or more banks flashx to store data in them

1,252 Views
feraro
Contributor IV

Hello.

I'm testing with TWR60n512, MQX 3.7 and CW10.
Is it possible to work with more than one memory bank to store flashx different data in each and have access to either one or the other?. Does anyone have any examples?

Thank you.

Tags (3)
0 Kudos
7 Replies

531 Views
c0170
Senior Contributor III

Hello there,

Yes, it is possible. Both banks are accessible flash memory with their own addresses. Their base addresses can be swapped that's the only difference between the one bank flash. From this point of view program, the flash memory in the bank 1 (higher address range could be programmed.

I don't have any example right now, do you still need it?

Regards,

MartinK

0 Kudos

531 Views
tunguyen
Contributor I

Hello,

I am confused about the results from the following execution for listing the sizes of my MK60DN256VLL10.

In addition, how can I tell MQX to switch to the other bank at reset?

Would you please advise?

Thanks.

   FlashMemory = fopen("flashx:", NULL);

   if (FlashMemory == NULL)

   {

      printf("\n!!!! Unable to open file flashx:");

   }

   else

   {

      fseek(FlashMemory, 0, IO_SEEK_END);

      printf("\nCurrent flash size = %d Bytes\n", ftell(FlashMemory));      // This yields 131,072 bytes.

   }

   fclose (FlashMemory);

   FlashMemory = fopen("flashx:bank0", NULL);

   if (FlashMemory == NULL)

   {

      printf("\n!!!! Unable to open file flashx:bank0");

   }

   else

   {

      fseek(FlashMemory, 0, IO_SEEK_END);

      printf("\nFlash Bank0 size = %d Bytes\n", ftell(FlashMemory));      // This yields 262,144 bytes.

   }

   fclose (FlashMemory);

   FlashMemory = fopen("flashx:bank1", NULL);

   if (FlashMemory == NULL)

   {

      printf("\n!!!! Unable to open file flashx:bank1");

   }

   else

   {

      fseek(FlashMemory, 0, IO_SEEK_END);

      printf("\nFlash Bank1 size = %d Bytes\n", ftell(FlashMemory));      // This yields 262,144 bytes too!

   }

   fclose (FlashMemory);

0 Kudos

531 Views
SergeMaslenniko
Contributor II

Hello Kojto,

I need the examples, could you please write them.

Thank you.

0 Kudos

531 Views
JuroV
NXP Employee
NXP Employee

Hi Sergey,

because you have surname as one of my colleague, I decided to reply to you :smileygrin:

First of all, FlashX driver works with virtual files, that are defined in init_flashx,c file in your BSP. I recommend you to look into this C file.

These FlashX files defined there are passed to the FlashX driver when initializing. You cannot add or remove any additional files afterwards. The only possibility is to modify this file.

The description of the files and FlashX driver is quite well documented in MQXIOUG.pdf (available in your Freescale MQX installation).

So, to reply to your question- you have to define 2 files that are located at physical addresses belonging to the first bank or second bank, respectivelly. After such files are defined, you can open both files and you can read/ write to these files.

0 Kudos

531 Views
SergeMaslenniko
Contributor II

Hi Juraj,

Can I replace the two banks with FLASH_IOCTL_SWAP_FLASH_AND_RESET on Kinetis K60?

How do names of a banks depend on SWAP?

Is "flashx:bank0" always located at memory address 0x000000 and loadable?

Thanks.

0 Kudos

531 Views
JuroV
NXP Employee
NXP Employee

Hello,

this functionality was reviewed and improved for Kinetis parts in MQX 4.0 which will be released soon. Note the "AND_RESET" part in the IOCTL command. It says, that it will reset your microcontroller.

"flashx:bank0" is name of a file. I do not know how you defined it. In MQX, it is defined in init_flashx.c by default to be at address 0x00000000.

0 Kudos

531 Views
w2vy
Contributor V

I am using MQX 4.0 but that it's not released yet.

Do you have any ETA?

Tom

0 Kudos