diff --git a/boards/arc/arduino_101_sss/arduino_101_sss_defconfig b/boards/arc/arduino_101_sss/arduino_101_sss_defconfig index 9492e52e64151..4ae6e67ec5432 100644 --- a/boards/arc/arduino_101_sss/arduino_101_sss_defconfig +++ b/boards/arc/arduino_101_sss/arduino_101_sss_defconfig @@ -3,7 +3,6 @@ CONFIG_ARC=y CONFIG_SOC_QUARK_SE_C1000_SS=y CONFIG_BOARD_ARDUINO_101_SSS=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 CONFIG_XIP=y CONFIG_PRINTK=y diff --git a/boards/arc/em_starterkit/em_starterkit_defconfig b/boards/arc/em_starterkit/em_starterkit_defconfig index 15414a2995185..09fc75787a9fd 100644 --- a/boards/arc/em_starterkit/em_starterkit_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_defconfig @@ -5,7 +5,6 @@ CONFIG_SOC_EMSK=y CONFIG_SOC_EMSK_EM9D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R23=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_XIP=n CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/em_starterkit/em_starterkit_em11d_defconfig b/boards/arc/em_starterkit/em_starterkit_em11d_defconfig index 0dd02c0bbb52d..52c89a9dfde31 100644 --- a/boards/arc/em_starterkit/em_starterkit_em11d_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_em11d_defconfig @@ -5,7 +5,6 @@ CONFIG_SOC_EMSK=y CONFIG_SOC_EMSK_EM11D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R23=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_XIP=n CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/em_starterkit/em_starterkit_em7d_defconfig b/boards/arc/em_starterkit/em_starterkit_em7d_defconfig index 77ab17a9c6a31..457315494d4bd 100644 --- a/boards/arc/em_starterkit/em_starterkit_em7d_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_em7d_defconfig @@ -5,7 +5,6 @@ CONFIG_SOC_EMSK=y CONFIG_SOC_EMSK_EM7D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R23=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_XIP=n CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig b/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig index bdbcb53f252fd..2b41c70d6924c 100644 --- a/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig @@ -5,7 +5,6 @@ CONFIG_SOC_EMSK=y CONFIG_SOC_EMSK_EM7D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R22=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_XIP=n CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/iotdk/iotdk_defconfig b/boards/arc/iotdk/iotdk_defconfig index f69414846b510..686b1264cfbe0 100644 --- a/boards/arc/iotdk/iotdk_defconfig +++ b/boards/arc/iotdk/iotdk_defconfig @@ -3,7 +3,6 @@ CONFIG_ARC=y CONFIG_SOC_ARC_IOT=y CONFIG_BOARD_IOTDK=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_XIP=n CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/quark_se_c1000_ss_devboard/quark_se_c1000_ss_devboard_defconfig b/boards/arc/quark_se_c1000_ss_devboard/quark_se_c1000_ss_devboard_defconfig index 2d32dceb29c76..82ee4970d0227 100644 --- a/boards/arc/quark_se_c1000_ss_devboard/quark_se_c1000_ss_devboard_defconfig +++ b/boards/arc/quark_se_c1000_ss_devboard/quark_se_c1000_ss_devboard_defconfig @@ -3,7 +3,6 @@ CONFIG_ARC=y CONFIG_SOC_QUARK_SE_C1000_SS=y CONFIG_BOARD_QUARK_SE_C1000_DEVBOARD_SS=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 CONFIG_XIP=y CONFIG_PRINTK=y diff --git a/boards/arm/96b_argonkey/96b_argonkey_defconfig b/boards/arm/96b_argonkey/96b_argonkey_defconfig index 0f08a3092f070..5e3b9c597e20e 100644 --- a/boards/arm/96b_argonkey/96b_argonkey_defconfig +++ b/boards/arm/96b_argonkey/96b_argonkey_defconfig @@ -7,7 +7,6 @@ CONFIG_CORTEX_M_SYSTICK=y # 84MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=84000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # enable uart driver CONFIG_SERIAL=y diff --git a/boards/arm/96b_carbon/96b_carbon_defconfig b/boards/arm/96b_carbon/96b_carbon_defconfig index 7e12df46884e4..53898d992f397 100644 --- a/boards/arm/96b_carbon/96b_carbon_defconfig +++ b/boards/arm/96b_carbon/96b_carbon_defconfig @@ -7,7 +7,6 @@ CONFIG_CORTEX_M_SYSTICK=y # 84MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=84000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/96b_neonkey/96b_neonkey_defconfig b/boards/arm/96b_neonkey/96b_neonkey_defconfig index 4f57013337be3..27b171e16bc45 100644 --- a/boards/arm/96b_neonkey/96b_neonkey_defconfig +++ b/boards/arm/96b_neonkey/96b_neonkey_defconfig @@ -7,7 +7,6 @@ CONFIG_CORTEX_M_SYSTICK=y # 84MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=84000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # enable uart driver CONFIG_SERIAL=y diff --git a/boards/arm/96b_stm32_sensor_mez/96b_stm32_sensor_mez_defconfig b/boards/arm/96b_stm32_sensor_mez/96b_stm32_sensor_mez_defconfig index 261e2773788cb..47b9b78d8cb20 100644 --- a/boards/arm/96b_stm32_sensor_mez/96b_stm32_sensor_mez_defconfig +++ b/boards/arm/96b_stm32_sensor_mez/96b_stm32_sensor_mez_defconfig @@ -8,7 +8,6 @@ CONFIG_CORTEX_M_SYSTICK=y # 84MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=84000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/disco_l475_iot1/disco_l475_iot1_defconfig b/boards/arm/disco_l475_iot1/disco_l475_iot1_defconfig index c51404249da98..d2d32663dd27b 100644 --- a/boards/arm/disco_l475_iot1/disco_l475_iot1_defconfig +++ b/boards/arm/disco_l475_iot1/disco_l475_iot1_defconfig @@ -5,7 +5,6 @@ CONFIG_BOARD_DISCO_L475_IOT1=y CONFIG_SOC_SERIES_STM32L4X=y CONFIG_SOC_STM32L475XX=y CONFIG_CORTEX_M_SYSTICK=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # enable uart driver CONFIG_SERIAL=y diff --git a/boards/arm/mikroe_mini_m4_for_stm32/mikroe_mini_m4_for_stm32_defconfig b/boards/arm/mikroe_mini_m4_for_stm32/mikroe_mini_m4_for_stm32_defconfig index 3d755828b3010..62488a9cd53e9 100644 --- a/boards/arm/mikroe_mini_m4_for_stm32/mikroe_mini_m4_for_stm32_defconfig +++ b/boards/arm/mikroe_mini_m4_for_stm32/mikroe_mini_m4_for_stm32_defconfig @@ -5,7 +5,6 @@ CONFIG_SOC_STM32F415XX=y # 168MHz system clock CONFIG_CORTEX_M_SYSTICK=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f207zg/nucleo_f207zg_defconfig b/boards/arm/nucleo_f207zg/nucleo_f207zg_defconfig index 60cf723c75cfa..4fb325f458801 100644 --- a/boards/arm/nucleo_f207zg/nucleo_f207zg_defconfig +++ b/boards/arm/nucleo_f207zg/nucleo_f207zg_defconfig @@ -6,7 +6,6 @@ CONFIG_SOC_SERIES_STM32F2X=y CONFIG_SOC_STM32F207XX=y CONFIG_CORTEX_M_SYSTICK=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 CONFIG_SERIAL=y diff --git a/boards/arm/nucleo_f302r8/nucleo_f302r8_defconfig b/boards/arm/nucleo_f302r8/nucleo_f302r8_defconfig index d9ccefa129eff..5b96a90db71d6 100644 --- a/boards/arm/nucleo_f302r8/nucleo_f302r8_defconfig +++ b/boards/arm/nucleo_f302r8/nucleo_f302r8_defconfig @@ -6,7 +6,6 @@ CONFIG_SOC_STM32F302X8=y CONFIG_CORTEX_M_SYSTICK=y # 72 MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 CONFIG_SERIAL=y diff --git a/boards/arm/nucleo_f401re/nucleo_f401re_defconfig b/boards/arm/nucleo_f401re/nucleo_f401re_defconfig index 3e7dcc1cd1b51..da0333f84ecb3 100644 --- a/boards/arm/nucleo_f401re/nucleo_f401re_defconfig +++ b/boards/arm/nucleo_f401re/nucleo_f401re_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F401XE=y CONFIG_CORTEX_M_SYSTICK=y # 84MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=84000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f411re/nucleo_f411re_defconfig b/boards/arm/nucleo_f411re/nucleo_f411re_defconfig index b363ba79a1d97..9f3f9c15050a4 100644 --- a/boards/arm/nucleo_f411re/nucleo_f411re_defconfig +++ b/boards/arm/nucleo_f411re/nucleo_f411re_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F411XE=y CONFIG_CORTEX_M_SYSTICK=y # 96MHz system clock (highest value to get a precise USB clock) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f412zg/nucleo_f412zg_defconfig b/boards/arm/nucleo_f412zg/nucleo_f412zg_defconfig index 8d33e9099b7b9..ea5f2b0281344 100644 --- a/boards/arm/nucleo_f412zg/nucleo_f412zg_defconfig +++ b/boards/arm/nucleo_f412zg/nucleo_f412zg_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F412ZG=y CONFIG_CORTEX_M_SYSTICK=y # 96MHz system clock (highest value to get a precise USB clock) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig b/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig index 610f287768f42..e45c3014e229f 100644 --- a/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig +++ b/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F413XX=y CONFIG_CORTEX_M_SYSTICK=y # 96MHz system clock (highest value to get a precise USB clock) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f429zi/nucleo_f429zi_defconfig b/boards/arm/nucleo_f429zi/nucleo_f429zi_defconfig index 22de8a3af8dd1..a3845865d2608 100644 --- a/boards/arm/nucleo_f429zi/nucleo_f429zi_defconfig +++ b/boards/arm/nucleo_f429zi/nucleo_f429zi_defconfig @@ -6,7 +6,6 @@ CONFIG_SOC_STM32F429XX=y CONFIG_CORTEX_M_SYSTICK=y # 168MHz system clock (highest value to get a precise USB clock) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f446re/nucleo_f446re_defconfig b/boards/arm/nucleo_f446re/nucleo_f446re_defconfig index 73840f749bc6c..2e5b4c217495a 100644 --- a/boards/arm/nucleo_f446re/nucleo_f446re_defconfig +++ b/boards/arm/nucleo_f446re/nucleo_f446re_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F446XX=y CONFIG_CORTEX_M_SYSTICK=y # 96MHz system clock (highest value to get a precise USB clock) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f746zg/nucleo_f746zg_defconfig b/boards/arm/nucleo_f746zg/nucleo_f746zg_defconfig index f57de499da87f..34c6222b4d354 100644 --- a/boards/arm/nucleo_f746zg/nucleo_f746zg_defconfig +++ b/boards/arm/nucleo_f746zg/nucleo_f746zg_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F746XX=y CONFIG_CORTEX_M_SYSTICK=y # 72MHz system clock (CubeMX Defaults) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_f756zg/nucleo_f756zg_defconfig b/boards/arm/nucleo_f756zg/nucleo_f756zg_defconfig index 3ec3bc6dd3731..303071bb0de65 100644 --- a/boards/arm/nucleo_f756zg/nucleo_f756zg_defconfig +++ b/boards/arm/nucleo_f756zg/nucleo_f756zg_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F756XX=y CONFIG_CORTEX_M_SYSTICK=y # 72MHz system clock (CubeMX Defaults) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/nucleo_l053r8/nucleo_l053r8_defconfig b/boards/arm/nucleo_l053r8/nucleo_l053r8_defconfig index d484e27cb3c90..aaa47cc692da3 100644 --- a/boards/arm/nucleo_l053r8/nucleo_l053r8_defconfig +++ b/boards/arm/nucleo_l053r8/nucleo_l053r8_defconfig @@ -12,7 +12,6 @@ CONFIG_BOARD_NUCLEO_L053R8=y # General Kernel Options CONFIG_CORTEX_M_SYSTICK=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Kernel Options due to Low Memory (8k) CONFIG_MAIN_STACK_SIZE=640 diff --git a/boards/arm/nucleo_wb55rg/nucleo_wb55rg_defconfig b/boards/arm/nucleo_wb55rg/nucleo_wb55rg_defconfig index 44b6f189201dd..524f5f20a6f7d 100644 --- a/boards/arm/nucleo_wb55rg/nucleo_wb55rg_defconfig +++ b/boards/arm/nucleo_wb55rg/nucleo_wb55rg_defconfig @@ -4,7 +4,6 @@ CONFIG_SOC_STM32WB55XX=y CONFIG_CORTEX_M_SYSTICK=y # 32MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # enable uart driver CONFIG_SERIAL=y diff --git a/boards/arm/olimex_stm32_e407/olimex_stm32_e407_defconfig b/boards/arm/olimex_stm32_e407/olimex_stm32_e407_defconfig index fe56bfdc6a7b7..261c059a4af06 100644 --- a/boards/arm/olimex_stm32_e407/olimex_stm32_e407_defconfig +++ b/boards/arm/olimex_stm32_e407/olimex_stm32_e407_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F407XG=y CONFIG_CORTEX_M_SYSTICK=y # 168MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/olimex_stm32_h407/olimex_stm32_h407_defconfig b/boards/arm/olimex_stm32_h407/olimex_stm32_h407_defconfig index 5333950770d85..57d0a72c722bd 100644 --- a/boards/arm/olimex_stm32_h407/olimex_stm32_h407_defconfig +++ b/boards/arm/olimex_stm32_h407/olimex_stm32_h407_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F407XG=y CONFIG_CORTEX_M_SYSTICK=y # 168MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/olimex_stm32_p405/olimex_stm32_p405_defconfig b/boards/arm/olimex_stm32_p405/olimex_stm32_p405_defconfig index 29efc222d247b..5234f3c5e644d 100644 --- a/boards/arm/olimex_stm32_p405/olimex_stm32_p405_defconfig +++ b/boards/arm/olimex_stm32_p405/olimex_stm32_p405_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F405XG=y CONFIG_CORTEX_M_SYSTICK=y # 168MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/stm32f3_disco/stm32f3_disco_defconfig b/boards/arm/stm32f3_disco/stm32f3_disco_defconfig index 6ea53565147b9..e767b78342fc1 100644 --- a/boards/arm/stm32f3_disco/stm32f3_disco_defconfig +++ b/boards/arm/stm32f3_disco/stm32f3_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F303XC=y CONFIG_CORTEX_M_SYSTICK=y # 72MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # ARM Options CONFIG_CPU_HAS_FPU=y diff --git a/boards/arm/stm32f411e_disco/stm32f411e_disco_defconfig b/boards/arm/stm32f411e_disco/stm32f411e_disco_defconfig index d66de781e635a..4a94d7aecaf17 100644 --- a/boards/arm/stm32f411e_disco/stm32f411e_disco_defconfig +++ b/boards/arm/stm32f411e_disco/stm32f411e_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F411XE=y CONFIG_CORTEX_M_SYSTICK=y # 100MHz system clock (highest value to get a precise USB clock should be 96MHz) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig b/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig index 58ff0497eabca..5ed2ea2157052 100644 --- a/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig +++ b/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F412ZG=y CONFIG_CORTEX_M_SYSTICK=y # 100MHz system clock (highest value to get a precise USB clock should be 96MHz) CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/stm32f429i_disc1/stm32f429i_disc1_defconfig b/boards/arm/stm32f429i_disc1/stm32f429i_disc1_defconfig index 1473d9851f5a7..9243449cd2f1c 100644 --- a/boards/arm/stm32f429i_disc1/stm32f429i_disc1_defconfig +++ b/boards/arm/stm32f429i_disc1/stm32f429i_disc1_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F429XX=y CONFIG_CORTEX_M_SYSTICK=y # 168MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/stm32f469i_disco/stm32f469i_disco_defconfig b/boards/arm/stm32f469i_disco/stm32f469i_disco_defconfig index 7fa0ea1347b70..0e9f92f9fdc96 100644 --- a/boards/arm/stm32f469i_disco/stm32f469i_disco_defconfig +++ b/boards/arm/stm32f469i_disco/stm32f469i_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F469XX=y CONFIG_CORTEX_M_SYSTICK=y # 180MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=180000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/stm32f4_disco/stm32f4_disco_defconfig b/boards/arm/stm32f4_disco/stm32f4_disco_defconfig index 8c726ca2be345..5f79a98f038ad 100644 --- a/boards/arm/stm32f4_disco/stm32f4_disco_defconfig +++ b/boards/arm/stm32f4_disco/stm32f4_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F407XG=y CONFIG_CORTEX_M_SYSTICK=y # 168MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 # Enable MPU CONFIG_ARM_MPU=y diff --git a/boards/arm/stm32f723e_disco/stm32f723e_disco_defconfig b/boards/arm/stm32f723e_disco/stm32f723e_disco_defconfig index c1bb9f4b65155..f76f16d631a66 100644 --- a/boards/arm/stm32f723e_disco/stm32f723e_disco_defconfig +++ b/boards/arm/stm32f723e_disco/stm32f723e_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F723XX=y CONFIG_CORTEX_M_SYSTICK=y # 216MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=216000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 CONFIG_SERIAL=y diff --git a/boards/arm/stm32f746g_disco/stm32f746g_disco_defconfig b/boards/arm/stm32f746g_disco/stm32f746g_disco_defconfig index d498e33052f04..8ee4f6c0be05d 100644 --- a/boards/arm/stm32f746g_disco/stm32f746g_disco_defconfig +++ b/boards/arm/stm32f746g_disco/stm32f746g_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F746XX=y CONFIG_CORTEX_M_SYSTICK=y # 216MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=216000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 CONFIG_SERIAL=y diff --git a/boards/arm/stm32f769i_disco/stm32f769i_disco_defconfig b/boards/arm/stm32f769i_disco/stm32f769i_disco_defconfig index 6f9492e4747cb..c27631f96e882 100644 --- a/boards/arm/stm32f769i_disco/stm32f769i_disco_defconfig +++ b/boards/arm/stm32f769i_disco/stm32f769i_disco_defconfig @@ -7,7 +7,6 @@ CONFIG_SOC_STM32F769XX=y CONFIG_CORTEX_M_SYSTICK=y # 216MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=216000000 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 CONFIG_SERIAL=y diff --git a/drivers/sensor/hp206c/hp206c.h b/drivers/sensor/hp206c/hp206c.h index 9d7c1259dff4a..76502bee0e0b0 100644 --- a/drivers/sensor/hp206c/hp206c.h +++ b/drivers/sensor/hp206c/hp206c.h @@ -74,7 +74,7 @@ struct hp206c_device_data { struct device *i2c; -#if CONFIG_SYS_CLOCK_TICKS_PER_SEC != 1000 +#if CONFIG_SYS_CLOCK_TICKS_PER_SEC < 1000 #error "driver needs millisecond tick granularity" #endif struct k_timer tmr; diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index 9f300b57344f0..cb8a9c915b11d 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -20,8 +20,6 @@ / CONFIG_SYS_CLOCK_TICKS_PER_SEC) #define MAX_TICKS ((COUNTER_MAX - CYC_PER_TICK) / CYC_PER_TICK) -#define MIN_DELAY 32 - static struct k_spinlock lock; static u32_t last_count; @@ -63,7 +61,10 @@ void rtc1_nrf_isr(void *arg) if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { u32_t next = last_count + CYC_PER_TICK; - if (counter_sub(next, t) < MIN_DELAY) { + /* As below: we're guaranteed to get an interrupt as + * long as it's set two or more cycles in the future + */ + if (counter_sub(next, t) < 3) { next += CYC_PER_TICK; } set_comparator(next); @@ -117,21 +118,80 @@ void z_clock_set_timeout(s32_t ticks, bool idle) ticks = MAX(MIN(ticks - 1, (s32_t)MAX_TICKS), 0); k_spinlock_key_t key = k_spin_lock(&lock); - u32_t cyc, t = counter(); + u32_t cyc, dt, t = counter(); + bool flagged = false; /* Round up to next tick boundary */ - cyc = ticks * CYC_PER_TICK + counter_sub(t, last_count); + cyc = ticks * CYC_PER_TICK + 1 + counter_sub(t, last_count); cyc += (CYC_PER_TICK - 1); cyc = (cyc / CYC_PER_TICK) * CYC_PER_TICK; cyc += last_count; - if (counter_sub(cyc, t) < MIN_DELAY) { - cyc += CYC_PER_TICK; + /* Per NRF docs, the RTC is guaranteed to trigger a compare + * event if the comparator value to be set is at least two + * cycles later than the current value of the counter. So if + * we're three or more cycles out, we can set it blindly. If + * not, check the time again immediately after setting: it's + * possible we "just missed it" and can flag an immediate + * interrupt. Or it could be exactly two cycles out, which + * will have worked. Otherwise, there's no way to get an + * interrupt at the right time and we have to slip the event + * by one clock cycle (or we could spin, but this is a slow + * clock and spinning for a whole cycle can be thousands of + * instructions!) + * + * You might ask: why not set the comparator first and then + * check the timer synchronously to see if we missed it, which + * would avoid the need for a slipped cycle. That doesn't + * work, the states overlap inside the counter hardware. It's + * possible to set a comparator value of "N", issue a DSB + * instruction to flush the pipeline, and then immediately + * read a counter value of "N-1" (i.e. the comparator is still + * in the future), and yet still not receive an interrupt at + * least on nRF52. Some experimentation on nrf52840 shows + * that you need to be early by about 400 processor cycles + * (about 1/5th of a RTC cycle) in order to reliably get the + * interrupt. The docs say two cycles, they mean two cycles. + */ + if (counter_sub(cyc, t) > 2) { + set_comparator(cyc); + } else { + set_comparator(cyc); + dt = counter_sub(cyc, counter()); + if (dt == 0 || dt > 0x7fffff) { + /* Missed it! */ + NVIC_SetPendingIRQ(RTC1_IRQn); + if (IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS)) { + flagged = true; + } + } else if (dt == 1) { + /* Too soon, interrupt won't arrive. */ + set_comparator(cyc + 1); + } + /* Otherwise it was two cycles out, we're fine */ } - set_comparator(cyc); - k_spin_unlock(&lock, key); +#ifdef CONFIG_ZERO_LATENCY_IRQS + /* Failsafe. ZLIs can preempt us even though interrupts are + * masked, blowing up the sensitive timing above. If enabled, + * we need a final check (in a loop! because this too can be + * interrupted) to see that the comparator is still in the + * future. Don't bother being fancy with cycle counting here, + * just set an interrupt "soon" that we know will get the + * timer back to a known state. This handles (via some hairy + * modular expressions) the wraparound cases where we are + * preempted for as much as half the counter space. + */ + if (!flagged && counter_sub(cyc, counter()) <= 0x7fffff) { + while (counter_sub(cyc, counter() + 2) > 0x7fffff) { + cyc = counter() + 3; + set_comparator(cyc); + } + } #endif + + k_spin_unlock(&lock, key); +#endif /* CONFIG_TICKLESS_KERNEL */ } u32_t z_clock_elapsed(void) diff --git a/include/kernel.h b/include/kernel.h index fe58675098d4d..d1a84c353573e 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -1684,8 +1684,7 @@ static inline void *z_impl_k_timer_user_data_get(struct k_timer *timer) * @rst * While this function returns time in milliseconds, it does * not mean it has millisecond resolution. The actual resolution depends on - * :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` config option, and with the - * default setting of 100, system time is updated in increments of 10ms. + * :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` config option. * @endrst * * @return Current uptime in milliseconds. @@ -1741,8 +1740,7 @@ __deprecated static inline void k_disable_sys_clock_always_on(void) * @rst * While this function returns time in milliseconds, it does * not mean it has millisecond resolution. The actual resolution depends on - * :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` config option, and with the - * default setting of 100, system time is updated in increments of 10ms. + * :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` config option * @endrst * * @return Current uptime in milliseconds. diff --git a/kernel/Kconfig b/kernel/Kconfig index f161fd693af91..609e6b343febc 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -529,9 +529,11 @@ config ARCH_HAS_CUSTOM_BUSY_WAIT config SYS_CLOCK_TICKS_PER_SEC int "System tick frequency (in ticks/second)" + default 100 if QEMU_TARGET || SOC_POSIX + default 10000 if TICKLESS_CAPABLE default 100 help - This option specifies the frequency of the system clock in Hz. + This option specifies the nominal frequency of the system clock in Hz. Depending on the choice made, an amount of possibly expensive math must occur when converting ticks to milliseconds and vice-versa. Some values @@ -567,10 +569,13 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC and the user should generally avoid modifying it via the menu configuration. config SYS_CLOCK_EXISTS - def_bool (SYS_CLOCK_TICKS_PER_SEC != 0) - # omit prompt to signify a "hidden" option + bool "System clock exists and is enabled" + default y help This option specifies that the kernel lacks timer support. + Some device configurations can eliminate significant code if + this is disabled. Obviously timeout-related APIs will not + work. config XIP bool "Execute in place" diff --git a/kernel/mempool.c b/kernel/mempool.c index 35c42ddf14b3a..08bc7650e0c2f 100644 --- a/kernel/mempool.c +++ b/kernel/mempool.c @@ -55,7 +55,7 @@ int k_mem_pool_alloc(struct k_mem_pool *p, struct k_mem_block *block, __ASSERT(!(z_is_in_isr() && timeout != K_NO_WAIT), ""); if (timeout > 0) { - end = z_tick_get() + z_ms_to_ticks(timeout); + end = k_uptime_get() + timeout; } while (true) { @@ -93,9 +93,8 @@ int k_mem_pool_alloc(struct k_mem_pool *p, struct k_mem_block *block, z_pend_curr_unlocked(&p->wait_q, timeout); if (timeout != K_FOREVER) { - timeout = end - z_tick_get(); - - if (timeout < 0) { + timeout = end - k_uptime_get(); + if (timeout <= 0) { break; } } diff --git a/kernel/sched.c b/kernel/sched.c index 49b78b4a995f0..a7ebb68d37481 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -255,9 +255,10 @@ static void reset_time_slice(void) * slice count, as we'll see those "expired" ticks arrive in a * FUTURE z_time_slice() call. */ - _current_cpu->slice_ticks = slice_time + z_clock_elapsed(); - - z_set_timeout_expiry(slice_time, false); + if (slice_time != 0) { + _current_cpu->slice_ticks = slice_time + z_clock_elapsed(); + z_set_timeout_expiry(slice_time, false); + } } void k_sched_time_slice_set(s32_t slice, int prio) diff --git a/lib/cmsis_rtos_v2/kernel.c b/lib/cmsis_rtos_v2/kernel.c index ffdaa6c99bf0a..dad2b177f5696 100644 --- a/lib/cmsis_rtos_v2/kernel.c +++ b/lib/cmsis_rtos_v2/kernel.c @@ -10,6 +10,13 @@ #include #include +/* Currently the timing implementations for timeouts and osDelay + * assume that the arguments are in Zephyr ticks, even though ARM + * documentation and at least some of our test code assume they are + * milliseconds. They must match for now. + */ +BUILD_ASSERT(CONFIG_SYS_CLOCK_TICKS_PER_SEC == 1000); + extern u32_t z_tick_get_32(void); /** diff --git a/samples/basic/minimal/no-timers.conf b/samples/basic/minimal/no-timers.conf index 05dc0d53afd1c..961178ee05c70 100644 --- a/samples/basic/minimal/no-timers.conf +++ b/samples/basic/minimal/no-timers.conf @@ -1,3 +1,2 @@ # No timer support in the kernel - -CONFIG_SYS_CLOCK_TICKS_PER_SEC=0 +CONFIG_SYS_CLOCK_EXISTS=n diff --git a/samples/bluetooth/mesh/microbit_gatt.conf b/samples/bluetooth/mesh/microbit_gatt.conf index fc5f62c164fc7..a0682b0771dda 100644 --- a/samples/bluetooth/mesh/microbit_gatt.conf +++ b/samples/bluetooth/mesh/microbit_gatt.conf @@ -3,7 +3,6 @@ CONFIG_MAIN_STACK_SIZE=320 CONFIG_IDLE_STACK_SIZE=128 CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 CONFIG_GPIO=y CONFIG_BT_PERIPHERAL=y diff --git a/samples/bluetooth/mesh/prj_bbc_microbit.conf b/samples/bluetooth/mesh/prj_bbc_microbit.conf index 79755b5ab4c04..bba9139a55854 100644 --- a/samples/bluetooth/mesh/prj_bbc_microbit.conf +++ b/samples/bluetooth/mesh/prj_bbc_microbit.conf @@ -2,7 +2,6 @@ CONFIG_INIT_STACKS=y CONFIG_MAIN_STACK_SIZE=512 CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 CONFIG_GPIO=y diff --git a/samples/bluetooth/mesh_demo/prj_bbc_microbit.conf b/samples/bluetooth/mesh_demo/prj_bbc_microbit.conf index 24844682d9739..8066cb3ec0be5 100644 --- a/samples/bluetooth/mesh_demo/prj_bbc_microbit.conf +++ b/samples/bluetooth/mesh_demo/prj_bbc_microbit.conf @@ -2,7 +2,6 @@ CONFIG_MAIN_STACK_SIZE=512 #CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1280 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 CONFIG_GPIO=y CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y diff --git a/samples/boards/bbc_microbit/display/prj.conf b/samples/boards/bbc_microbit/display/prj.conf index cf12d62ca051a..76f2b8952b504 100644 --- a/samples/boards/bbc_microbit/display/prj.conf +++ b/samples/boards/bbc_microbit/display/prj.conf @@ -2,4 +2,3 @@ CONFIG_GPIO=y CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 diff --git a/samples/boards/bbc_microbit/pong/prj.conf b/samples/boards/bbc_microbit/pong/prj.conf index 32e93267f7dd6..4ed8dca23a1e1 100644 --- a/samples/boards/bbc_microbit/pong/prj.conf +++ b/samples/boards/bbc_microbit/pong/prj.conf @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 CONFIG_ISR_STACK_SIZE=1024 CONFIG_BT=y CONFIG_BT_CENTRAL=y diff --git a/samples/boards/bbc_microbit/sound/prj.conf b/samples/boards/bbc_microbit/sound/prj.conf index 62489c8f7bfb0..2bce0fda2c3ed 100644 --- a/samples/boards/bbc_microbit/sound/prj.conf +++ b/samples/boards/bbc_microbit/sound/prj.conf @@ -3,4 +3,3 @@ CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y CONFIG_PWM=y CONFIG_PWM_NRF5_SW=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 diff --git a/samples/philosophers/prj.conf b/samples/philosophers/prj.conf index 0b432095bcdad..7a2c808f10125 100644 --- a/samples/philosophers/prj.conf +++ b/samples/philosophers/prj.conf @@ -1,5 +1,4 @@ CONFIG_STDOUT_CONSOLE=n -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_NUM_COOP_PRIORITIES=29 diff --git a/samples/portability/cmsis_rtos_v1/philosophers/prj.conf b/samples/portability/cmsis_rtos_v1/philosophers/prj.conf index 7c657b272d92b..2b8481640ea14 100644 --- a/samples/portability/cmsis_rtos_v1/philosophers/prj.conf +++ b/samples/portability/cmsis_rtos_v1/philosophers/prj.conf @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_CMSIS_RTOS_V1=y diff --git a/samples/portability/cmsis_rtos_v1/timer_synchronization/prj.conf b/samples/portability/cmsis_rtos_v1/timer_synchronization/prj.conf index 0319f1d16ab6c..26e412ac7c11a 100644 --- a/samples/portability/cmsis_rtos_v1/timer_synchronization/prj.conf +++ b/samples/portability/cmsis_rtos_v1/timer_synchronization/prj.conf @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_CMSIS_RTOS_V1=y diff --git a/samples/portability/cmsis_rtos_v2/philosophers/prj.conf b/samples/portability/cmsis_rtos_v2/philosophers/prj.conf index 57a6fcb2bd267..7bf7415a2a66f 100644 --- a/samples/portability/cmsis_rtos_v2/philosophers/prj.conf +++ b/samples/portability/cmsis_rtos_v2/philosophers/prj.conf @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_CMSIS_RTOS_V2=y @@ -10,3 +9,4 @@ CONFIG_THREAD_MONITOR=y CONFIG_INIT_STACKS=y CONFIG_POLL=y CONFIG_SCHED_SCALABLE=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 diff --git a/samples/portability/cmsis_rtos_v2/timer_synchronization/prj.conf b/samples/portability/cmsis_rtos_v2/timer_synchronization/prj.conf index e5e0dec481e87..cd8feb23b3f98 100644 --- a/samples/portability/cmsis_rtos_v2/timer_synchronization/prj.conf +++ b/samples/portability/cmsis_rtos_v2/timer_synchronization/prj.conf @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_CMSIS_RTOS_V2=y @@ -11,3 +10,6 @@ CONFIG_INIT_STACKS=y CONFIG_POLL=y CONFIG_SCHED_SCALABLE=y CONFIG_SMP=n + +# The Zephyr CMSIS v2 emulation assumes that ticks are ms, currently +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index f3756b4e3bbfc..f618c0c3d9053 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -24,7 +24,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config SYS_CLOCK_TICKS_PER_SEC int - default 128 + default 32768 config ARCH_HAS_CUSTOM_BUSY_WAIT default y diff --git a/soc/arm/nxp_imx/mcimx7_m4/Kconfig.defconfig.mcimx7_m4 b/soc/arm/nxp_imx/mcimx7_m4/Kconfig.defconfig.mcimx7_m4 index 8d8b2427c68fd..d87ce815c2e43 100644 --- a/soc/arm/nxp_imx/mcimx7_m4/Kconfig.defconfig.mcimx7_m4 +++ b/soc/arm/nxp_imx/mcimx7_m4/Kconfig.defconfig.mcimx7_m4 @@ -11,10 +11,6 @@ config SOC string default "mcimx7d" -config SYS_CLOCK_TICKS_PER_SEC - int - default 1000 - config SYS_CLOCK_HW_CYCLES_PER_SEC int default 200000000 diff --git a/soc/arm/ti_simplelink/msp432p4xx/Kconfig.defconfig.msp432p401r b/soc/arm/ti_simplelink/msp432p4xx/Kconfig.defconfig.msp432p401r index 3989fccd62017..472f94e7cf19c 100644 --- a/soc/arm/ti_simplelink/msp432p4xx/Kconfig.defconfig.msp432p401r +++ b/soc/arm/ti_simplelink/msp432p4xx/Kconfig.defconfig.msp432p401r @@ -15,10 +15,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC int default 48000000 -config SYS_CLOCK_TICKS_PER_SEC - int - default 1000 - config NUM_IRQS int default 64 diff --git a/tests/bluetooth/mesh/microbit.conf b/tests/bluetooth/mesh/microbit.conf index db5a81b206a58..7324a83c9aec1 100644 --- a/tests/bluetooth/mesh/microbit.conf +++ b/tests/bluetooth/mesh/microbit.conf @@ -3,7 +3,6 @@ CONFIG_INIT_STACKS=y CONFIG_MAIN_STACK_SIZE=512 CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 CONFIG_GPIO=y CONFIG_BT=y diff --git a/tests/bluetooth/mesh/microbit_gatt.conf b/tests/bluetooth/mesh/microbit_gatt.conf index 3c3a08e355114..5a9737b3f554e 100644 --- a/tests/bluetooth/mesh/microbit_gatt.conf +++ b/tests/bluetooth/mesh/microbit_gatt.conf @@ -3,7 +3,6 @@ CONFIG_TEST=y CONFIG_MAIN_STACK_SIZE=512 CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=250 CONFIG_GPIO=y CONFIG_BT_PERIPHERAL=y diff --git a/tests/cmsis_rtos_v1/src/kernel_apis.c b/tests/cmsis_rtos_v1/src/kernel_apis.c index 7b48f6653b324..646c33929c3bd 100644 --- a/tests/cmsis_rtos_v1/src/kernel_apis.c +++ b/tests/cmsis_rtos_v1/src/kernel_apis.c @@ -39,7 +39,7 @@ void test_kernel_start(void) */ void test_kernel_systick(void) { - u32_t start_time, stop_time, diff; + u32_t start_time, stop_time, diff, max, min; start_time = osKernelSysTick(); k_busy_wait(WAIT_TIME_US); @@ -48,5 +48,14 @@ void test_kernel_systick(void) diff = SYS_CLOCK_HW_CYCLES_TO_NS(stop_time - start_time) / NSEC_PER_USEC; - zassert_true(diff >= WAIT_TIME_US, NULL); + /* Check that it's within 1%. On some Zephyr platforms + * (e.g. nRF5x) the busy wait loop and the system timer are + * based on different mechanisms and may not align perfectly. + */ + max = WAIT_TIME_US + (WAIT_TIME_US / 100); + min = WAIT_TIME_US - (WAIT_TIME_US / 100); + + zassert_true(diff < max && diff > min, + "start %d stop %d (diff %d) wait %d\n", + start_time, stop_time, diff, WAIT_TIME_US); } diff --git a/tests/cmsis_rtos_v2/prj.conf b/tests/cmsis_rtos_v2/prj.conf index c90084c574443..ab8d18fcfd6e5 100644 --- a/tests/cmsis_rtos_v2/prj.conf +++ b/tests/cmsis_rtos_v2/prj.conf @@ -13,3 +13,6 @@ CONFIG_SCHED_SCALABLE=y CONFIG_CMSIS_V2_MEM_SLAB_MAX_DYNAMIC_SIZE=128 CONFIG_CMSIS_V2_THREAD_MAX_COUNT=23 CONFIG_CMSIS_V2_THREAD_DYNAMIC_MAX_COUNT=10 + +# The Zephyr CMSIS emulation assumes that ticks are ms, currently +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 diff --git a/tests/drivers/build_all/sensors_a_h.conf b/tests/drivers/build_all/sensors_a_h.conf index 582e3719bcad4..4cb9706053258 100644 --- a/tests/drivers/build_all/sensors_a_h.conf +++ b/tests/drivers/build_all/sensors_a_h.conf @@ -6,10 +6,6 @@ CONFIG_SPI=y CONFIG_LOG=y CONFIG_SENSOR_LOG_LEVEL_DBG=y CONFIG_TEST_USERSPACE=y - -# Some sensor drivers (notably HP206C) demand high tick rates: -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 - CONFIG_ADC=y CONFIG_ADT7420=y CONFIG_ADXL362=y diff --git a/tests/kernel/common/src/clock.c b/tests/kernel/common/src/clock.c index 762e0ef80f429..1101912dbaa00 100644 --- a/tests/kernel/common/src/clock.c +++ b/tests/kernel/common/src/clock.c @@ -61,8 +61,7 @@ void test_clock_uptime(void) /**TESTPOINT: uptime delta*/ d64 = k_uptime_delta(&d64); - /* Note: this will stall if the systick period < 5ms */ - while (k_uptime_delta(&d64) < 5) { + while (k_uptime_delta(&d64) == 0) { #if defined(CONFIG_ARCH_POSIX) k_busy_wait(50); #endif @@ -70,8 +69,7 @@ void test_clock_uptime(void) /**TESTPOINT: uptime delta lower 32-bit*/ k_uptime_delta_32(&d64); - /* Note: this will stall if the systick period < 5ms */ - while (k_uptime_delta_32(&d64) < 5) { + while (k_uptime_delta_32(&d64) == 0) { #if defined(CONFIG_ARCH_POSIX) k_busy_wait(50); #endif diff --git a/tests/kernel/context/src/main.c b/tests/kernel/context/src/main.c index 50dea35246f1b..25887ae96f6f8 100644 --- a/tests/kernel/context/src/main.c +++ b/tests/kernel/context/src/main.c @@ -697,7 +697,9 @@ static void thread_sleep(void *delta, void *arg2, void *arg3) timestamp = k_uptime_get() - timestamp; TC_PRINT(" thread back from sleep\n"); - if (timestamp < timeout || timestamp > timeout + __ticks_to_ms(2)) { + int slop = MAX(__ticks_to_ms(2), 1); + + if (timestamp < timeout || timestamp > timeout + slop) { TC_ERROR("timestamp out of range, got %d\n", (int)timestamp); return; } diff --git a/tests/kernel/early_sleep/src/main.c b/tests/kernel/early_sleep/src/main.c index 7874ef7aeb9c4..20d3ea10312c7 100644 --- a/tests/kernel/early_sleep/src/main.c +++ b/tests/kernel/early_sleep/src/main.c @@ -33,7 +33,7 @@ #define THREAD_STACK (384 + CONFIG_TEST_EXTRA_STACKSIZE) -#define TEST_TICKS_TO_SLEEP 50 +#define TEST_TICKS_TO_SLEEP (CONFIG_SYS_CLOCK_TICKS_PER_SEC / 2) /* Helper thread data */ static K_THREAD_STACK_DEFINE(helper_tstack, THREAD_STACK); diff --git a/tests/kernel/mem_pool/mem_pool/src/main.c b/tests/kernel/mem_pool/mem_pool/src/main.c index 9f7e447c30fbf..5d21913ca0285 100644 --- a/tests/kernel/mem_pool/mem_pool/src/main.c +++ b/tests/kernel/mem_pool/mem_pool/src/main.c @@ -22,8 +22,8 @@ #include #include -#define ONE_SECOND (CONFIG_SYS_CLOCK_TICKS_PER_SEC) -#define TENTH_SECOND (CONFIG_SYS_CLOCK_TICKS_PER_SEC / 10) +#define ONE_SECOND 1000 +#define TENTH_SECOND 100 #define NUM_BLOCKS 64 diff --git a/tests/kernel/sched/schedule_api/src/test_slice_scheduling.c b/tests/kernel/sched/schedule_api/src/test_slice_scheduling.c index f31c4a4690ce8..f03bf4eecc844 100644 --- a/tests/kernel/sched/schedule_api/src/test_slice_scheduling.c +++ b/tests/kernel/sched/schedule_api/src/test_slice_scheduling.c @@ -44,6 +44,14 @@ static void thread_tslice(void *p1, void *p2, void *p3) s64_t expected_slice_min = __ticks_to_ms(z_ms_to_ticks(SLICE_SIZE)); s64_t expected_slice_max = __ticks_to_ms(z_ms_to_ticks(SLICE_SIZE) + 1); + /* Clumsy, but need to handle the precision loss with + * submillisecond ticks. It's always possible to alias and + * produce a tdelta of "1", no matter how fast ticks are. + */ + if (expected_slice_max == expected_slice_min) { + expected_slice_max = expected_slice_min + 1; + } + while (1) { s64_t tdelta = k_uptime_delta(&elapsed_slice); TC_PRINT("%c", thread_parameter); diff --git a/tests/kernel/sleep/src/usleep.c b/tests/kernel/sleep/src/usleep.c index 7780ac6ded81e..aca124c78da53 100644 --- a/tests/kernel/sleep/src/usleep.c +++ b/tests/kernel/sleep/src/usleep.c @@ -16,17 +16,23 @@ #define RETRIES 10 /* - * Theory of operation: we can't use absolute units (e.g., "sleep for 10us") - * in testing k_usleep() because the granularity of sleeps is highly dependent - * on the hardware's capabilities and kernel configuration. Instead, we - * test that k_usleep() actually sleeps for the minimum possible duration. - * (That minimum duration is presently two ticks; see below.) So, we loop - * k_usleep()ing for as many iterations as should comprise a second, and - * check to see that a total of one second has elapsed. + * Theory of operation: we can't use absolute units (e.g., "sleep for + * 10us") in testing k_usleep() because the granularity of sleeps is + * highly dependent on the hardware's capabilities and kernel + * configuration. Instead, we test that k_usleep() actually sleeps for + * the minimum possible duration. So, we loop k_usleep()ing for as + * many iterations as should comprise a second, and check to see that + * a total of one second has elapsed. */ -#define LOWER_BOUND_MS 900 /* +/- 10%, might be too lax */ -#define UPPER_BOUND_MS 1100 +#define LOOPS (CONFIG_SYS_CLOCK_TICKS_PER_SEC / 2) + +/* It should never iterate faster than the tick rate. It might be as + * much as 4x slower on drivers with fast tick rates (each of the app, + * sleep, timeout and cycle layers may need to align). + */ +#define LOWER_BOUND_MS ((1000 * LOOPS) / CONFIG_SYS_CLOCK_TICKS_PER_SEC) +#define UPPER_BOUND_MS ((4 * 1000 * LOOPS) / CONFIG_SYS_CLOCK_TICKS_PER_SEC) void test_usleep(void) { @@ -41,16 +47,7 @@ void test_usleep(void) ++retries; start_ms = k_uptime_get(); - for (i = 0; i < (CONFIG_SYS_CLOCK_TICKS_PER_SEC / 2); ++i) { - /* - * this will always sleep for TWO ticks: - * - * the conversion from 1us to ticks is rounded - * up to the nearest tick boundary, and sleeps - * always have _TICK_ALIGN (currently 1) added - * to their durations. - */ - + for (i = 0; i < LOOPS; ++i) { k_usleep(1); } @@ -60,12 +57,12 @@ void test_usleep(void) /* if at first you don't succeed, keep sucking. */ if ((elapsed_ms >= LOWER_BOUND_MS) && - (elapsed_ms < UPPER_BOUND_MS)) { + (elapsed_ms <= UPPER_BOUND_MS)) { break; } } printk("elapsed_ms = %lld\n", elapsed_ms); zassert_true(elapsed_ms >= LOWER_BOUND_MS, "short sleep"); - zassert_true(elapsed_ms < UPPER_BOUND_MS, "overslept"); + zassert_true(elapsed_ms <= UPPER_BOUND_MS, "overslept"); } diff --git a/tests/kernel/tickless/tickless/prj.conf b/tests/kernel/tickless/tickless/prj.conf index 999abd18cda85..221188ede02b4 100644 --- a/tests/kernel/tickless/tickless/prj.conf +++ b/tests/kernel/tickless/tickless/prj.conf @@ -1,2 +1,5 @@ CONFIG_SYS_POWER_MANAGEMENT=y CONFIG_ZTEST=y + +# The code is written to assume a slow tick rate +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 \ No newline at end of file diff --git a/tests/kernel/tickless/tickless_concept/prj.conf b/tests/kernel/tickless/tickless_concept/prj.conf index 2905502ce96eb..c1ad3543fdce3 100644 --- a/tests/kernel/tickless/tickless_concept/prj.conf +++ b/tests/kernel/tickless/tickless_concept/prj.conf @@ -1,5 +1,5 @@ CONFIG_ZTEST=y CONFIG_SYS_POWER_MANAGEMENT=y CONFIG_TICKLESS_IDLE_THRESH=20 - CONFIG_SMP=n +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 diff --git a/tests/kernel/workq/work_queue/src/main.c b/tests/kernel/workq/work_queue/src/main.c index 77e44e85b59b1..96f587d5d7f8d 100644 --- a/tests/kernel/workq/work_queue/src/main.c +++ b/tests/kernel/workq/work_queue/src/main.c @@ -27,6 +27,11 @@ #define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE) +/* How long to wait for the full test suite to complete. Allow for a + * little slop + */ +#define CHECK_WAIT ((NUM_TEST_ITEMS + 1) * WORK_ITEM_WAIT_ALIGNED) + struct test_item { int key; struct k_delayed_work work; @@ -144,7 +149,7 @@ static void test_sequence(void) test_items_submit(); TC_PRINT(" - Waiting for work to finish\n"); - k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED); + k_sleep(CHECK_WAIT); check_results(NUM_TEST_ITEMS); reset_results(); @@ -184,7 +189,7 @@ static void test_resubmit(void) k_work_submit(&tests[0].work.work); TC_PRINT(" - Waiting for work to finish\n"); - k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED); + k_sleep(CHECK_WAIT); TC_PRINT(" - Checking results\n"); check_results(NUM_TEST_ITEMS); @@ -336,7 +341,7 @@ static void test_delayed_resubmit(void) k_delayed_work_submit(&tests[0].work, WORK_ITEM_WAIT); TC_PRINT(" - Waiting for work to finish\n"); - k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED); + k_sleep(CHECK_WAIT); TC_PRINT(" - Checking results\n"); check_results(NUM_TEST_ITEMS); @@ -408,7 +413,7 @@ static void test_delayed(void) test_delayed_submit(); TC_PRINT(" - Waiting for delayed work to finish\n"); - k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED); + k_sleep(CHECK_WAIT); TC_PRINT(" - Checking results\n"); check_results(NUM_TEST_ITEMS); diff --git a/tests/posix/common/src/clock.c b/tests/posix/common/src/clock.c index 0e410ee47f7ec..41109646544ee 100644 --- a/tests/posix/common/src/clock.c +++ b/tests/posix/common/src/clock.c @@ -84,10 +84,10 @@ void test_posix_realtime(void) zassert_equal(ret, 0, "Fail to set realtime clock"); /* - * Loop for 20 10ths of a second, sleeping a little bit for - * each, making sure that the arithmetic roughly makes sense. - * This tries to catch all of the boundary conditions of the - * clock to make sure there are no errors in the arithmetic. + * Loop 20 times, sleeping a little bit for each, making sure + * that the arithmetic roughly makes sense. This tries to + * catch all of the boundary conditions of the clock to make + * sure there are no errors in the arithmetic. */ s64_t last_delta = 0; for (int i = 1; i <= 20; i++) { @@ -100,7 +100,7 @@ void test_posix_realtime(void) (s64_t)nts.tv_sec * NSEC_PER_SEC) + ((s64_t)rts.tv_nsec - (s64_t)nts.tv_nsec); - /* Make the delta 10ths of a second. */ + /* Make the delta milliseconds. */ delta /= (NSEC_PER_SEC / 1000U); zassert_true(delta > last_delta, "Clock moved backward"); @@ -108,9 +108,11 @@ void test_posix_realtime(void) /* printk("Delta %d: %lld\n", i, delta); */ - /* Allow for a little drift */ - zassert_true(error > 90, "Clock inaccurate"); - zassert_true(error < 110, "Clock inaccurate"); + /* Allow for a little drift upward, but not + * downward + */ + zassert_true(error >= 90, "Clock inaccurate %d", error); + zassert_true(error < 110, "Clock inaccurate %d", error); last_delta = delta; }