diff --git a/arch/common/CMakeLists.txt b/arch/common/CMakeLists.txt index 6f84bb96351..ec2bf14eb19 100644 --- a/arch/common/CMakeLists.txt +++ b/arch/common/CMakeLists.txt @@ -9,6 +9,7 @@ zephyr_library_property(ALLOW_EMPTY TRUE) if(CONFIG_GEN_ISR_TABLES) zephyr_library_sources( + isr_tables.c sw_isr_common.c ) zephyr_library_sources_ifdef( @@ -96,19 +97,6 @@ if (DEFINED CONFIG_ARM OR DEFINED CONFIG_X86 OR DEFINED CONFIG_ARM64 OR DEFINED # Handled in ld.cmake endif() - -# isr_tables is a normal CMake library and not a zephyr_library because it -# should not be --whole-archive'd -if (CONFIG_GEN_ISR_TABLES) - add_library(isr_tables - isr_tables.c - ) - - add_dependencies(isr_tables zephyr_generated_headers) - target_link_libraries(isr_tables zephyr_interface) - zephyr_library_link_libraries(isr_tables) -endif() - if(CONFIG_COVERAGE) zephyr_compile_options($) zephyr_link_libraries_ifndef(CONFIG_NATIVE_LIBRARY $) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 7baa53b9c42..3897473371f 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -106,6 +106,7 @@ config UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY config UART_NRFX_UARTE_DIRECT_ISR bool "Use direct ISR" + default y if !MULTITHREADING config UART_NRFX_UARTE_SPURIOUS_RXTO_WORKAROUND bool diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 149a48d88b2..9b12d47fd3c 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -3461,9 +3461,11 @@ static int uarte_instance_init(const struct device *dev, IF_ENABLED(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, ( \ ISR_DIRECT_DECLARE(uarte_##idx##_direct_isr) \ { \ - ISR_DIRECT_PM(); \ + IF_ENABLED(CONFIG_MULTITHREADING, (ISR_DIRECT_PM();)) \ UARTE_GET_ISR(idx)(DEVICE_DT_GET(UARTE(idx))); \ - return 1; \ + COND_CODE_1(CONFIG_MULTITHREADING, \ + (return 1;), \ + (return 0;)) \ } \ )) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 082c15333dc..5bee0284cbd 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -56,4 +56,8 @@ config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE This feature prevents the SYSCOUNTER from sleeping when any core is in active state. +config NRF_GRTC_TIMER_ISR_DIRECT + bool "Use direct ISR" + default y if !MULTITHREADING + endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 2809d8b3d60..27945ca4db9 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -455,12 +455,35 @@ uint32_t sys_clock_elapsed(void) return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); } +#if CONFIG_NRF_GRTC_TIMER_ISR_DIRECT +ISR_DIRECT_DECLARE(nrf_grtc_irq_handler) +{ + nrfx_grtc_irq_handler(); +#if CONFIG_MULTITHREADING + ISR_DIRECT_PM(); + return 1; +#else + return 0; +#endif +} +#endif + static int sys_clock_driver_init(void) { nrfx_err_t err_code; - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, - nrfx_grtc_irq_handler, 0); +#ifdef CONFIG_NRF_GRTC_TIMER_ISR_DIRECT + IRQ_DIRECT_CONNECT(DT_IRQN(GRTC_NODE), + DT_IRQ(GRTC_NODE, priority), + nrf_grtc_irq_handler, + 0); +#else + IRQ_CONNECT(DT_IRQN(GRTC_NODE), + DT_IRQ(GRTC_NODE, priority), + nrfx_isr, + nrfx_grtc_irq_handler, + 0); +#endif #if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && NRF_GRTC_HAS_CLKSEL #if defined(CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC)