Skip to content
Permalink
Browse files

CMSIS v2: Work around time unit confusion

The current CMSIS v2 implementation is clearly assuming that timeout
arguments being passed to e.g. osDelay() are in units of Zephyr ticks,
not milliseconds as specified by ARM or (inconsistently) assumed by
our test code.

Most tests work with the ~100 Hz default tick rate, but they tend to
fail on precision issues at higher tick rates.  Force the CMSIS v2
applications to be 1000 Hz for now as a workaround, and detect the
mismatch as a build failure.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
  • Loading branch information...
andyross authored and nashif committed Jun 16, 2019
1 parent 33c64c2 commit ee4c23cc1f4a95173a651cace1b67dc042dbd16a
@@ -10,6 +10,13 @@
#include <ksched.h>
#include <cmsis_os2.h>

/* 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);

/**
@@ -9,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
@@ -10,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
@@ -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

0 comments on commit ee4c23c

Please sign in to comment.
You can’t perform that action at this time.