zephyr: Turn off cache for Cortex M7 before chain-loading. The new image will fail otherwise.

Signed-off-by: Arvid Rosén <arvid@softube.com>
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 4050f4c..0efc5a8 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -128,6 +128,13 @@
     vt = (struct arm_vector_table *)(flash_base +
                                      rsp->br_image_off +
                                      rsp->br_hdr->ih_hdr_size);
+
+#ifdef CONFIG_CPU_CORTEX_M7
+    /* Disable instruction cache and data cache before chain-load the application */
+    SCB_DisableDCache();
+    SCB_DisableICache();
+#endif
+
     irq_lock();
 #ifdef CONFIG_SYS_CLOCK_EXISTS
     sys_clock_disable();