I am trying to read data from Pflash and Dflash from MK20DX256 by using C90TFS library in KSDK 1.3.
But I cannot find read function in the library. Then how do you guys read data from the flash?
Regarding your question, as you know that the ARM architecture uses the normalized address space for the program/data flash, SRAM and peripheral, special commands are required to erase/program flash, but you can read a flash address as you read a RAM address.
you can read flash or RAM using the following macro based on the data width you access.
for example, you can use the following code to access flash no matter whether the flash save data or code.
uint16_t value, i, *pSrc, *pDest;
I was trying for several hours to read program flash using the FlashReadResource() function. After reading this post I tried the READ32() macro, and it just worked. Yay!
It's strange to me that the C90TFS library has 2 functions to read the P-Flash IFR(FlashReadResource, and ReadOnce), but neither can read the basic program flash. If you try to pass in an absolute address, e.g. 0x7E000 for a 512KB MKW2x chip, the FlashReadResource function will return an access error (ACCERR). After lots of reading I realized that the access error is because these functions are only supposed to access IFR memory (see Table 35-44 of the MKW2x reference manual for valid local address ranges).
Thanks for the info XiangJun Rong!
Retrieving data ...