mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
189:f392fc9709a3
Parent:
187:0387e8f68319
--- a/platform/mbed_application.c	Thu Nov 08 11:46:34 2018 +0000
+++ b/platform/mbed_application.c	Wed Feb 20 22:31:08 2019 +0000
@@ -1,5 +1,6 @@
 /* mbed Microcontroller Library
  * Copyright (c) 2017-2017 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
 #include <stdarg.h>
 #include "device.h"
 #include "platform/mbed_application.h"
+#include "platform/mbed_mpu_mgmt.h"
 
 #if MBED_APPLICATION_SUPPORT
 
@@ -45,7 +47,7 @@
             GICDistributor->CPENDSGIR[i] = 0xFFFFFFFF;
         }
         for (j = 0; j < 8; j++) {
-            GICDistributor->IPRIORITYR[i*8+j] = 0x00000000;
+            GICDistributor->IPRIORITYR[i * 8 + j] = 0x00000000;
         }
     }
 }
@@ -67,6 +69,18 @@
     SysTick->CTRL = 0x00000000;
     powerdown_nvic();
     powerdown_scb(address);
+    mbed_mpu_manager_deinit();
+
+#ifdef MBED_DEBUG
+    // Configs to make debugging easier
+#ifdef SCnSCB_ACTLR_DISDEFWBUF_Msk
+    // Disable write buffer to make BusFaults (eg write to ROM via NULL pointer) precise.
+    // Possible on Cortex-M3 and M4, not on M0, M7 or M33.
+    // Would be less necessary if ROM was write-protected in MPU to give a
+    // precise MemManage exception.
+    SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;
+#endif
+#endif
 
     sp = *((void **)address + 0);
     pc = *((void **)address + 1);