Skip to content

Commit

Permalink
kernel: Fix usage of CONFIG_SYS_CLOCK_EXISTS
Browse files Browse the repository at this point in the history
When compiling the kernel with CONFIG_SYS_CLOCK_TICKS_PER_SEC=0,
the CONFIG_SYS_CLOCK_EXISTS internal variable is unset.
This completely disables timer handling in the kernel, but a couple of
spots missed the required conditional compilation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
  • Loading branch information
carlescufi committed May 15, 2019
1 parent 6d4a520 commit 201fdf0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm/core/cortex_m/vector_table.S
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,5 +66,9 @@ SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,_vector_table)
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
.word __reserved .word __reserved
.word __pendsv .word __pendsv
#if defined(CONFIG_SYS_CLOCK_EXISTS)
.word z_clock_isr .word z_clock_isr
#else
.word __reserved
#endif


2 changes: 2 additions & 0 deletions kernel/Kconfig
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ config SYS_CLOCK_TICKS_PER_SEC
granularity, not necessarily the number or frequency of granularity, not necessarily the number or frequency of
interrupts delivered to the kernel. interrupts delivered to the kernel.


A value of 0 completely disables timer support in the kernel.

config SYS_CLOCK_HW_CYCLES_PER_SEC config SYS_CLOCK_HW_CYCLES_PER_SEC
int "System clock's h/w timer frequency" int "System clock's h/w timer frequency"
help help
Expand Down
2 changes: 2 additions & 0 deletions kernel/work_q.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@


#define WORKQUEUE_THREAD_NAME "workqueue" #define WORKQUEUE_THREAD_NAME "workqueue"


#ifdef CONFIG_SYS_CLOCK_EXISTS
static struct k_spinlock lock; static struct k_spinlock lock;
#endif


extern void z_work_q_main(void *work_q_ptr, void *p2, void *p3); extern void z_work_q_main(void *work_q_ptr, void *p2, void *p3);


Expand Down
2 changes: 2 additions & 0 deletions subsys/power/reboot.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ extern void sys_clock_disable(void);
void sys_reboot(int type) void sys_reboot(int type)
{ {
(void)irq_lock(); (void)irq_lock();
#ifdef CONFIG_SYS_CLOCK_EXISTS
sys_clock_disable(); sys_clock_disable();
#endif


sys_arch_reboot(type); sys_arch_reboot(type);


Expand Down

0 comments on commit 201fdf0

Please sign in to comment.