Thank you, but I encountered a problem when using C40_SP for flash operations:
the boot is at core0 0x00400000, and when I perform a write operation on the address of core0 (0x00440000), it enters a hard fault. I confirm that the boot area code is only before 0x00440000 and there is no out of bounds issue, but operating on core1 area (0x00600000) with the same code is not a problem. What is the reason for this.
My rewrote code is as follow
/************ erase code******************/
if (C40_IP_STATUS_SECTOR_PROTECTED == C40_Ip_GetLock(sector_number)) {
printf("RAM: Sector %d is protected, clearing lock\r\n", sector_number);
C40_Ip_ClearLock(sector_number, 0);
}
C40_Ip_MainInterfaceSectorErase(sector_number, 0);do {
t_ReturnValue = C40_Ip_MainInterfaceSectorEraseStatus();
} while (C40_IP_STATUS_BUSY == t_ReturnValue);
/************ write code******************/
C40_Ip_MainInterfaceWrite(addr, length, data, 0);
do {
t_ReturnValue = C40_Ip_MainInterfaceWriteStatus();
} while (C40_IP_STATUS_BUSY == t_ReturnValue);