Skip to content

STM32H7 FLASH API issue with M4 core #11811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions targets/TARGET_STM/TARGET_STM32H7/flash_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,17 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
status = -1;
}

#if defined(DUAL_CORE)
#if defined(CORE_CM7)
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)GetSectorBase(EraseInitStruct.Sector, EraseInitStruct.Banks), GetSectorSize(EraseInitStruct.Sector));
SCB_InvalidateICache();
#endif /* CORE_CM7 */
#else /* DUAL_CORE */
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)GetSectorBase(EraseInitStruct.Sector, EraseInitStruct.Banks), GetSectorSize(EraseInitStruct.Sector));
SCB_InvalidateICache();
#endif /* DUAL_CORE */



HAL_FLASH_Lock();
#if defined(DUAL_CORE)
Expand Down Expand Up @@ -133,8 +142,15 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
}
}

#if defined(DUAL_CORE)
#if defined(CORE_CM7)
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)StartAddress, FullSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part does not look right? We're anyway always doing the same thing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either there should be "something else" in the #else part or these should not be any #ifdef magic here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCB_CleanInvalidateDCache_by_Addr only exist for M7 core.

  • for H743: DUAL_CORE is not defined
  • for H747: DUAL_CORE is defined, then core side is checked

SCB_InvalidateICache();
#endif /* CORE_CM7 */
#else /* DUAL_CORE */
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)StartAddress, FullSize);
SCB_InvalidateICache();
#endif /* DUAL_CORE */

HAL_FLASH_Lock();
#if defined(DUAL_CORE)
Expand Down