[PRJ] Correct the dest addr and Unlock back the Flash after an erase in FLASH_IF_INT_Write()

Change-Id: Id5b1fe757f2f2e62f255d22b2fd14d5320320031
This commit is contained in:
Giovanni Strano 2025-05-02 11:18:21 +02:00 committed by “Aya
parent 406f7a204c
commit 3416a7dd18
12 changed files with 84 additions and 12 deletions

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{

View File

@ -248,7 +248,7 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
for (page_index = start_page_index; page_index < (start_page_index + number_pages); page_index++)
{
page_address = page_index * FLASH_PAGE_SIZE + FLASH_BASE;
if (FLASH_IF_INT_IsEmpty(pDestination, length) != FLASH_IF_MEM_EMPTY)
if (FLASH_IF_INT_IsEmpty((void *)uDest, length) != FLASH_IF_MEM_EMPTY)
{
if (pAllocatedBuffer == NULL)
{
@ -272,6 +272,12 @@ static FLASH_IF_StatusTypedef FLASH_IF_INT_Write(void *pDestination, const void
current_dest = page_address;
current_source = (uint32_t)pAllocatedBuffer;
current_length = FLASH_PAGE_SIZE;
/* Unlock back the Flash */
if (HAL_OK != HAL_FLASH_Unlock())
{
ret_status = FLASH_IF_LOCK_ERROR;
}
}
else
{