MQX的flashx改写

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

MQX的flashx改写

Jump to solution
1,001 Views
小勇邹
Contributor II

我需要使用MQXflashx来读写flash的数据。

我的芯片是mk64fn1m

例程C:\Freescale\Freescale_MQX_4_1_TWRK64F120M\mqx\examples\flashx中将flash切割成两个name"flashx:bank0"
"flashx:bank1",然后对这两个flash块进行读写操作。

我是否可以对flash重新切割,切割成好几个块,然后命名不同的文件名。

比如切割成以下几个文件,真正操作的时候单独打开读写:


 

File name


 

 

Flash 空间


 

 

flashx:file1


 

 

4KB($00000000-$00000FFF)


 

 

flashx:file2


 

 

48KB($00001000-$0000CFFF)


 

 

flashx:file3


 

 

972KB($0000D000-$000FFFFF)


 

是否可以这样切割flash?如果可以,是否可以提供改写flashx的方法?

0 Kudos
1 Solution
711 Views
RadekS
NXP Employee
NXP Employee

About your question)

I am not sure if I understood correctly, but you probably ask if/how to create three “files” where you will write by flashX. Correct?

Yes, you can do that.

Physical description of chip flash is in _flashx_kinetisN_block_map[] in flash_frfe.c file.

Note from MQX_IO_User_Guide: The blocks do not have to follow each other, so a space between blocks is acceptable. It is required that the blocks do not intersect and that they are listed in ascending order in the array by their starting address.

In your case you should edit _bsp_flashx_file_blocks[] in init_flashx.c file and specify there your “banks”/ “files” are.

This level is pure software solution and translation to hardware level is made by flashX driver. Also name of “bank” or “file” is free…

So, you can create file structure your way.

For example:

const FLASHX_FILE_BLOCK _bsp_flashx_file_blocks[] = {

    { "file1", BSP_INTERNAL_FLASH_BASE, BSP_INTERNAL_FLASH_BASE + 0x00000FFF},

    { "file2", BSP_INTERNAL_FLASH_BASE + 0x00001000, BSP_INTERNAL_FLASH_BASE + 0x0000CFFF },

    { "file3", BSP_INTERNAL_FLASH_BASE + 0x0000D000, BSP_INTERNAL_FLASH_BASE + 0x000FFFFF},

    { NULL,        0, 0 }

};

For open this bank/file you can use command like:

flash_file = fopen(FLASH_NAME, NULL);

where FLASH_NAME could be defined for example as "flashx:file1"                

Note: frdmk64f.h file contains definition __FLASHX_START_ADDR as ((void *)Image$USEDFLASH_END$Base).

This special definition causes, that __FLASHX_START_ADDR will points to place in flash where your code ends and when you will write data from this location, you don’t need care about size of your code. It is recalculated every when you build your application.


Have a great day,
RadekS

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

View solution in original post

0 Kudos
4 Replies
712 Views
RadekS
NXP Employee
NXP Employee

About your question)

I am not sure if I understood correctly, but you probably ask if/how to create three “files” where you will write by flashX. Correct?

Yes, you can do that.

Physical description of chip flash is in _flashx_kinetisN_block_map[] in flash_frfe.c file.

Note from MQX_IO_User_Guide: The blocks do not have to follow each other, so a space between blocks is acceptable. It is required that the blocks do not intersect and that they are listed in ascending order in the array by their starting address.

In your case you should edit _bsp_flashx_file_blocks[] in init_flashx.c file and specify there your “banks”/ “files” are.

This level is pure software solution and translation to hardware level is made by flashX driver. Also name of “bank” or “file” is free…

So, you can create file structure your way.

For example:

const FLASHX_FILE_BLOCK _bsp_flashx_file_blocks[] = {

    { "file1", BSP_INTERNAL_FLASH_BASE, BSP_INTERNAL_FLASH_BASE + 0x00000FFF},

    { "file2", BSP_INTERNAL_FLASH_BASE + 0x00001000, BSP_INTERNAL_FLASH_BASE + 0x0000CFFF },

    { "file3", BSP_INTERNAL_FLASH_BASE + 0x0000D000, BSP_INTERNAL_FLASH_BASE + 0x000FFFFF},

    { NULL,        0, 0 }

};

For open this bank/file you can use command like:

flash_file = fopen(FLASH_NAME, NULL);

where FLASH_NAME could be defined for example as "flashx:file1"                

Note: frdmk64f.h file contains definition __FLASHX_START_ADDR as ((void *)Image$USEDFLASH_END$Base).

This special definition causes, that __FLASHX_START_ADDR will points to place in flash where your code ends and when you will write data from this location, you don’t need care about size of your code. It is recalculated every when you build your application.


Have a great day,
RadekS

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

0 Kudos
712 Views
小勇邹
Contributor II


Hello RadekS.

Thank you very much.This is the answer that I want.I will write the question in english next time.

0 Kudos
712 Views
RadekS
NXP Employee
NXP Employee

thank you

0 Kudos
712 Views
RadekS
NXP Employee
NXP Employee

Thank you very much for contacting Freescale.   

Our support engineers are located worldwide, therefore to better support you could you please rewrite your question in English only?

I apologize for the inconvenience this may cause to you.

0 Kudos