我又来了,呵呵! 我现在参考了你的那个KL16的例程,从flash中读取的信息,不是自己写的内容,而是程序的rom中的内容,
88 899 bytes of readonly code memory
21 133 bytes of readonly data memory
15 933 bytes of readwrite data memory
以上是我的编译的情况,也就是说程序大小没有超过120K(0x1e000)。我现在对0x1e000开始操作,写入参考例程中的“Hello world“字符;可是我再从这个地方读取写入的内容,结果不是写入的数据,其他地方也再没有操作flash的行为,读出的数据是readonly段的数据,我查看了bin文件,发现他输出的数据,存在我的bin件中,在我程序中有这句printf("heap remaining = %d\n", ath_memquery.heap);结果从0x1e000读取的数据显示是”remaining =“,所以我断定是从readonly处读出了数据,不知道为何是这样,应该是要读出0x1e000的数据才对。以下是代码片段,供参考
MyFLASH_Ptr = FLASH1_Init(NULL);
Error = FLASH1_Write(MyFLASH_Ptr, Data, 0x1E000, sizeof(Data)); /* Start writing to the flash memory */
/* Here some other application code can be placed */
do {
FLASH1_Main(MyFLASH_Ptr);
OpStatus = FLASH1_GetOperationStatus(MyFLASH_Ptr);
} while (!((OpStatus == LDD_FLASH_IDLE) | (OpStatus == LDD_FLASH_FAILED)));
// read data from MY_FLASH_LOCATION
Error = FLASH1_Read(MyFLASH_Ptr, 0x1E000, Buffer, sizeof(Buffer)); /* Start reading from the flash memory */
do {
FLASH1_Main(MyFLASH_Ptr);
OpStatus = FLASH1_GetOperationStatus(MyFLASH_Ptr);
} while (!((OpStatus == LDD_FLASH_IDLE) | (OpStatus == LDD_FLASH_FAILED)));
if (OpStatus == LDD_FLASH_FAILED) { /* Check if the operation has successfully ended */
/* Error state solution */
}
C:\Users\antling\Desktop\test.png
|