diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2016-07-08 12:42:45 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-11 21:27:46 -0700 |
commit | afa53e3950abd4727eab9b14275b4805495767b7 (patch) | |
tree | a73c70b60b7d16a570a9324c88ca90d159c6e95c | |
parent | 9a710bd340f12db0334e08bc46cb2228f42ff956 (diff) | |
download | chrome-ec-afa53e3950abd4727eab9b14275b4805495767b7.tar.gz |
Add cts.tasklist
cts.tasklist contains tasks run only for CTS. These tasks are added to the
tasks registered in ec.tasklist with higher priority. This design allows
board directories to be free from CTS stuff.
cts.tasklist can be placed in each suite directory (cts/suite/cts.tasklist).
If a suite does not define its own cts.tasklist, the common list is used
(i.e. cts/cts.tasklist).
BUG=chromium:624520
BRANCH=none
TEST=Ran the followings:
make buildall
make CTS_MODULE=gpio BOARD=nucleo-f072rb
make CTS_MODULE=gpio BOARD=stm32l476g-eval
Change-Id: Ibb242297ee10a397a8fcb6ff73d8cbc560daa885
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359445
Reviewed-by: Chris Chen <twothreecc@google.com>
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | Makefile.toolchain | 3 | ||||
-rw-r--r-- | board/nucleo-f072rb/ec.tasklist | 3 | ||||
-rw-r--r-- | board/stm32l476g-eval/ec.tasklist | 3 | ||||
-rw-r--r-- | common/build.mk | 5 | ||||
-rw-r--r-- | core/cortex-m/task.c | 4 | ||||
-rw-r--r-- | core/cortex-m0/task.c | 4 | ||||
-rw-r--r-- | core/host/task.c | 3 | ||||
-rw-r--r-- | cts/cts.tasklist | 22 | ||||
-rw-r--r-- | include/config.h | 11 | ||||
-rw-r--r-- | include/task_id.h | 12 |
11 files changed, 72 insertions, 14 deletions
@@ -58,6 +58,9 @@ UC_PROJECT:=$(call uppercase,$(PROJECT)) # the board/project/chip/core variables are defined, since some of the configs # are dependent on particular configurations. includes=include core/$(CORE)/include $(dirs) $(out) test +ifdef CTS_MODULE +includes+=cts/$(CTS_MODULE) cts +endif ifeq "$(TEST_BUILD)" "y" _tsk_lst_file:=ec.tasklist _tsk_lst:=$(shell echo "CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST" | \ @@ -66,17 +69,20 @@ ifeq "$(TEST_BUILD)" "y" -D"TASK_TEST(n, r, d, s)=n" -imacros $(_tsk_lst_file) \ -imacros $(PROJECT).tasklist) else ifdef CTS_MODULE - _tsk_lst_file:=$(PROJECT).tasklist - _tsk_lst:=$(shell echo "CONFIG_TASK_LIST" | $(CPP) -P \ - -I$(BDIR) -D"TASK_NOTEST(n, r, d, s)=n" -D"TASK_CTS(n, r, d, s)=n" \ - -D"TASK_ALWAYS(n, r, d, s)=n" -imacros $(_tsk_lst_file)) + _tsk_lst_file:=ec.tasklist + _tsk_lst:=$(shell echo "CONFIG_TASK_LIST CONFIG_CTS_TASK_LIST" | \ + $(CPP) -P -I cts/$(CTS_MODULE) -Icts -I$(BDIR) \ + -D"TASK_NOTEST(n, r, d, s)=n" \ + -D"TASK_ALWAYS(n, r, d, s)=n" \ + -imacros $(_tsk_lst_file) \ + -imacros cts.tasklist) else _tsk_lst_file:=$(PROJECT).tasklist _tsk_lst:=$(shell echo "CONFIG_TASK_LIST" | $(CPP) -P \ -I$(BDIR) -D"TASK_NOTEST(n, r, d, s)=n" \ - -D"TASK_CTS(n, r, d, s)=" \ -D"TASK_ALWAYS(n, r, d, s)=n" -imacros $(_tsk_lst_file)) endif + _tsk_cfg:=$(foreach t,$(_tsk_lst) ,HAS_TASK_$(t)) CPPFLAGS+=$(foreach t,$(_tsk_cfg),-D$(t)) _flag_cfg:=$(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) -I$(BDIR) \ diff --git a/Makefile.toolchain b/Makefile.toolchain index 26e9c57690..d611c1bc94 100644 --- a/Makefile.toolchain +++ b/Makefile.toolchain @@ -35,7 +35,8 @@ CFLAGS_DEBUG= -g CFLAGS_INCLUDE=$(foreach i,$(includes),-I$(i) ) -I. CFLAGS_TEST=$(if $(TEST_BUILD),-DTEST_BUILD \ -DTEST_TASKFILE=$(PROJECT).tasklist,) \ - $(if $(CTS_MODULE), -DCTS_MODULE=$(CTS_MODULE)) \ + $(if $(CTS_MODULE), -DCTS_MODULE=$(CTS_MODULE) \ + -DCTS_TASKFILE=cts.tasklist) \ $(if $(EMU_BUILD),-DEMU_BUILD) \ $(if $($(PROJECT)-scale),-DTEST_TIME_SCALE=$($(PROJECT)-scale)) \ -DTEST_$(PROJECT) -DTEST_$(UC_PROJECT) diff --git a/board/nucleo-f072rb/ec.tasklist b/board/nucleo-f072rb/ec.tasklist index c9b8950f71..1944ef3874 100644 --- a/board/nucleo-f072rb/ec.tasklist +++ b/board/nucleo-f072rb/ec.tasklist @@ -18,5 +18,4 @@ */ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_CTS(CTS, cts_task, NULL, TASK_STACK_SIZE) + TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/board/stm32l476g-eval/ec.tasklist b/board/stm32l476g-eval/ec.tasklist index be8895ba73..abe3ced689 100644 --- a/board/stm32l476g-eval/ec.tasklist +++ b/board/stm32l476g-eval/ec.tasklist @@ -18,6 +18,5 @@ */ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_CTS(CTS, cts_task, NULL, TASK_STACK_SIZE) + TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/common/build.mk b/common/build.mk index da386b85ab..1ebc48e63b 100644 --- a/common/build.mk +++ b/common/build.mk @@ -101,4 +101,9 @@ common-$(HAS_TASK_PDCMD)+=host_command_pd.o common-$(HAS_TASK_KEYSCAN)+=keyboard_scan.o common-$(HAS_TASK_LIGHTBAR)+=lb_common.o lightbar.o common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o + +ifeq ($(CTS_MODULE),) common-$(TEST_BUILD)+=test_util.o +else +common-y+=test_util.o +endif
\ No newline at end of file diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index 91b9e62caa..ae2882ac10 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -36,6 +36,7 @@ typedef union { void __idle(void); CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST +CONFIG_CTS_TASK_LIST #undef TASK /* Task names for easier debugging */ @@ -44,6 +45,7 @@ static const char * const task_names[] = { "<< idle >>", CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST }; #undef TASK @@ -117,6 +119,7 @@ static const struct { TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST }; #undef TASK @@ -133,6 +136,7 @@ uint8_t task_stacks[0 TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST ] __aligned(8); #undef TASK diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c index b013fe82f4..5d219a5149 100644 --- a/core/cortex-m0/task.c +++ b/core/cortex-m0/task.c @@ -36,6 +36,7 @@ typedef union { void __idle(void); CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST +CONFIG_CTS_TASK_LIST #undef TASK /* Task names for easier debugging */ @@ -44,6 +45,7 @@ static const char * const task_names[] = { "<< idle >>", CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST }; #undef TASK @@ -97,6 +99,7 @@ static const struct { TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST }; #undef TASK @@ -113,6 +116,7 @@ uint8_t task_stacks[0 TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST ] __aligned(8); #undef TASK diff --git a/core/host/task.c b/core/host/task.c index 8e85679890..7a17e13e89 100644 --- a/core/host/task.c +++ b/core/host/task.c @@ -61,6 +61,7 @@ static void task_enable_all_tasks_callback(void); #define TASK(n, r, d, s) void r(void *); CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST +CONFIG_CTS_TASK_LIST #undef TASK /* Idle task */ @@ -80,6 +81,7 @@ struct task_args task_info[TASK_ID_COUNT] = { {__idle, NULL}, CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST {_run_test, NULL}, }; #undef TASK @@ -89,6 +91,7 @@ static const char * const task_names[] = { "<< idle >>", CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST + CONFIG_CTS_TASK_LIST "<< test runner >>", }; #undef TASK diff --git a/cts/cts.tasklist b/cts/cts.tasklist new file mode 100644 index 0000000000..73e959684f --- /dev/null +++ b/cts/cts.tasklist @@ -0,0 +1,22 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * List of enabled tasks in the priority order + * + * The first one has the lowest priority. + * + * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and + * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, + * where : + * 'n' in the name of the task + * 'r' in the main routine of the task + * 'd' in an opaque parameter passed to the routine at startup + * 's' is the stack size in bytes; must be a multiple of 8 + */ + +/* Default task list for suites which don't define its own */ +#define CONFIG_CTS_TASK_LIST \ + TASK_ALWAYS(CTS, cts_task, NULL, TASK_STACK_SIZE) diff --git a/include/config.h b/include/config.h index bf4cf994b1..d1de4f5c79 100644 --- a/include/config.h +++ b/include/config.h @@ -1715,6 +1715,17 @@ #undef CONFIG_TEST_TASK_LIST /* + * List of tasks used by CTS + * + * cts.tasklist contains tasks run only for CTS. These tasks are added to the + * tasks registered in ec.tasklist with higher priority. + * + * If a CTS suite does not define its own cts.tasklist, the common list is used + * (i.e. cts/cts.tasklist). + */ +#undef CONFIG_CTS_TASK_LIST + +/* * Enable task profiling. * * Boards may #undef this to reduce image size and RAM usage. diff --git a/include/task_id.h b/include/task_id.h index 34f24f097d..bcd0b61c85 100644 --- a/include/task_id.h +++ b/include/task_id.h @@ -17,10 +17,8 @@ #define CONFIG_TEST_TASK_LIST #endif -#ifdef CTS_MODULE -#define TASK_CTS TASK -#else -#define TASK_CTS(n, r, d, s) +#ifndef CTS_MODULE +#define CONFIG_CTS_TASK_LIST #endif #define TASK_ALWAYS TASK @@ -28,10 +26,14 @@ /* define the name of the header containing the list of tasks */ #define STRINGIFY0(name) #name #define STRINGIFY(name) STRINGIFY0(name) +#define CTS_TASK_LIST STRINGIFY(CTS_TASKFILE) #define TEST_TASK_LIST STRINGIFY(TEST_TASKFILE) #define BOARD_TASK_LIST STRINGIFY(BOARD_TASKFILE) #include BOARD_TASK_LIST +#ifdef CTS_MODULE +#include CTS_TASK_LIST +#endif #ifdef TEST_BUILD #include TEST_TASK_LIST #endif @@ -53,6 +55,8 @@ enum { CONFIG_TASK_LIST /* CONFIG_TEST_TASK_LIST is a macro from the TEST_TASK_LIST file */ CONFIG_TEST_TASK_LIST + /* For CTS tasks */ + CONFIG_CTS_TASK_LIST #ifdef EMU_BUILD TASK_ID_TEST_RUNNER, #endif |