Skip to content

Commit 3254ec3

Browse files
authored
Merge pull request #11811 from jeromecoutant/PR_H7_CM4_FLASH
STM32H7 FLASH API issue with M4 core
2 parents 42d3573 + c6fdd4e commit 3254ec3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

targets/TARGET_STM/TARGET_STM32H7/flash_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,17 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
8585
status = -1;
8686
}
8787

88+
#if defined(DUAL_CORE)
89+
#if defined(CORE_CM7)
90+
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)GetSectorBase(EraseInitStruct.Sector, EraseInitStruct.Banks), GetSectorSize(EraseInitStruct.Sector));
91+
SCB_InvalidateICache();
92+
#endif /* CORE_CM7 */
93+
#else /* DUAL_CORE */
8894
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)GetSectorBase(EraseInitStruct.Sector, EraseInitStruct.Banks), GetSectorSize(EraseInitStruct.Sector));
8995
SCB_InvalidateICache();
96+
#endif /* DUAL_CORE */
97+
98+
9099

91100
HAL_FLASH_Lock();
92101
#if defined(DUAL_CORE)
@@ -133,8 +142,15 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
133142
}
134143
}
135144

145+
#if defined(DUAL_CORE)
146+
#if defined(CORE_CM7)
136147
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)StartAddress, FullSize);
137148
SCB_InvalidateICache();
149+
#endif /* CORE_CM7 */
150+
#else /* DUAL_CORE */
151+
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)StartAddress, FullSize);
152+
SCB_InvalidateICache();
153+
#endif /* DUAL_CORE */
138154

139155
HAL_FLASH_Lock();
140156
#if defined(DUAL_CORE)

0 commit comments

Comments
 (0)