From 83cd02e50170b7a711badaaea06d5ad2b4da0af9 Mon Sep 17 00:00:00 2001 From: TomoYamanaka Date: Tue, 26 Jun 2018 19:17:59 +0900 Subject: [PATCH] Improve the process for Cortex-A9 in mbed_application I added the powerdown func by GIC in mbed_application because Cortex-A9 use GIC instead of NVIC. This process prevent unexpected interrupt when updating software by using bootloader. --- platform/mbed_application.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/mbed_application.c b/platform/mbed_application.c index e94ef083b8..9953130bfd 100644 --- a/platform/mbed_application.c +++ b/platform/mbed_application.c @@ -23,11 +23,33 @@ #if defined(__CORTEX_A9) +static void powerdown_gic(void); + void mbed_start_application(uintptr_t address) { + __disable_irq(); + powerdown_gic(); + __enable_irq(); ((void(*)())address)(); } +static void powerdown_gic() +{ + int i; + int j; + + for (i = 0; i < 32; i++) { + GICDistributor->ICENABLER[i] = 0xFFFFFFFF; + GICDistributor->ICPENDR[i] = 0xFFFFFFFF; + if (i < 4) { + GICDistributor->CPENDSGIR[i] = 0xFFFFFFFF; + } + for (j = 0; j < 8; j++) { + GICDistributor->IPRIORITYR[i*8+j] = 0x00000000; + } + } +} + #else static void powerdown_nvic(void);