Skip to content

Commit 5664ddd

Browse files
erwangocarlescufi
authored andcommitted
drivers/flash: stm32h7: Cache handling is limited to M7 core
There is no cache management on M4 side of the flash controller. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 5bc01c3 commit 5664ddd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/flash/flash_stm32h7x.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,22 +357,25 @@ static int flash_stm32h7_write_protection(const struct device *dev, bool enable)
357357
return rc;
358358
}
359359

360+
#ifdef CONFIG_CPU_CORTEX_M7
360361
static void flash_stm32h7_flush_caches(const struct device *dev,
361362
off_t offset, size_t len)
362363
{
363364
ARG_UNUSED(dev);
364365
SCB_InvalidateDCache_by_Addr((uint32_t *)(CONFIG_FLASH_BASE_ADDRESS
365366
+ offset), len);
366367
}
367-
368+
#endif /* CONFIG_CPU_CORTEX_M7 */
368369

369370
static int flash_stm32h7_erase(const struct device *dev, off_t offset,
370371
size_t len)
371372
{
372373
int rc;
374+
#ifdef CONFIG_CPU_CORTEX_M7
373375
off_t flush_offset = get_sector(offset) * FLASH_SECTOR_SIZE;
374376
size_t flush_len = (((get_sector(offset + len) + 1) * FLASH_SECTOR_SIZE)
375377
- flush_offset);
378+
#endif /* CONFIG_CPU_CORTEX_M7 */
376379

377380
if (!flash_stm32_valid_range(dev, offset, len, true)) {
378381
LOG_ERR("Erase range invalid. Offset: %ld, len: %zu",
@@ -390,8 +393,10 @@ static int flash_stm32h7_erase(const struct device *dev, off_t offset,
390393

391394
rc = flash_stm32_block_erase_loop(dev, offset, len);
392395

396+
#ifdef CONFIG_CPU_CORTEX_M7
393397
/* Flush cache on all sectors affected by the erase */
394398
flash_stm32h7_flush_caches(dev, flush_offset, flush_len);
399+
#endif /* CONFIG_CPU_CORTEX_M7 */
395400

396401
flash_stm32_sem_give(dev);
397402

0 commit comments

Comments
 (0)