From 74f33d57c5ab5b7fc16dfc94727643b6aee76110 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 12 Apr 2020 21:05:15 +1000 Subject: [PATCH] HAL_ChibiOS: avoid unnecessary H7 flash writes --- libraries/AP_HAL_ChibiOS/hwdef/common/flash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c b/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c index 50806ae3bb..b25153fe1a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c @@ -448,7 +448,8 @@ static bool stm32_flash_write_h7(uint32_t addr, const void *buf, uint32_t count) } stm32_flash_unlock(); while (count >= 32) { - if (!stm32h7_flash_write32(addr, b)) { + if (memcmp((void*)addr, b, 32) != 0 && + !stm32h7_flash_write32(addr, b)) { return false; } // check contents