Skip to content
Permalink
Browse files

arch: arm: BusFault, NMI, and HardFault in Secure state when in test

This commit enables the option to route the BusFault,
HardFault, and NMI exceptions in Secure state, when
building for Cortex-M CPUs with ARM_SECURE_FIRMWARE=y.
This allows the various test to utilize BusFault,
HardFault and NMI exceptions during testing.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg committed Aug 8, 2019
1 parent 7f74825 commit a3ee56f9a1205463319f9247d7ae214a99feca27
Showing with 25 additions and 2 deletions.
  1. +7 −0 arch/arm/core/Kconfig
  2. +3 −2 arch/arm/include/cortex_m/exc.h
  3. +15 −0 subsys/testsuite/Kconfig
@@ -105,6 +105,13 @@ comment "Secure firmware"
comment "Non-secure firmware"
depends on !ARM_SECURE_FIRMWARE

config ARM_SECURE_BUSFAULT_HARDFAULT_NMI
bool "BusFault, HardFault, and NMI target Secure state"
depends on ARM_SECURE_FIRMWARE
help
Force NMI, HardFault, and BusFault (in Mainline ARMv8-M)
exceptions as Secure exceptions.

config ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS
bool "Secure Firmware has Secure Entry functions"
depends on ARM_SECURE_FIRMWARE
@@ -112,7 +112,8 @@ static ALWAYS_INLINE void z_ExcSetup(void)
#endif /* CONFIG_ARM_SECURE_FIRMWARE */
#endif /* CONFIG_CPU_CORTEX_M_HAS_PROGRAMMABLE_FAULT_PRIOS */

#if defined(CONFIG_ARM_SECURE_FIRMWARE)
#if defined(CONFIG_ARM_SECURE_FIRMWARE) && \
!defined(CONFIG_ARM_SECURE_BUSFAULT_HARDFAULT_NMI)
/* Set NMI, Hard, and Bus Faults as Non-Secure.
* NMI and Bus Faults targeting the Secure state will
* escalate to a SecureFault or SecureHardFault.
@@ -126,7 +127,7 @@ static ALWAYS_INLINE void z_ExcSetup(void)
* in a PE with the Main Extension instead generate a
* SecureHardFault in a PE without the Main Extension.
*/
#endif /* CONFIG_ARM_SECURE_FIRMWARE */
#endif /* ARM_SECURE_FIRMWARE && !ARM_SECURE_BUSFAULT_HARDFAULT_NMI */
}

/**
@@ -111,4 +111,19 @@ config TEST_FLASH_DRIVERS
This option will help test the flash drivers. This should be enabled
only when using qemu_x86.

config TEST_ARM_CORTEX_M
bool
depends on CPU_CORTEX_M
default y
select ARM_SECURE_BUSFAULT_HARDFAULT_NMI if ARM_SECURE_FIRMWARE
help
ARM Cortex-M configuration required when testing.

Currently, this option is only utilized, to force routing
BusFault, HardFault, and NMI exceptions to Secure State,
when building a Secure ARMv8-M firmware. This will allow
the testing suite to utilize these exceptions, in tests.
Note that by default, when building with ARM_SECURE_FIRMWARE
set, these exceptions are set to target the Non-Secure state.

endmenu

0 comments on commit a3ee56f

Please sign in to comment.
You can’t perform that action at this time.