From 1f00fc154af5e367c2347e4c951fe08719c7e269 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Thu, 26 Jan 2012 01:05:45 +0000 Subject: [PATCH] Make more features optional Preparatory work to introduce a second SoC : 2nd series 3/4 Some modules won't be used on other designs, make them optional. Signed-off-by: Vincent Palatin BUG=None TEST=run the EC firmware on BDS and check that the commands from the optional features are still available and working. Change-Id: I979864ed94dc4da90c1010bd2e4589d84bc2d046 --- chip/lm4/build.mk | 10 +++++++--- chip/lm4/config.h | 6 ++++++ common/build.mk | 9 ++++++--- common/main.c | 9 +++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/chip/lm4/build.mk b/chip/lm4/build.mk index b69b2d7d9a..cfd78e9866 100644 --- a/chip/lm4/build.mk +++ b/chip/lm4/build.mk @@ -8,7 +8,11 @@ # LM4 SoC has a Cortex-M4 ARM core CORE:=cortex-m -chip-y=pwm.o i2c.o adc.o jtag.o -chip-y+=clock.o gpio.o system.o lpc.o uart.o power_button.o -chip-y+=flash.o watchdog.o eeprom.o temp_sensor.o hwtimer.o +chip-y=i2c.o adc.o jtag.o +chip-y+=clock.o gpio.o system.o uart.o power_button.o +chip-y+=watchdog.o eeprom.o hwtimer.o +chip-$(CONFIG_FLASH)+=flash.o +chip-$(CONFIG_LPC)+=lpc.o +chip-$(CONFIG_PWM)+=pwm.o +chip-$(CONFIG_TEMP_SENSOR)+=temp_sensor.o chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_scan.o diff --git a/chip/lm4/config.h b/chip/lm4/config.h index d4f81d253c..4ae55d185f 100644 --- a/chip/lm4/config.h +++ b/chip/lm4/config.h @@ -31,5 +31,11 @@ /* build with assertions and debug messages */ #define CONFIG_DEBUG +/* Optional features */ +#define CONFIG_FLASH +#define CONFIG_LPC +#define CONFIG_PWM +#define CONFIG_TEMP_SENSOR + /* Compile for running from RAM instead of flash */ /* #define COMPILE_FOR_RAM */ diff --git a/common/build.mk b/common/build.mk index 1024a8a0ad..3a649909c5 100644 --- a/common/build.mk +++ b/common/build.mk @@ -5,9 +5,12 @@ # Common files build # -common-y=main.o util.o console.o vboot.o pwm_commands.o -common-y+=flash_commands.o port80.o -common-y+=memory_commands.o shared_mem.o temp_sensor_commands.o usb_charge.o +common-y=main.o util.o console.o vboot.o +common-y+=memory_commands.o shared_mem.o usb_charge.o +common-$(CONFIG_LPC)+=port80.o common-$(CONFIG_TASK_HOSTCMD)+=host_command.o common-$(CONFIG_TASK_I8042CMD)+=i8042.o keyboard.o common-$(CONFIG_TASK_X86POWER)+=x86_power.o +common-$(CONFIG_FLASH)+=flash_commands.o +common-$(CONFIG_PWM)+=pwm_commands.o +common-$(CONFIG_TEMP_SENSOR)+=temp_sensor_commands.o diff --git a/common/main.c b/common/main.c index 293d591c2e..d9d1f5375c 100644 --- a/common/main.c +++ b/common/main.c @@ -6,6 +6,7 @@ */ #include "adc.h" +#include "config.h" #include "clock.h" #include "console.h" #include "eeprom.h" @@ -60,13 +61,21 @@ int main(void) timer_init(); uart_init(); system_init(); +#ifdef CONFIG_FLASH flash_init(); +#endif eeprom_init(); +#ifdef CONFIG_LPC port_80_init(); lpc_init(); +#endif +#ifdef CONFIG_PWM pwm_init(); +#endif i2c_init(); +#ifdef CONFIG_TEMP_SENSOR temp_sensor_init(); +#endif power_button_init(); adc_init(); usb_charge_init();