"Flash_VerifyErase" does not work on PRINCE regions

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

"Flash_VerifyErase" does not work on PRINCE regions

974 次查看
awseiger
Contributor I

I have been using Flash_VerifyErase() to ensure I do not read an erased flash page and cause a hard fault. This has been working reliably until I turned on PRINCE flash encryption.

For some reason, Flash_VerifyErase() does not detect an erased region of PRINCE flash and causes a hard fault when I perform a read. The function Flash_read() does not appear to work, so as it stands I do not have a way to ensure I do not hard fault while reading Flash.

Is there a different function for detecting PRINCE erase? How can I prevent hard faulting when PRINCE is enabled?

0 项奖励
回复
2 回复数

964 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alexander,

Can you tell us the part number you are using? Do you use LPC55xx family?

Anyway, I suggest you refer to AN12527.pdf and AN12527SW.zip which can be downloaded from the following link:

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mc...

 

If you still have issue, pls post all your code so that we can have a review.

BR

Xiangjun Rong

0 项奖励
回复

955 次查看
awseiger
Contributor I

Yes, this is for the LPC55S69, version 1B silicon - sorry I forgot that information before!

Please see my code, attached below. The commented portion is the recommended way to do Flash reads, but this section of code no longer works when PRINCE is enabled. Before I enabled PRINCE, I had this commented block inside the "else if" where the memcpy now lives.

	status_t status = FLASH_VerifyErase(&flash_instance, addr, PflashPageSize);

	if(status == kStatus_Success)
	{
		memset(data, 0xFF, len);
		return len;
	}
	else if(status == kStatus_FLASH_CommandFailure)
	{
		memcpy(data, (void*)addr, len);
	}
	else
	{
		return -1;
	}

//	status = FLASH_Read(&flash_instance, addr, data, len);
//
//	if(status == kStatus_FLASH_EccError)
//	{
//		memset(data, 0xFF, len);
//		return len;
//	}
//	else if(status != kStatus_Success)
//	{
//		return -1;
//	}
0 项奖励
回复