From d1002e798ec91e9c570f11613f80e73f381123ae Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Tue, 21 Jul 2015 15:01:05 -0700 Subject: [PATCH] common: Untie math_util from motion sense. math library can be set independentely. It is implied when motion sensor drivers are compiled in. BRANCH=smaug TEST=Build strago board specific tests, host test and ran ryu image. BUG=chromium:512329 Change-Id: I743ea7b44e4a3783602c11f3928cb3fa4b105ec4 Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/287371 Reviewed-by: Vincent Palatin --- common/build.mk | 8 ++++++-- driver/accel_kxcj9.c | 1 + driver/accelgyro_bmi160.c | 1 + driver/accelgyro_lsm6ds0.c | 1 + include/config.h | 5 +++-- test/math_util.tasklist | 3 +-- test/test_config.h | 4 ++++ 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/common/build.mk b/common/build.mk index 4d90347608..32012e400c 100644 --- a/common/build.mk +++ b/common/build.mk @@ -9,6 +9,9 @@ common-y=util.o common-y+=version.o printf.o queue.o queue_policies.o +common-$(CONFIG_ACCELGYRO_BMI160)+=math_util.o +common-$(CONFIG_ACCELGYRO_LSM6DS0)+=math_util.o +common-$(CONFIG_ACCEL_KXCJ9)+=math_util.o common-$(CONFIG_ADC)+=adc.o common-$(CONFIG_ALS)+=als.o common-$(CONFIG_AP_HANG_DETECT)+=ap_hang_detect.o @@ -56,7 +59,7 @@ common-$(CONFIG_KEYBOARD_PROTOCOL_MKBP)+=keyboard_mkbp.o common-$(CONFIG_KEYBOARD_TEST)+=keyboard_test.o common-$(CONFIG_LED_COMMON)+=led_common.o common-$(CONFIG_LED_POLICY_STD)+=led_policy_std.o -common-$(CONFIG_LID_ANGLE)+=motion_lid.o +common-$(CONFIG_LID_ANGLE)+=motion_lid.o math_util.o common-$(CONFIG_LID_ANGLE_KEY_SCAN)+=lid_angle.o common-$(CONFIG_LID_SWITCH)+=lid_switch.o common-$(CONFIG_LPC)+=acpi.o port80.o @@ -69,6 +72,7 @@ common-$(CONFIG_PWM)+=pwm.o common-$(CONFIG_PWM_KBLIGHT)+=pwm_kblight.o common-$(CONFIG_RSA)+=rsa.o common-$(CONFIG_RWSIG)+=rwsig.o +common-$(CONFIG_MATH_UTIL)+=math_util.o common-$(CONFIG_SHA1)+=sha1.o common-$(CONFIG_SHA256)+=sha256.o common-$(CONFIG_SMBUS)+= smbus.o @@ -93,5 +97,5 @@ common-$(HAS_TASK_HOSTCMD)+=host_command.o 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 math_util.o +common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o common-$(TEST_BUILD)+=test_util.o diff --git a/driver/accel_kxcj9.c b/driver/accel_kxcj9.c index a9bc5a0964..292b43f3fc 100644 --- a/driver/accel_kxcj9.c +++ b/driver/accel_kxcj9.c @@ -11,6 +11,7 @@ #include "driver/accel_kxcj9.h" #include "gpio.h" #include "i2c.h" +#include "math_util.h" #include "task.h" #include "timer.h" #include "util.h" diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index b07d4f3851..10e4905fa9 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -15,6 +15,7 @@ #include "driver/mag_bmm150.h" #include "hooks.h" #include "i2c.h" +#include "math_util.h" #include "task.h" #include "timer.h" #include "util.h" diff --git a/driver/accelgyro_lsm6ds0.c b/driver/accelgyro_lsm6ds0.c index ebf3a7f1b5..ebd9bd745e 100644 --- a/driver/accelgyro_lsm6ds0.c +++ b/driver/accelgyro_lsm6ds0.c @@ -14,6 +14,7 @@ #include "driver/accelgyro_lsm6ds0.h" #include "hooks.h" #include "i2c.h" +#include "math_util.h" #include "task.h" #include "util.h" diff --git a/include/config.h b/include/config.h index a268f5d3ae..6043769986 100644 --- a/include/config.h +++ b/include/config.h @@ -1137,6 +1137,9 @@ /* Use Link-Time Optimizations to try to reduce the firmware code size */ #undef CONFIG_LTO +/* Need for a math library */ +#undef CONFIG_MATH_UTIL + /* Presence of a Bosh Sensortec BMM150 magnetometer behind a BMI160. */ #undef CONFIG_MAG_BMI160_BMM150 @@ -1823,8 +1826,6 @@ */ #include "test_config.h" - -/*****************************************************************************/ /* * Sanity checks to make sure some of the configs above make sense. */ diff --git a/test/math_util.tasklist b/test/math_util.tasklist index 60688f9c34..f6dffa16e8 100644 --- a/test/math_util.tasklist +++ b/test/math_util.tasklist @@ -14,5 +14,4 @@ * '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_TEST_TASK_LIST \ - TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) +#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/test_config.h b/test/test_config.h index 637c9630b3..bc517314b6 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -35,6 +35,10 @@ #define CONFIG_KEYBOARD_PROTOCOL_MKBP #endif +#ifdef TEST_MATH_UTIL +#define CONFIG_MATH_UTIL +#endif + #ifdef TEST_MOTION_LID #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_SENSOR_BASE 0