You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/01/12 14:33:18 UTC

[mynewt-core] 02/02: hw/mcu: Move OS_TICKS_PER_SEC from .h to syscfg.yml

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit a7322b7aa2f16f4c72ec8d086039793b19ca368b
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Mon Dec 7 15:08:13 2020 +0100

    hw/mcu: Move OS_TICKS_PER_SEC from .h to syscfg.yml
    
    os_time.h has now common definition of OS_TICKS_PER_SEC.
    This removes all local definitions from MCU specific files,
    and adds equivalent syscfg value.
---
 hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h           |  2 --
 hw/mcu/ambiq/apollo2/syscfg.yml                        |  3 +++
 hw/mcu/arc/snps/include/mcu/mcu_arc.h                  |  2 --
 hw/mcu/arc/snps/syscfg.yml                             |  2 ++
 hw/mcu/dialog/cmac/include/mcu/cortex_m0.h             |  2 --
 hw/mcu/dialog/cmac/syscfg.yml                          |  3 +++
 hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h         |  2 --
 hw/mcu/dialog/da1469x/syscfg.yml                       |  3 +++
 hw/mcu/microchip/pic32mx470f512h/include/mcu/pic32.h   |  2 --
 hw/mcu/microchip/pic32mx470f512h/syscfg.yml            |  3 +++
 hw/mcu/microchip/pic32mz2048efg100/include/mcu/pic32.h |  2 --
 hw/mcu/microchip/pic32mz2048efg100/syscfg.yml          |  3 +++
 hw/mcu/mips/danube/include/mcu/mips.h                  |  2 --
 hw/mcu/mips/danube/syscfg.yml                          |  3 +++
 hw/mcu/native/include/mcu/mcu_sim.h                    |  2 --
 hw/mcu/native/syscfg.yml                               |  3 +++
 hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h         |  7 -------
 hw/mcu/nordic/nrf51xxx/syscfg.yml                      |  6 ++++++
 hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h         |  2 --
 hw/mcu/nordic/nrf52xxx/syscfg.yml                      |  9 ++++-----
 hw/mcu/nordic/nrf5340/include/mcu/cortex_m33.h         |  2 --
 hw/mcu/nordic/nrf5340/syscfg.yml                       |  5 ++++-
 hw/mcu/nordic/nrf5340_net/include/mcu/cortex_m33.h     |  2 --
 hw/mcu/nordic/nrf5340_net/syscfg.yml                   |  4 ++++
 hw/mcu/nordic/nrf91xx/include/mcu/cortex_m33.h         |  2 --
 hw/mcu/nordic/nrf91xx/syscfg.yml                       |  3 +++
 hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h             |  2 --
 hw/mcu/nxp/MK64F12/syscfg.yml                          |  3 +++
 hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h              |  8 --------
 hw/mcu/{mips/danube => nxp/mkw41z}/syscfg.yml          | 12 ++++++------
 hw/mcu/sifive/fe310/include/mcu/fe310.h                |  2 --
 hw/mcu/sifive/fe310/syscfg.yml                         | 10 ++++++----
 hw/mcu/stm/stm32_common/syscfg.yml                     |  6 ++----
 hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h           |  2 --
 hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h           |  2 --
 hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h           |  2 --
 hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h           |  2 --
 hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h           |  2 --
 hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h           |  2 --
 hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h           |  2 --
 hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h           |  2 --
 hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h           |  2 --
 42 files changed, 61 insertions(+), 81 deletions(-)

diff --git a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
index 6b11382..d977987 100644
--- a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
+++ b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/ambiq/apollo2/syscfg.yml b/hw/mcu/ambiq/apollo2/syscfg.yml
index 3292108..d0ccde4 100644
--- a/hw/mcu/ambiq/apollo2/syscfg.yml
+++ b/hw/mcu/ambiq/apollo2/syscfg.yml
@@ -123,3 +123,6 @@ syscfg.defs:
                     APOLLO2_TIMER_SOURCE_TMRPINA
                     APOLLO2_TIMER_SOURCE_BUCKA
         value:
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
diff --git a/hw/mcu/arc/snps/include/mcu/mcu_arc.h b/hw/mcu/arc/snps/include/mcu/mcu_arc.h
index fa51beb..28e8245 100644
--- a/hw/mcu/arc/snps/include/mcu/mcu_arc.h
+++ b/hw/mcu/arc/snps/include/mcu/mcu_arc.h
@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (100)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/arc/snps/syscfg.yml b/hw/mcu/arc/snps/syscfg.yml
index 5d4fb2b..21ddbb4 100644
--- a/hw/mcu/arc/snps/syscfg.yml
+++ b/hw/mcu/arc/snps/syscfg.yml
@@ -16,3 +16,5 @@
 # under the License.
 #
 
