As part of work to improve the debugging of exceptions, have
Mbed OS make an effort to make exceptions more precise in debug builds
at the cost of performance.
Related pyOCD work:
https://github.com/mbedmicro/pyOCD/pull/430
Enable the MPU as part of the boot sequence and disable it before
starting a new application. Also add reference counted MPU lock and
unlock functions to allow code to execute from ram when necessary.
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.
I added the process for Cortex-A in mbed_application.c because this process was for only Cortex-M.
Also I enabled the macro of MBED_APPLICATION_SUPPORT for Cortex-A.
With "mov r2, #0", compile OK with GCC_ARM, but failed with ARMC6.
With "ldr r2, =0", compile OK with ARMC6, but failed with GCC_ARM.
Finally, with "movw r2, #0"/"movt r2, #0", compile OK with both ARMC6 and GCC_ARM.
Fix a calculation error in in powerdown_nvic preventing the last
group of 32 interrupts from getting powered down. The ARMv7m reference
manual states "the total number of interrupt lines is up
to (32*(INTLINESNUM+1)).".
Also rename isr_count to isr_groups_32 for clarity, since this is
actually the number of 32 interrupt groups.