This is an automated email from the ASF dual-hosted git repository. wes3 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push: new 02ff200 [Feature]: Main Task OS Sanity Check (#1838) 02ff200 is described below commit 02ff200534f54a42cbf91b091543dedfe28671dd Author: brolan-juul <33846322+brolan-j...@users.noreply.github.com> AuthorDate: Fri May 31 11:22:40 2019 -0700 [Feature]: Main Task OS Sanity Check (#1838) * Adding os_sanity check to main_task. * Fixed stylistic issue. --- kernel/os/src/os.c | 18 +++++++++++++----- kernel/os/syscfg.yml | 5 +++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/kernel/os/src/os.c b/kernel/os/src/os.c index 5cc9fa4..6ccd95b 100644 --- a/kernel/os/src/os.c +++ b/kernel/os/src/os.c @@ -45,8 +45,14 @@ OS_TASK_STACK_DEFINE(g_idle_task_stack, OS_IDLE_STACK_SIZE); uint32_t g_os_idle_ctr; -static struct os_task os_main_task; -OS_TASK_STACK_DEFINE(os_main_stack, OS_MAIN_STACK_SIZE); +struct os_task g_os_main_task; +OS_TASK_STACK_DEFINE(g_os_main_stack, OS_MAIN_STACK_SIZE); + +/* + * Double the interval timer to allow proper timer check-in. + */ +#define OS_MAIN_TASK_TIMER_TICKS \ + os_time_ms_to_ticks32(MYNEWT_VAL(OS_MAIN_TASK_SANITY_ITVL_MS)) * 2 #if MYNEWT_VAL(OS_WATCHDOG_MONITOR) @@ -227,11 +233,13 @@ os_init(int (*main_fn)(int argc, char **arg)) assert(err == OS_OK); if (main_fn) { - err = os_task_init(&os_main_task, "main", os_main, main_fn, - OS_MAIN_TASK_PRIO, OS_WAIT_FOREVER, os_main_stack, - OS_STACK_ALIGN(OS_MAIN_STACK_SIZE)); + err = os_task_init(&g_os_main_task, "main", os_main, main_fn, + OS_MAIN_TASK_PRIO, + (OS_MAIN_TASK_TIMER_TICKS == 0) ? OS_WAIT_FOREVER : OS_MAIN_TASK_TIMER_TICKS, + g_os_main_stack, OS_STACK_ALIGN(OS_MAIN_STACK_SIZE)); assert(err == 0); } + /* Call bsp related OS initializations */ hal_bsp_init(); diff --git a/kernel/os/syscfg.yml b/kernel/os/syscfg.yml index d9cc89e..746acb0 100644 --- a/kernel/os/syscfg.yml +++ b/kernel/os/syscfg.yml @@ -175,6 +175,11 @@ syscfg.defs: description: > If set, assert callback gets called inside __assert_func() value: 0 + OS_MAIN_TASK_SANITY_ITVL_MS: + description: > + Interval for sanity check on main task. Setting a 0 will disable + sanity check on main task. Value is in milliseconds. + value: 0 syscfg.vals.OS_DEBUG_MODE: OS_CRASH_STACKTRACE: 1