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>
This commit is contained in:
Andy Ross 2019-06-16 14:50:32 -07:00 committed by Anas Nashif
parent 33c64c2578
commit ee4c23cc1f
4 changed files with 14 additions and 0 deletions

View file

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

View file

@ -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

View file

@ -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

View file

@ -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