+syscfg.vals:
+    OS_TICKS_PER_SEC: 100
diff --git a/hw/mcu/dialog/cmac/include/mcu/cortex_m0.h b/hw/mcu/dialog/cmac/include/mcu/cortex_m0.h
index b825bd7..6adecf3 100644
--- a/hw/mcu/dialog/cmac/include/mcu/cortex_m0.h
+++ b/hw/mcu/dialog/cmac/include/mcu/cortex_m0.h
@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/dialog/cmac/syscfg.yml b/hw/mcu/dialog/cmac/syscfg.yml
index 9c2ece2..7c55188 100644
--- a/hw/mcu/dialog/cmac/syscfg.yml
+++ b/hw/mcu/dialog/cmac/syscfg.yml
@@ -77,5 +77,8 @@ syscfg.defs:
         value: -1
         range: -1,0..31
 
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
 syscfg.restrictions:
     - BLE_CONTROLLER
diff --git a/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h b/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h
index 297facd..895e470 100644
--- a/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h
+++ b/hw/mcu/dialog/da1469x/include/mcu/cortex_m33.h
@@ -27,8 +27,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml
index 7fb7b09..6bfb1a7 100644
--- a/hw/mcu/dialog/da1469x/syscfg.yml
+++ b/hw/mcu/dialog/da1469x/syscfg.yml
@@ -474,6 +474,9 @@ syscfg.defs:
         restrictions:
             - '!GPADC_BATTERY'
 
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
 syscfg.vals.'MCU_SYSCLK_SOURCE == "PLL96"':
     MCU_PLL_ENABLE: 1
 
diff --git a/hw/mcu/microchip/pic32mx470f512h/include/mcu/pic32.h b/hw/mcu/microchip/pic32mx470f512h/include/mcu/pic32.h
index bb87c24..0477f5d 100644
--- a/hw/mcu/microchip/pic32mx470f512h/include/mcu/pic32.h
+++ b/hw/mcu/microchip/pic32mx470f512h/include/mcu/pic32.h
@@ -20,8 +20,6 @@
 #ifndef __MCU_PIC32_H__
 #define __MCU_PIC32_H__
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/microchip/pic32mx470f512h/syscfg.yml b/hw/mcu/microchip/pic32mx470f512h/syscfg.yml
index e4d94c0..69b41a1 100644
--- a/hw/mcu/microchip/pic32mx470f512h/syscfg.yml
+++ b/hw/mcu/microchip/pic32mx470f512h/syscfg.yml
@@ -42,3 +42,6 @@ syscfg.defs:
         value:  0
         restrictions:
             - "!SPI_1_MASTER"
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 1000
diff --git a/hw/mcu/microchip/pic32mz2048efg100/include/mcu/pic32.h b/hw/mcu/microchip/pic32mz2048efg100/include/mcu/pic32.h
index bb87c24..0477f5d 100644
--- a/hw/mcu/microchip/pic32mz2048efg100/include/mcu/pic32.h
+++ b/hw/mcu/microchip/pic32mz2048efg100/include/mcu/pic32.h
@@ -20,8 +20,6 @@
 #ifndef __MCU_PIC32_H__
 #define __MCU_PIC32_H__
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/microchip/pic32mz2048efg100/syscfg.yml b/hw/mcu/microchip/pic32mz2048efg100/syscfg.yml
index e4d94c0..69b41a1 100644
--- a/hw/mcu/microchip/pic32mz2048efg100/syscfg.yml
+++ b/hw/mcu/microchip/pic32mz2048efg100/syscfg.yml
@@ -42,3 +42,6 @@ syscfg.defs:
         value:  0
         restrictions:
             - "!SPI_1_MASTER"
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 1000
diff --git a/hw/mcu/mips/danube/include/mcu/mips.h b/hw/mcu/mips/danube/include/mcu/mips.h
index 529cc1a..86444f6 100644
--- a/hw/mcu/mips/danube/include/mcu/mips.h
+++ b/hw/mcu/mips/danube/include/mcu/mips.h
@@ -20,8 +20,6 @@
 #ifndef __MCU_MIPS_H__
 #define __MCU_MIPS_H__
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/mips/danube/syscfg.yml b/hw/mcu/mips/danube/syscfg.yml
index d2cb541..260731a 100644
--- a/hw/mcu/mips/danube/syscfg.yml
+++ b/hw/mcu/mips/danube/syscfg.yml
@@ -22,3 +22,6 @@ syscfg.defs:
             Specifies the required alignment for internal flash writes.
             Used internally by the newt tool.
         value: 1
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 1000
diff --git a/hw/mcu/native/include/mcu/mcu_sim.h b/hw/mcu/native/include/mcu/mcu_sim.h
index a6e55a9..53fc5c9 100644
--- a/hw/mcu/native/include/mcu/mcu_sim.h
+++ b/hw/mcu/native/include/mcu/mcu_sim.h
@@ -23,8 +23,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (100)
-
 extern char *native_flash_file;
 extern char *native_uart_log_file;
 extern const char *native_uart_dev_strs[];
