mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Only includes necessary tasks for test binaries
This changes current TASK() syntax to TASK_BASE() and TASK_NORMAL(), where TASK_BASE is necessary for the EC to boot on a board and TASK_NORMAL represents the task that can be removed in a test binary. Tasks introduced by a test should be listed as TASK_TEST(). Note that this CL breaks current tests (many of them are broken anyway), which will be fixed in up coming CLs. BUG=chrome-os-partner:18598 TEST=Build link/bds/spring/snow/daisy/mccroskey. (mccroskey failed for unrelated issue) BRANCH=none Change-Id: Ic645cdae0906ed21dc473553f1f43c2537ec4bb9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47531
This commit is contained in:
15
Makefile
15
Makefile
@@ -19,9 +19,18 @@ include board/$(BOARD)/build.mk
|
||||
|
||||
# Transform the configuration into make variables
|
||||
includes=include core/$(CORE)/include $(dirs) $(out)
|
||||
_tsk_lst:=$(shell echo "CONFIG_TASK_LIST" | $(CPP) -P -Iboard/$(BOARD) -Itest \
|
||||
-D"TASK(n, r, d, s)=n" -imacros $(PROJECT).tasklist)
|
||||
_tsk_cfg:=$(foreach t,$(_tsk_lst),CONFIG_TASK_$(t))
|
||||
ifeq "$(TEST_BUILD)" "y"
|
||||
_tsk_lst:=$(shell echo "CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST" | \
|
||||
$(CPP) -P -Iboard/$(BOARD) -Itest \
|
||||
-D"TASK_NOTEST(n, r, d, s)=" -D"TASK_ALWAYS(n, r, d, s)=n" \
|
||||
-D"TASK_TEST(n, r, d, s)=n" -imacros ec.tasklist \
|
||||
-imacros $(PROJECT).tasklist)
|
||||
else
|
||||
_tsk_lst:=$(shell echo "CONFIG_TASK_LIST" | $(CPP) -P \
|
||||
-Iboard/$(BOARD) -D"TASK_NOTEST(n, r, d, s)=n" \
|
||||
-D"TASK_ALWAYS(n, r, d, s)=n" -imacros ec.tasklist)
|
||||
endif
|
||||
_tsk_cfg:=$(foreach t,$(_tsk_lst) ,CONFIG_TASK_$(t))
|
||||
_flag_cfg:=$(shell $(CPP) $(CPPFLAGS) -P -dN chip/$(CHIP)/config.h | \
|
||||
grep -o "CONFIG_.*") \
|
||||
$(shell $(CPP) $(CPPFLAGS) -P -dN board/$(BOARD)/board.h | \
|
||||
|
||||
@@ -63,7 +63,7 @@ $(test-targets): test-%:
|
||||
@set -e ; \
|
||||
echo " BUILD $(out)/$*" ; \
|
||||
$(MAKE) --no-print-directory BOARD=$(BOARD) PROJECT=$* \
|
||||
V=$(V) out=$(out)/$*
|
||||
V=$(V) out=$(out)/$* TEST_BUILD=y
|
||||
|
||||
$(qemu-test-targets): qemu-%: test-%
|
||||
$(call quiet,qemu,TEST )
|
||||
|
||||
@@ -25,11 +25,13 @@ CFLAGS_WARN=-Wall -Werror -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack
|
||||
CFLAGS_DEBUG= -g
|
||||
CFLAGS_INCLUDE=$(foreach i,$(includes),-I$(i) )
|
||||
CFLAGS_DEFINE=-DOUTDIR=$(out) -DCHIP=$(CHIP) -DTASKFILE=$(PROJECT).tasklist \
|
||||
-DBOARD=$(BOARD) -DBOARD_$(BOARD) -DCORE=$(CORE) -DCHIP_$(CHIP) \
|
||||
-DCHIP_VARIANT=$(CHIP_VARIANT) -DCHIP_VARIANT_$(CHIP_VARIANT) \
|
||||
-DPROJECT=$(PROJECT)
|
||||
CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(EXTRA_CFLAGS)
|
||||
CFLAGS_TEST=$(if $(TEST_BUILD),-DTEST_BUILD \
|
||||
-DTEST_TASKFILE=$(PROJECT).tasklist,)
|
||||
CFLAGS_DEFINE=-DOUTDIR=$(out) -DCHIP=$(CHIP) -DBOARD_TASKFILE=ec.tasklist \
|
||||
-DBOARD=$(BOARD) -DBOARD_$(BOARD) -DCORE=$(CORE) \
|
||||
-DCHIP_$(CHIP) -DCHIP_VARIANT=$(CHIP_VARIANT) \
|
||||
-DCHIP_VARIANT_$(CHIP_VARIANT) -DPROJECT=$(PROJECT)
|
||||
CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(CFLAGS_TEST) $(EXTRA_CFLAGS)
|
||||
CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(CFLAGS_WARN) $(CFLAGS_y)
|
||||
BUILD_CFLAGS=$(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
|
||||
HOST_CFLAGS=$(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
|
||||
|
||||
@@ -8,13 +8,15 @@
|
||||
*
|
||||
* The first one has the lowest priority.
|
||||
*
|
||||
* For each task, use the macro TASK(n, r, d, s) where :
|
||||
* 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
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(LIGHTBAR, lightbar_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CONSOLE, console_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(LIGHTBAR, lightbar_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -8,17 +8,19 @@
|
||||
*
|
||||
* The first one has the lowest priority.
|
||||
*
|
||||
* For each task, use the macro TASK(n, r, d, s) where :
|
||||
* 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
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -8,21 +8,23 @@
|
||||
*
|
||||
* The first one has the lowest priority.
|
||||
*
|
||||
* For each task, use the macro TASK(n, r, d, s) where :
|
||||
* 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' is the name of the task
|
||||
* 'r' is the main routine of the task
|
||||
* 'd' is an opaque parameter passed to the routine at startup
|
||||
* 's' is the stack size in bytes; must be a multiple of 8
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK(LIGHTBAR, lightbar_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(THERMAL, thermal_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK(SWITCH, switch_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(LIGHTBAR, lightbar_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(THERMAL, thermal_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(SWITCH, switch_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -8,14 +8,16 @@
|
||||
*
|
||||
* The first one has the lowest priority.
|
||||
*
|
||||
* For each task, use the macro TASK(n, r, d, s) where :
|
||||
* 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
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYSCAN, keyboard_scan_task, NULL, 360) \
|
||||
TASK(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, 360) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
* 's' is the stack size in bytes; must be a multiple of 8
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -8,18 +8,20 @@
|
||||
*
|
||||
* The first one has the lowest priority.
|
||||
*
|
||||
* For each task, use the macro TASK(n, r, d, s) where :
|
||||
* 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
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(POWERLED, power_led_task, NULL, 256) \
|
||||
TASK(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYSCAN, keyboard_scan_task, NULL, 360) \
|
||||
TASK(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(POWERLED, power_led_task, NULL, 256) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, 360) \
|
||||
TASK_ALWAYS(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -8,17 +8,19 @@
|
||||
*
|
||||
* The first one has the lowest priority.
|
||||
*
|
||||
* For each task, use the macro TASK(n, r, d, s) where :
|
||||
* 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
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(KEYSCAN, keyboard_scan_task, NULL, 256) \
|
||||
TASK(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, 256) \
|
||||
TASK_ALWAYS(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
@@ -33,17 +33,17 @@ typedef union {
|
||||
|
||||
/* declare task routine prototypes */
|
||||
#define TASK(n, r, d, s) int r(void *);
|
||||
#include TASK_LIST
|
||||
void __idle(void);
|
||||
CONFIG_TASK_LIST
|
||||
CONFIG_TEST_TASK_LIST
|
||||
#undef TASK
|
||||
|
||||
/* Task names for easier debugging */
|
||||
#define TASK(n, r, d, s) #n,
|
||||
#include TASK_LIST
|
||||
static const char * const task_names[] = {
|
||||
"<< idle >>",
|
||||
CONFIG_TASK_LIST
|
||||
CONFIG_TEST_TASK_LIST
|
||||
};
|
||||
#undef TASK
|
||||
|
||||
@@ -96,7 +96,6 @@ static void task_exit_trap(void)
|
||||
.pc = (uint32_t)r, \
|
||||
.stack_size = s, \
|
||||
},
|
||||
#include TASK_LIST
|
||||
static const struct {
|
||||
uint32_t r0;
|
||||
uint32_t pc;
|
||||
@@ -104,6 +103,7 @@ static const struct {
|
||||
} const tasks_init[] = {
|
||||
TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE)
|
||||
CONFIG_TASK_LIST
|
||||
CONFIG_TEST_TASK_LIST
|
||||
};
|
||||
#undef TASK
|
||||
|
||||
@@ -112,10 +112,10 @@ static task_ tasks[TASK_ID_COUNT];
|
||||
|
||||
/* Stacks for all tasks */
|
||||
#define TASK(n, r, d, s) + s
|
||||
#include TASK_LIST
|
||||
uint8_t task_stacks[0
|
||||
TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE)
|
||||
CONFIG_TASK_LIST
|
||||
CONFIG_TEST_TASK_LIST
|
||||
] __attribute__((aligned(8)));
|
||||
|
||||
#undef TASK
|
||||
|
||||
@@ -8,10 +8,27 @@
|
||||
#ifndef __TASK_ID_H
|
||||
#define __TASK_ID_H
|
||||
|
||||
/* excludes non-base tasks for test build */
|
||||
#ifdef TEST_BUILD
|
||||
#define TASK_NOTEST(n, r, d, s)
|
||||
#define TASK_TEST TASK
|
||||
#else
|
||||
#define TASK_NOTEST TASK
|
||||
#define CONFIG_TEST_TASK_LIST
|
||||
#endif
|
||||
|
||||
#define TASK_ALWAYS TASK
|
||||
|
||||
/* define the name of the header containing the list of tasks */
|
||||
#define STRINGIFY0(name) #name
|
||||
#define STRINGIFY(name) STRINGIFY0(name)
|
||||
#define TASK_LIST STRINGIFY(TASKFILE)
|
||||
#define TEST_TASK_LIST STRINGIFY(TEST_TASKFILE)
|
||||
#define BOARD_TASK_LIST STRINGIFY(BOARD_TASKFILE)
|
||||
|
||||
#include BOARD_TASK_LIST
|
||||
#ifdef TEST_BUILD
|
||||
#include TEST_TASK_LIST
|
||||
#endif
|
||||
|
||||
/* Task identifier (8 bits) */
|
||||
typedef uint8_t task_id_t;
|
||||
@@ -24,11 +41,12 @@ typedef uint8_t task_id_t;
|
||||
* TASK macro in the TASK_LIST file.
|
||||
*/
|
||||
#define TASK(n, r, d, s) TASK_ID_##n,
|
||||
#include TASK_LIST
|
||||
enum {
|
||||
TASK_ID_IDLE,
|
||||
/* CONFIG_TASK_LIST is a macro coming from the TASK_LIST file */
|
||||
/* CONFIG_TASK_LIST is a macro coming from the BOARD_TASK_LIST file */
|
||||
CONFIG_TASK_LIST
|
||||
/* CONFIG_TEST_TASK_LIST is a macro from the TEST_TASK_LIST file */
|
||||
CONFIG_TEST_TASK_LIST
|
||||
/* Number of tasks */
|
||||
TASK_ID_COUNT,
|
||||
/* Special task identifiers */
|
||||
|
||||
Reference in New Issue
Block a user