drivers: timer: cortex_m_systick: improve ISR installation
A Cortex-M specific function (sys_clock_isr()) was defined as a weak function, so in practice it was always available when system clock was enabled, even if no Cortex-M systick was available. This patch introduces an auxiliary Kconfig option that, when selected, the ISR function gets installed. External SysTick drivers can also make use of this function, thus achieving the same functionality offered today but in a cleaner way. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
78dc8ce338
commit
7d1bfb51ae
4 changed files with 13 additions and 11 deletions
|
@ -80,14 +80,12 @@ SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,_vector_table)
|
|||
.word z_arm_exc_spurious
|
||||
#endif
|
||||
#if defined(CONFIG_CPU_CORTEX_M_HAS_SYSTICK)
|
||||
#if defined(CONFIG_SYS_CLOCK_EXISTS)
|
||||
/* Install sys_clock_isr even if CORTEX_M_SYSTICK is not set
|
||||
* (e.g. to support out-of-tree SysTick-based timer drivers).
|
||||
*/
|
||||
#if defined(CONFIG_SYS_CLOCK_EXISTS) && \
|
||||
defined(CONFIG_CORTEX_M_SYSTICK_INSTALL_ISR)
|
||||
.word sys_clock_isr
|
||||
#else
|
||||
.word z_arm_exc_spurious
|
||||
#endif /* CONFIG_SYS_CLOCK_EXISTS */
|
||||
#endif /* CONFIG_SYS_CLOCK_EXISTS && CONFIG_CORTEX_M_SYSTICK_INSTALL_ISR */
|
||||
#else
|
||||
.word 0
|
||||
#endif /* CONFIG_CPU_CORTEX_M_HAS_SYSTICK */
|
||||
|
|
|
@ -17,6 +17,14 @@ config CORTEX_M_SYSTICK
|
|||
$(dt_compat_enabled,$(DT_COMPAT_ARM_V8_1M_SYSTICK))
|
||||
select TICKLESS_CAPABLE
|
||||
select SYSTEM_TIMER_HAS_DISABLE_SUPPORT
|
||||
select CORTEX_M_SYSTICK_INSTALL_ISR
|
||||
help
|
||||
This module implements a kernel device driver for the Cortex-M processor
|
||||
SYSTICK timer and provides the standard "system clock driver" interfaces.
|
||||
|
||||
config CORTEX_M_SYSTICK_INSTALL_ISR
|
||||
bool
|
||||
depends on CPU_CORTEX_M_HAS_SYSTICK
|
||||
help
|
||||
This option should be selected by SysTick-based drivers so that the
|
||||
sys_clock_isr() function is installed.
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
|
||||
/* Weak-linked noop defaults for optional driver interfaces*/
|
||||
|
||||
void __weak sys_clock_isr(void *arg)
|
||||
{
|
||||
__ASSERT_NO_MSG(false);
|
||||
}
|
||||
|
||||
void __weak sys_clock_set_timeout(int32_t ticks, bool idle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -105,7 +105,8 @@ __imx_boot_ivt_section void (* const image_vector_table[])(void) = {
|
|||
z_arm_debug_monitor, /* 0x30 */
|
||||
(void (*)())image_vector_table, /* 0x34, imageLoadAddress. */
|
||||
z_arm_pendsv, /* 0x38 */
|
||||
#if defined(CONFIG_SYS_CLOCK_EXISTS)
|
||||
#if defined(CONFIG_SYS_CLOCK_EXISTS) && \
|
||||
defined(CONFIG_CORTEX_M_SYSTICK_INSTALL_ISR)
|
||||
sys_clock_isr, /* 0x3C */
|
||||
#else
|
||||
z_arm_exc_spurious,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue