From ac7c5e8e367671f5f2f4f01632565a3cc410a0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 20 Mar 2019 15:47:46 +0100 Subject: [PATCH] [ion] After a reset, invalidate the data/instruction caches --- ion/src/device/shared/boot/Makefile | 2 +- ion/src/device/shared/boot/rt0.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ion/src/device/shared/boot/Makefile b/ion/src/device/shared/boot/Makefile index 7c702f7ab..2bb8d22d7 100644 --- a/ion/src/device/shared/boot/Makefile +++ b/ion/src/device/shared/boot/Makefile @@ -1,4 +1,4 @@ -src += $(addprefix ion/src/device/shared/boot/, \ +ion_device_src += $(addprefix ion/src/device/shared/boot/, \ isr.c \ rt0.cpp \ ) diff --git a/ion/src/device/shared/boot/rt0.cpp b/ion/src/device/shared/boot/rt0.cpp index 5e4b10f13..79acbdbdc 100644 --- a/ion/src/device/shared/boot/rt0.cpp +++ b/ion/src/device/shared/boot/rt0.cpp @@ -5,6 +5,7 @@ #include "../drivers/board.h" #include "../drivers/reset.h" #include "../drivers/timing.h" +#include typedef void (*cxx_constructor)(); @@ -41,8 +42,13 @@ static void __attribute__((noinline)) non_inlined_ion_main() { } void start() { - // This is where execution starts after reset. - // Many things are not initialized yet so the code here has to pay attention. + /* This is where execution starts after reset. + * Many things are not initialized yet so the code here has to pay attention. */ + + /* First of all, reset the data/instruction caches. Indeed, if we do not, "an + * UNPREDICTIBLE behavior can occur".*/ + Ion::Device::Cache::invalidateDCache(); + Ion::Device::Cache::invalidateICache(); /* Copy data section to RAM * The data section is R/W but its initialization value matters. It's stored