Direct access to flash

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Direct access to flash

907 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by simm on Wed Apr 06 00:18:24 MST 2011
Hi
I want to write directly to flash LPC1114 to address some volue.

eg.  *(uint32_t *) (0x00007FF0UL) = 0x1122;
But it doesn't work.

I want to save at specified address information about vesion of my Bootloader and application. This info must be read/write by bootloader or application.

Is it possible to save some volue in flash at specified address?
0 项奖励
回复
2 回复数

883 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by simm on Thu Apr 07 04:43:35 MST 2011
I use IAP functions but I have still a problem with saving value in Flash.
I use function similar like in example with secendary bootloader but it doesn't work correcly.

This function work only if I program application by Hyperterminal and use this function.
When I want to save some value without programming app it doesn't work.
Do you know where is a problem?

*****************************************************************************/
static uint32_t u32Bootloader_WriteVerInfo(uint16_t AssressWordOffset, uint32_t Value)
{
uint32_t ind;
uint32_t u32Result = 0;
uint32_t a32DummyData[IAP_FLASH_PAGE_SIZE_WORDS];
uint32_t *pu32Mem = (uint32_t *)(APP_END_ADDR - IAP_FLASH_PAGE_SIZE_BYTES);

/* First copy the data that is currently present in the last page of
   flash into a temporary buffer */
for (ind = 0 ; ind < IAP_FLASH_PAGE_SIZE_WORDS; ind++)
{
a32DummyData[ind] = *pu32Mem++;
}

ind=((VERINFO_ADDR & 0xFF)>>2) + AssressWordOffset;
a32DummyData[ind] = (uint32_t)Value;


if (u32IAP_PrepareSectors(APP_END_SECTOR, APP_END_SECTOR) == IAP_STA_CMD_SUCCESS)
{
/* Now write the data back */
if (u32IAP_CopyRAMToFlash((APP_END_ADDR - IAP_FLASH_PAGE_SIZE_BYTES),(uint32_t)a32DummyData,IAP_FLASH_PAGE_SIZE_BYTES) == IAP_STA_CMD_SUCCESS)
{
/* Check that the write was successful */
if (u32IAP_Compare((APP_END_ADDR - IAP_FLASH_PAGE_SIZE_BYTES),(uint32_t)a32DummyData, IAP_FLASH_PAGE_SIZE_BYTES, 0) == IAP_STA_CMD_SUCCESS)
{
u32Result = 1;
}
}
}
return (u32Result);

}
0 项奖励
回复

883 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Apr 06 01:26:01 MST 2011
Suggest you read the IAP chapter in the user manual, which tells you how to use ROM functions to program the flash. As you have found, you cannot 'just write' to flash.
0 项奖励
回复