File tree Expand file tree Collapse file tree 6 files changed +14
-10
lines changed Expand file tree Collapse file tree 6 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ CONFIG_CBPRINTF_FP_SUPPORT=y
2020
2121CONFIG_GPIO=y
2222
23- CONFIG_MAIN_THREAD_PRIORITY=-1
24-
2523# Configuration variant:
2624# Memory allocation using the stack memory
2725# Single-threaded benchmark execution
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ CONFIG_CBPRINTF_FP_SUPPORT=y
2020
2121CONFIG_GPIO=y
2222
23- CONFIG_MAIN_THREAD_PRIORITY=-1
24-
2523# Configuration variant:
2624# Memory allocation using the stack memory
2725# Single-threaded benchmark execution
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ CONFIG_CBPRINTF_FP_SUPPORT=y
2020
2121CONFIG_GPIO=y
2222
23- CONFIG_MAIN_THREAD_PRIORITY=-1
24-
2523# Configuration variant:
2624# Memory allocation using the heap memory
2725# Single-threaded benchmark execution
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ CONFIG_CBPRINTF_FP_SUPPORT=y
2020
2121CONFIG_GPIO=y
2222
23- CONFIG_MAIN_THREAD_PRIORITY=-1
24-
2523# Configuration variant:
2624# Memory allocation using the stack memory
2725# Multi-threaded benchmark execution
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ CONFIG_CBPRINTF_FP_SUPPORT=y
2020
2121CONFIG_GPIO=y
2222
23- CONFIG_MAIN_THREAD_PRIORITY=-1
24-
2523# Configuration variant:
2624# Memory allocation using the static memory
2725# Single-threaded benchmark execution
Original file line number Diff line number Diff line change 1515
1616LOG_MODULE_REGISTER (app , LOG_LEVEL_INF );
1717
18+ #define COOP_PRIO -1
19+
1820#ifndef CONFIG_APP_MODE_FLASH_AND_RUN
1921/*
2022 * Get button configuration from the devicetree. This is mandatory.
@@ -170,8 +172,20 @@ static int button_init(void)
170172 return ret ;
171173}
172174
175+ static void main_thread_priority_cooperative_set (void )
176+ {
177+ BUILD_ASSERT (CONFIG_MAIN_THREAD_PRIORITY >= 0 );
178+ k_thread_priority_set (k_current_get (), COOP_PRIO );
179+ }
180+
173181int main (void )
174182{
183+ /* Drivers need to be run from a non-blocking thread.
184+ * We need preemptive priority during init.
185+ * Later we prefer cooperative priority to ensure no interference with the benchmark.
186+ */
187+ main_thread_priority_cooperative_set ();
188+
175189 LOG_INF ("CoreMark sample for %s" , CONFIG_BOARD_TARGET );
176190
177191 if (IS_ENABLED (CONFIG_APP_MODE_FLASH_AND_RUN )) {
You can’t perform that action at this time.
0 commit comments