diff --git a/arch/arm/core/cortex_m/Kconfig b/arch/arm/core/cortex_m/Kconfig index 69793431c36..63003d55421 100644 --- a/arch/arm/core/cortex_m/Kconfig +++ b/arch/arm/core/cortex_m/Kconfig @@ -178,19 +178,6 @@ config SW_ISR_TABLE a parameter to be passed to the interrupt handlers. Also, invoking the exeception/interrupt exit stub is automatically done. - This has to be enabled for dynamically connecting interrupt handlers - at runtime (SW_ISR_TABLE_DYNAMIC). - -config SW_ISR_TABLE_DYNAMIC - bool - prompt "Allow installing interrupt handlers at runtime" - depends on SW_ISR_TABLE - default n - help - This option enables irq_connect_dynamic(). It moves the ISR table to - SRAM so that it is writable. This has the side-effect of removing - write-protection on the ISR table. - config IRQ_VECTOR_TABLE_CUSTOM bool prompt "Projects provide a custom static IRQ part of vector table" diff --git a/arch/arm/core/cortex_m/exc_manage.c b/arch/arm/core/cortex_m/exc_manage.c index ca07f62dc4b..dfaa23c8367 100644 --- a/arch/arm/core/cortex_m/exc_manage.c +++ b/arch/arm/core/cortex_m/exc_manage.c @@ -15,58 +15,12 @@ */ /** - * @file dynamic exception management + * @file exception related routines */ -/* can only be used with non-XIP kernels, since they don't have their vector - * table in the FLASH - */ -#if !defined(CONFIG_XIP) - #include #include #include -#include -#include -#include -#include "vector_table.h" - -static inline int exc_can_be_connected(int num) -{ - static const uint16_t connectable_exceptions = ( - (1 << _EXC_MPU_FAULT) | - (1 << _EXC_BUS_FAULT) | - (1 << _EXC_USAGE_FAULT) | - (1 << _EXC_DEBUG) | - 0 - ); - - return !!(connectable_exceptions & (1 << num)); -} - -/* - * Can be initialized with garbage, it doesn't matter until the wrapper is - * inserted in the vector table, at which point the relevant entry will contain - * the pointer to the handler. - */ -sys_exc_handler_t *_sw_exc_table[_NUM_EXC] __noinit; - -extern void _exc_wrapper(void); -void sys_exc_connect(unsigned int num, sys_exc_handler_t *handler, void *unused) -{ - __ASSERT(exc_can_be_connected(num), "not a connectable exception"); - - _sw_exc_table[num] = handler; - - /* - * The compiler sets thumb bit (bit0) of the value of the _vector_table - * symbol, probably because it is in the .text section: to get the correct - * offset in the table, mask bit0. - */ - ((void **)(((uint32_t)_vector_table) & 0xfffffffe))[num] = _exc_wrapper; -} - -FUNC_ALIAS(sys_exc_connect, nanoCpuExcConnect, void); #include void sys_exc_esf_dump(NANO_ESF *esf) @@ -92,4 +46,3 @@ void sys_exc_esf_dump(NANO_ESF *esf) #endif } -#endif /* CONFIG_XIP */ diff --git a/arch/arm/core/irq_manage.c b/arch/arm/core/irq_manage.c index 2d34ba58d2a..e39f31fcd5e 100644 --- a/arch/arm/core/irq_manage.c +++ b/arch/arm/core/irq_manage.c @@ -127,66 +127,3 @@ void _irq_spurious(void *unused) __reserved(); } -#if CONFIG_SW_ISR_TABLE_DYNAMIC -/** - * @internal - * - * @brief Replace an interrupt handler by another - * - * An interrupt's ISR can be replaced at runtime. - * - * @return N/A - */ -void _irq_handler_set(unsigned int irq, - void (*new)(void *arg), - void *arg) -{ - int key = irq_lock(); - - _sw_isr_table[irq].isr = new; - _sw_isr_table[irq].arg = arg; - - irq_unlock(key); -} - -/** - * - * @brief Connect an ISR to an interrupt line - * - * is connected to interrupt line (exception #+16). No prior - * ISR can have been connected on interrupt line since the system booted. - * - * This routine will hang if another ISR was connected for interrupt line - * and ASSERT_ON is enabled; if ASSERT_ON is disabled, it will fail silently. - * - * @return the interrupt line number - */ -int _arch_irq_connect_dynamic(unsigned int irq, - unsigned int prio, - void (*isr)(void *arg), - void *arg, - uint32_t flags) -{ - ARG_UNUSED(flags); - _irq_handler_set(irq, isr, arg); - _irq_priority_set(irq, prio, flags); - return irq; -} - -/** - * - * @internal - * - * @brief Disconnect an ISR from an interrupt line - * - * Interrupt line (exception #+16) is disconnected from its ISR and - * the latter is replaced by _irq_spurious(). irq_disable() should have - * been called before invoking this routine. - * - * @return N/A - */ -void _irq_disconnect(unsigned int irq) -{ - _irq_handler_set(irq, _irq_spurious, NULL); -} -#endif /* CONFIG_SW_ISR_TABLE_DYNAMIC */ diff --git a/include/arch/arm/cortex_m/exc.h b/include/arch/arm/cortex_m/exc.h index a4df5275730..9ce280b046e 100644 --- a/include/arch/arm/cortex_m/exc.h +++ b/include/arch/arm/cortex_m/exc.h @@ -55,47 +55,6 @@ extern const NANO_ESF _default_esf; extern void _ExcExit(void); -#if !defined(CONFIG_XIP) - -/* currently, exception connecting is only available to non-XIP kernels */ - -/** - * @brief signature for an exception handler - */ - -#define sys_exc_handler_sig(x) void (x)(NANO_ESF *esf) - -/** - * @brief exception handler data type - */ - -typedef sys_exc_handler_sig(sys_exc_handler_t); - -/** - * @brief connect a handler to an exception vector - * - * Connect the @a handler to the exception vector @a num. - * - * The @a unused parameter is only there to match the x86 signature. - * - * @param num Exception vector number - * @param handler Exception handler to connect - * @param unused Unused - * - * @return N/A - */ - -extern void sys_exc_connect(unsigned int num, sys_exc_handler_t *handler, - void *unused); - -/** - * @brief alias of sys_exc_connect - * - * See sys_exc_connect(). - */ - -extern void nanoCpuExcConnect(unsigned int, sys_exc_handler_t *, void *); - /** * @brief display the contents of a exception stack frame * @@ -104,8 +63,6 @@ extern void nanoCpuExcConnect(unsigned int, sys_exc_handler_t *, void *); extern void sys_exc_esf_dump(NANO_ESF *esf); -#endif - #endif /* _ASMLANGUAGE */ #ifdef __cplusplus diff --git a/include/arch/arm/cortex_m/irq.h b/include/arch/arm/cortex_m/irq.h index dcbb7341fd2..b25d26d0806 100644 --- a/include/arch/arm/cortex_m/irq.h +++ b/include/arch/arm/cortex_m/irq.h @@ -34,16 +34,9 @@ extern "C" { #ifdef _ASMLANGUAGE GTEXT(_IntExit); -GTEXT(_arch_irq_connect_dynamic) GTEXT(_arch_irq_enable) GTEXT(_arch_irq_disable) #else -extern int _arch_irq_connect_dynamic(unsigned int irq, - unsigned int prio, - void (*isr)(void *arg), - void *arg, - uint32_t flags); - extern void _arch_irq_enable(unsigned int irq); extern void _arch_irq_disable(unsigned int irq); diff --git a/include/arch/arm/cortex_m/scripts/linker.ld b/include/arch/arm/cortex_m/scripts/linker.ld index b4665db1925..343375952fb 100644 --- a/include/arch/arm/cortex_m/scripts/linker.ld +++ b/include/arch/arm/cortex_m/scripts/linker.ld @@ -98,7 +98,6 @@ SECTIONS KEEP(*(.security_frdm_k64f)) KEEP(*(".security_frdm_k64f.*")) -#ifndef CONFIG_SW_ISR_TABLE_DYNAMIC KEEP(*(.isr_irq*)) /* sections for IRQ0-9 */ @@ -109,7 +108,6 @@ SECTIONS /* sections for IRQ100-999 */ KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9][0-9]))) -#endif _image_text_start = .; *(.text) @@ -209,19 +207,6 @@ SECTIONS __data_ram_start = .; *(.data) *(".data.*") - -#if CONFIG_SW_ISR_TABLE_DYNAMIC - KEEP(*(.isr_irq*)) - - /* sections for IRQ0-9 */ - KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9]))) - - /* sections for IRQ10-99 */ - KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9]))) - - /* sections for IRQ100-999 */ - KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9][0-9]))) -#endif } GROUP_LINK_IN(RAMABLE_REGION) SECTION_PROLOGUE (initlevel, (OPTIONAL),)