diff --git a/hw/mcu/native/syscfg.yml b/hw/mcu/native/syscfg.yml
index e83b70e..efa3a2a 100644
--- a/hw/mcu/native/syscfg.yml
+++ b/hw/mcu/native/syscfg.yml
@@ -70,3 +70,6 @@ syscfg.defs:
         description: 'Priority of native HAL timer task.'
         type: task_priority
         value: 0
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 100
diff --git a/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h b/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h
index d4b6a96..2149dad 100644
--- a/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h
+++ b/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h
@@ -27,13 +27,6 @@
 extern "C" {
 #endif
 
-/*
- * The nRF51 microcontroller uses RTC0 for periodic interrupts and it is
- * clocked at 32768Hz. The tick frequency is chosen such that it divides
- * cleanly into 32768 to avoid a systemic bias in the actual tick frequency.
- */
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/nordic/nrf51xxx/syscfg.yml b/hw/mcu/nordic/nrf51xxx/syscfg.yml
index ae92c3b..ebac618 100644
--- a/hw/mcu/nordic/nrf51xxx/syscfg.yml
+++ b/hw/mcu/nordic/nrf51xxx/syscfg.yml
@@ -106,3 +106,9 @@ syscfg.defs:
         restrictions:
             - "!XTAL_RC"
             - "!XTAL_32768"
+
+syscfg.vals:
+    # The nRF51 microcontroller uses RTC0 for periodic interrupts and it is
+    # clocked at 32768Hz. The tick frequency is chosen such that it divides
+    # cleanly into 32768 to avoid a systemic bias in the actual tick frequency.
+    OS_TICKS_PER_SEC: 128
diff --git a/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h b/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h
index 6cb5919..373c6db 100644
--- a/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h
+++ b/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h
@@ -28,8 +28,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    MYNEWT_VAL(OS_TICKS_PER_SEC)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/nordic/nrf52xxx/syscfg.yml b/hw/mcu/nordic/nrf52xxx/syscfg.yml
index 90c4ef4..bb038ab 100644
--- a/hw/mcu/nordic/nrf52xxx/syscfg.yml
+++ b/hw/mcu/nordic/nrf52xxx/syscfg.yml
@@ -92,11 +92,6 @@ syscfg.defs:
             the breakpoint wherever it gets called, For example, reset and crash
        value: 0
 
-    OS_TICKS_PER_SEC:
-        description: >
-            Desired ticks frequency in Hz. Note: Value must be a power of 2.
-        value: 128
-        range: 128,256,512,1024
 
 # MCU peripherals definitions
     I2C_0:
@@ -457,6 +452,9 @@ syscfg.defs:
             - "!XTAL_RC"
         deprecated: 1
 
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
 syscfg.vals.MCU_NRF52832:
     MCU_TARGET: nRF52832
 syscfg.vals.MCU_NRF52840:
@@ -481,3 +479,4 @@ syscfg.restrictions:
     - "!SPI_2_SLAVE || (SPI_2_SLAVE_PIN_SCK && SPI_2_SLAVE_PIN_MOSI && SPI_2_SLAVE_PIN_MISO && SPI_2_SLAVE_PIN_SS)"
     - "!UART_0 || (UART_0_PIN_TX && UART_0_PIN_RX)"
     - "!UART_1 || (UART_1_PIN_TX && UART_1_PIN_RX)"
+    - "(OS_TICKS_PER_SEC == 128 || OS_TICKS_PER_SEC == 256 || OS_TICKS_PER_SEC == 512 || OS_TICKS_PER_SEC == 1024)"
diff --git a/hw/mcu/nordic/nrf5340/include/mcu/cortex_m33.h b/hw/mcu/nordic/nrf5340/include/mcu/cortex_m33.h
index 3adfa06..2cfcaa2 100644
--- a/hw/mcu/nordic/nrf5340/include/mcu/cortex_m33.h
+++ b/hw/mcu/nordic/nrf5340/include/mcu/cortex_m33.h
@@ -28,8 +28,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index 6c8ecd7..cf5803c 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -408,7 +408,10 @@ syscfg.defs:
     I2C_3_FREQ_KHZ:
         description: 'Frequency [kHz] for I2C_3'
         value: 100
-        
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
 syscfg.restrictions:
     - "!UART_0 || (UART_0_PIN_TX && UART_0_PIN_RX)"
     - "!UART_1 || (UART_1_PIN_TX && UART_1_PIN_RX)"
diff --git a/hw/mcu/nordic/nrf5340_net/include/mcu/cortex_m33.h b/hw/mcu/nordic/nrf5340_net/include/mcu/cortex_m33.h
index 3adfa06..2cfcaa2 100644
--- a/hw/mcu/nordic/nrf5340_net/include/mcu/cortex_m33.h
+++ b/hw/mcu/nordic/nrf5340_net/include/mcu/cortex_m33.h
@@ -28,8 +28,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/nordic/nrf5340_net/syscfg.yml b/hw/mcu/nordic/nrf5340_net/syscfg.yml
index 09170c8..947907b 100644
--- a/hw/mcu/nordic/nrf5340_net/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340_net/syscfg.yml
@@ -126,5 +126,9 @@ syscfg.defs:
     SPI_0_SLAVE_PIN_SS:
         description: 'SS pin for SPI_0_SLAVE'
         value: ''
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
 syscfg.restrictions:
     - "!UART_0 || (UART_0_PIN_TX && UART_0_PIN_RX)"
diff --git a/hw/mcu/nordic/nrf91xx/include/mcu/cortex_m33.h b/hw/mcu/nordic/nrf91xx/include/mcu/cortex_m33.h
index 6f0e0cc..9bb8df7 100644
--- a/hw/mcu/nordic/nrf91xx/include/mcu/cortex_m33.h
+++ b/hw/mcu/nordic/nrf91xx/include/mcu/cortex_m33.h
@@ -28,8 +28,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (128)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/nordic/nrf91xx/syscfg.yml b/hw/mcu/nordic/nrf91xx/syscfg.yml
index fb19d0d..e910202 100644
--- a/hw/mcu/nordic/nrf91xx/syscfg.yml
+++ b/hw/mcu/nordic/nrf91xx/syscfg.yml
@@ -429,6 +429,9 @@ syscfg.defs:
         description: 'Enable pin reset'
         value: 0
 
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
 syscfg.vals.MCU_NRF9160:
     MCU_TARGET: nRF9160
 
diff --git a/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h b/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h
index 4480e33..14312d6 100644
--- a/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h
+++ b/hw/mcu/nxp/MK64F12/include/mcu/cortex_m4.h
@@ -30,8 +30,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC	(1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/nxp/MK64F12/syscfg.yml b/hw/mcu/nxp/MK64F12/syscfg.yml
index 7a8fc78..b5b3747 100644
--- a/hw/mcu/nxp/MK64F12/syscfg.yml
+++ b/hw/mcu/nxp/MK64F12/syscfg.yml
@@ -34,3 +34,6 @@ syscfg.defs:
     HASH:
         description: 'Enable hash accelerator (CAU)'
         value: 0
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 1000
diff --git a/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h b/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h
index 3c846e0..5dbcca9 100644
--- a/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h
+++ b/hw/mcu/nxp/mkw41z/include/mcu/cortex_m0.h
@@ -26,14 +26,6 @@
 extern "C" {
 #endif
 
-/*
- * NOTE: the current timer used for this chip is a 1 kHz clock. Thus, the
- * number of OS ticks per second should be a multiple of 1000. If interrupts
- * are disabled for longer than an ostick it is possible that os time will not
- * be accurate.
- */
-#define OS_TICKS_PER_SEC	(1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/mips/danube/syscfg.yml b/hw/mcu/nxp/mkw41z/syscfg.yml
similarity index 72%
copy from hw/mcu/mips/danube/syscfg.yml
copy to hw/mcu/nxp/mkw41z/syscfg.yml
index d2cb541..68e5166 100644
--- a/hw/mcu/mips/danube/syscfg.yml
+++ b/hw/mcu/nxp/mkw41z/syscfg.yml
@@ -16,9 +16,9 @@
 # under the License.
 #
 
-syscfg.defs:
-    MCU_FLASH_MIN_WRITE_SIZE:
-        description: >
-            Specifies the required alignment for internal flash writes.
-            Used internally by the newt tool.
-        value: 1
+syscfg.vals:
+    # NOTE: the current timer used for this chip is a 1 kHz clock. Thus, the
+    # number of OS ticks per second should be a multiple of 1000. If interrupts
+    # are disabled for longer than an ostick it is possible that os time will not
+    # be accurate.
+    OS_TICKS_PER_SEC: 1000
diff --git a/hw/mcu/sifive/fe310/include/mcu/fe310.h b/hw/mcu/sifive/fe310/include/mcu/fe310.h
index 9ccb65e..3971cc4 100644
--- a/hw/mcu/sifive/fe310/include/mcu/fe310.h
+++ b/hw/mcu/sifive/fe310/include/mcu/fe310.h
@@ -30,8 +30,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    MYNEWT_VAL(OS_TICKS_PER_SEC)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/sifive/fe310/syscfg.yml b/hw/mcu/sifive/fe310/syscfg.yml
index 9361824..d3dc14b 100644
--- a/hw/mcu/sifive/fe310/syscfg.yml
+++ b/hw/mcu/sifive/fe310/syscfg.yml
@@ -70,10 +70,6 @@ syscfg.defs:
     TIMER_2:
         description: 'Whether to use PWM0 8 bit timer as system timer'
         value:  0
-    OS_TICKS_PER_SEC:
-        description: 'Desired ticks frequency in Hz'
-        value: 128
-        range: 128,256,512,1024
     OS_TICKLESS_SLEEP:
         description: 'Enable tickless sleep'
         value: 1
@@ -85,3 +81,9 @@ syscfg.defs:
             This maybe useful when .bssnz section is being used to store data across
             software reboots.
         value: 1
+
+syscfg.vals:
+    OS_TICKS_PER_SEC: 128
+
+syscfg.restrictions:
+    - "(OS_TICKS_PER_SEC == 128 || OS_TICKS_PER_SEC == 256 || OS_TICKS_PER_SEC == 512 || OS_TICKS_PER_SEC == 1024)"
diff --git a/hw/mcu/stm/stm32_common/syscfg.yml b/hw/mcu/stm/stm32_common/syscfg.yml
index abb641e..604955a 100644
--- a/hw/mcu/stm/stm32_common/syscfg.yml
+++ b/hw/mcu/stm/stm32_common/syscfg.yml
@@ -433,7 +433,5 @@ syscfg.defs:
         description: "ADC_2"
         value:  0
 
-    OS_TICKS_PER_SEC:
-        description: >
-            Desired ticks frequency in Hz.
-        value: 1000
+syscfg.vals:
+    OS_TICKS_PER_SEC: 1000
diff --git a/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h b/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h
index c27f1dc..dc920f9 100644
--- a/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h
+++ b/hw/mcu/stm/stm32f0xx/include/mcu/cortex_m0.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h b/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h
index 6f4cede..9d92f58 100644
--- a/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h
+++ b/hw/mcu/stm/stm32f1xx/include/mcu/cortex_m3.h
@@ -27,8 +27,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    MYNEWT_VAL(OS_TICKS_PER_SEC)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h b/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h
index 5e00717..ec77a67 100644
--- a/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32f3xx/include/mcu/cortex_m4.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h b/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h
index d846ed1..3c7d2cc 100644
--- a/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32f4xx/include/mcu/cortex_m4.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h b/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h
index 5ffb6dd..6c878bc 100644
--- a/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h
+++ b/hw/mcu/stm/stm32f7xx/include/mcu/cortex_m7.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h b/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h
index fe0fe12..a49876d 100644
--- a/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h
+++ b/hw/mcu/stm/stm32l0xx/include/mcu/cortex_m0.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h b/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h
index 41d945f..d43fc56 100644
--- a/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h
+++ b/hw/mcu/stm/stm32l1xx/include/mcu/cortex_m3.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h b/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h
index 7697201..8aabe39 100644
--- a/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32l4xx/include/mcu/cortex_m4.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {
diff --git a/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h b/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h
index 5a04e73..a4d6dfe 100644
--- a/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h
+++ b/hw/mcu/stm/stm32wbxx/include/mcu/cortex_m4.h
@@ -26,8 +26,6 @@
 extern "C" {
 #endif
 
-#define OS_TICKS_PER_SEC    (1000)
-
 static inline void
 hal_debug_break(void)
 {