-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
TL;DR:
CONFIG_USERSPACE=y + CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME=y = No reference for k_cycle_get_32().
The CONFIG_USERSPACE option introduces strong separation between the application and the
kernel memory. The CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME makes the CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC define useless leaving the sys_clock_hw_cycles_per_sec() function the only source of system timer frequency, which is needed to interpret data from k_cycle_get_32().
Unfortunately, the sys_clock_hw_cycles_per_sec() function directly reads the kernel memory (z_clock_hw_cycles_per_sec) triggering exception when called from user thread.
Please also note, that sys_clock_hw_cycles_per_sec() is used in multiple inline functions, so other timing-related API also fails with the mentioned configuration.