summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-07-15 16:17:32 -0700
committerChromeBot <chrome-bot@google.com>2013-07-16 12:06:31 -0700
commit0c73fdae773be0d42c969e4171b0504fcf06b97a (patch)
tree120e5c72cc095911d5761f2004b959176bcc974c
parent873e4425c5e27be3019b0ca47251e6fb94715bd3 (diff)
downloadchrome-ec-0c73fdae773be0d42c969e4171b0504fcf06b97a.tar.gz
Make a top-level config.h file to include sub-configs
This file will soon contain the exhaustive list of all CONFIG defines and their descriptions. Chip-level configs are renamed to config_chip.h to avoid naming conflicts. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I9e94146f5b4c016894bd3ae3d371c4b9f3f69afe Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62122 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--Makefile6
-rw-r--r--chip/host/config_chip.h (renamed from chip/host/config.h)6
-rw-r--r--chip/lm4/config_chip.h (renamed from chip/lm4/config.h)6
-rw-r--r--chip/stm32/config_chip.h (renamed from chip/stm32/config.h)6
-rw-r--r--common/firmware_image.S1
-rw-r--r--common/firmware_image.lds.S1
-rw-r--r--include/common.h8
-rw-r--r--include/config.h162
8 files changed, 174 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 93b7b43028..50e057d699 100644
--- a/Makefile
+++ b/Makefile
@@ -35,10 +35,8 @@ else
endif
_tsk_cfg:=$(foreach t,$(_tsk_lst) ,HAS_TASK_$(t))
CPPFLAGS+=$(foreach t,$(_tsk_cfg),-D$(t))
-_flag_cfg:=$(shell $(CPP) $(CPPFLAGS) -P -dN chip/$(CHIP)/config.h | \
- grep -o "CONFIG_.*") \
- $(shell $(CPP) $(CPPFLAGS) -P -dN board/$(BOARD)/board.h | \
- grep -o "CONFIG_.*")
+_flag_cfg:=$(shell $(CPP) $(CPPFLAGS) -P -dN -Ichip/$(CHIP) -Iboard/$(BOARD) \
+ include/config.h | grep -o "CONFIG_.*")
$(foreach c,$(_tsk_cfg) $(_flag_cfg),$(eval $(c)=y))
$(eval BOARD_$(BOARD)=y)
diff --git a/chip/host/config.h b/chip/host/config_chip.h
index 9825f086e9..44ed02841a 100644
--- a/chip/host/config.h
+++ b/chip/host/config_chip.h
@@ -5,8 +5,8 @@
/* Chip config header file */
-#ifndef __CONFIG_H
-#define __CONFIG_H
+#ifndef __CROS_EC_CONFIG_CHIP_H
+#define __CROS_EC_CONFIG_CHIP_H
/* Memory mapping */
#define CONFIG_FLASH_PHYSICAL_SIZE 0x00020000
@@ -46,5 +46,5 @@ extern char __host_flash[CONFIG_FLASH_PHYSICAL_SIZE];
/* Interval between HOOK_TICK notifications */
#define HOOK_TICK_INTERVAL (250 * MSEC)
-#endif /* __CONFIG_H */
+#endif /* __CROS_EC_CONFIG_CHIP_H */
diff --git a/chip/lm4/config.h b/chip/lm4/config_chip.h
index 6be1085c02..849f68087d 100644
--- a/chip/lm4/config.h
+++ b/chip/lm4/config_chip.h
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#ifndef __CROS_EC_CHIP_CONFIG_H
-#define __CROS_EC_CHIP_CONFIG_H
+#ifndef __CROS_EC_CONFIG_CHIP_H
+#define __CROS_EC_CONFIG_CHIP_H
/* 16.000 Mhz internal oscillator frequency (PIOSC) */
#define INTERNAL_CLOCK 16000000
@@ -109,4 +109,4 @@
/* Compile for running from RAM instead of flash */
/* #define COMPILE_FOR_RAM */
-#endif /* __CROS_EC_CHIP_CONFIG_H */
+#endif /* __CROS_EC_CONFIG_CHIP_H */
diff --git a/chip/stm32/config.h b/chip/stm32/config_chip.h
index 6eb8a48b51..e6df7a7730 100644
--- a/chip/stm32/config.h
+++ b/chip/stm32/config_chip.h
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#ifndef __CROS_EC_CHIP_CONFIG_H
-#define __CROS_EC_CHIP_CONFIG_H
+#ifndef __CROS_EC_CONFIG_CHIP_H
+#define __CROS_EC_CONFIG_CHIP_H
/* use variant specific configuration for flash / UART / IRQ */
#if defined(CHIP_VARIANT_stm32l15x)
@@ -53,4 +53,4 @@
/* Compile for running from RAM instead of flash */
/* #define COMPILE_FOR_RAM */
-#endif /* __CROS_EC_CHIP_CONFIG_H */
+#endif /* __CROS_EC_CONFIG_CHIP_H */
diff --git a/common/firmware_image.S b/common/firmware_image.S
index 30f987d2fa..7ceb20bffe 100644
--- a/common/firmware_image.S
+++ b/common/firmware_image.S
@@ -5,7 +5,6 @@
* Build the full image with up to 3 copies (Read only, A, B) of the program
*/
-#include "board.h"
#include "config.h"
#define FW_FILE(builddir,proj,sect) builddir##/##proj##.##sect##.flat
diff --git a/common/firmware_image.lds.S b/common/firmware_image.lds.S
index 9df21d41f9..08e2138ad0 100644
--- a/common/firmware_image.lds.S
+++ b/common/firmware_image.lds.S
@@ -3,7 +3,6 @@
* found in the LICENSE file.
*/
-#include "board.h"
#include "config.h"
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
diff --git a/include/common.h b/include/common.h
index 8ee20620db..1fb4fc5563 100644
--- a/include/common.h
+++ b/include/common.h
@@ -22,13 +22,7 @@
#define __packed __attribute__((packed))
#endif
-/*
- * Include board and core configs, since those hold the CONFIG_ constants for a
- * given configuration. This guarantees they get included everywhere, and
- * fixes a fairly common bug where we gate out code with #ifndef
- * CONFIG_SOMETHING and but forget to include both of these.
- */
-#include "board.h"
+/* Include top-level configuration file */
#include "config.h"
/* List of common error codes that can be returned */
diff --git a/include/config.h b/include/config.h
new file mode 100644
index 0000000000..c0a6963646
--- /dev/null
+++ b/include/config.h
@@ -0,0 +1,162 @@
+/* Copyright (c) 2013 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.
+ */
+
+/*
+ * config.h - Top-level configuration Chrome EC
+ *
+ * All configuration settings (CONFIG_*) are defined in this file or in a
+ * sub-configuration file (config_chip.h, board.h, etc.) included by this file.
+ *
+ * Note that this file is included by assembly (.S) files. Any C-isms such as
+ * struct definitions or enums in a sub-configuration file MUST be guarded with
+ * #ifndef __ASSEMBLER__ to prevent those C-isms from being evaluated by the
+ * assembler.
+ */
+
+#ifndef __CROS_EC_CONFIG_H
+#define __CROS_EC_CONFIG_H
+
+/*
+ * TODO(rspangler): set defaults and describe ALL config variables.
+ *
+ * Here is the current list:
+
+CONFIG_ADC
+CONFIG_ASSERT_HELP
+CONFIG_BACKLIGHT_X86
+CONFIG_BATTERY_BQ20Z453
+CONFIG_BATTERY_FALCO
+CONFIG_BATTERY_LINK
+CONFIG_BATTERY_PEPPY
+CONFIG_BATTERY_SLIPPY
+CONFIG_BATTERY_SPRING
+CONFIG_BOARD_POST_GPIO_INIT
+CONFIG_BOARD_PRE_INIT
+CONFIG_BOARD_VERSION
+CONFIG_BQ24707A_R_AC
+CONFIG_BQ24707A_R_SNS
+CONFIG_BQ24725_R_AC
+CONFIG_BQ24725_R_SNS
+CONFIG_BQ24738_R_AC
+CONFIG_BQ24738_R_SNS
+CONFIG_CHARGER
+CONFIG_CHARGER_BQ24707A
+CONFIG_CHARGER_BQ24725
+CONFIG_CHARGER_BQ24738
+CONFIG_CHARGER_INPUT_CURRENT
+CONFIG_CHARGER_TPS65090
+CONFIG_CHARGING_CURRENT_LIMIT
+CONFIG_CHIPSET_GAIA
+CONFIG_CHIPSET_HASWELL
+CONFIG_CHIPSET_IVYBRIDGE
+CONFIG_CMD_PMU
+CONFIG_CONSOLE_CMDHELP
+CONFIG_CONSOLE_RESTRICTED_INPUT
+CONFIG_CONSOLE_UART
+CONFIG_CUSTOM_KEYSCAN
+CONFIG_DEBUG
+CONFIG_DEBUG_I2C
+CONFIG_EEPROM
+CONFIG_EOPTION
+CONFIG_EXTPOWER_FALCO
+CONFIG_EXTPOWER_GPIO
+CONFIG_EXTPOWER_SNOW
+CONFIG_EXTPOWER_USB
+CONFIG_FLASH
+CONFIG_FLASH_BANK_SIZE
+CONFIG_FLASH_BASE
+CONFIG_FLASH_ERASED_VALUE32
+CONFIG_FLASH_ERASE_SIZE
+CONFIG_FLASH_PHYSICAL_SIZE
+CONFIG_FLASH_PROTECT_NEXT_BOOT
+CONFIG_FLASH_SIZE
+CONFIG_FLASH_WRITE_SIZE
+CONFIG_FMAP
+CONFIG_FORCE_CONSOLE_RESUME
+CONFIG_FPU
+CONFIG_FW_IMAGE_SIZE
+CONFIG_FW_PSTATE_OFF
+CONFIG_FW_PSTATE_SIZE
+CONFIG_FW_RO_OFF
+CONFIG_FW_RO_SIZE
+CONFIG_FW_RW_OFF
+CONFIG_FW_RW_SIZE
+CONFIG_FW_WP_RO_OFF
+CONFIG_FW_WP_RO_SIZE
+CONFIG_HOSTCMD
+CONFIG_HOST_COMMAND_STATUS
+CONFIG_HOST_EMU
+CONFIG_HOST_UART
+CONFIG_HOST_UART1_GPIOS_PB0_1
+CONFIG_HOST_UART1_GPIOS_PC4_5
+CONFIG_HOST_UART2_GPIOS_PG4_5
+CONFIG_HOST_UART_IRQ
+CONFIG_I2C
+CONFIG_I2C_ARBITRATION
+CONFIG_I2C_HOST_AUTO
+CONFIG_I2C_PASSTHROUGH
+CONFIG_I2C_PASSTHRU_RESTRICTED
+CONFIG_IRQ_COUNT
+CONFIG_KEYBOARD_PROTOCOL_8042
+CONFIG_KEYBOARD_PROTOCOL_MKBP
+CONFIG_KEYBOARD_SUPPRESS_NOISE
+CONFIG_LED_DRIVER_LP5562
+CONFIG_LED_FALCO
+CONFIG_LED_PEPPY
+CONFIG_LID_SWITCH
+CONFIG_LOW_POWER_IDLE
+CONFIG_LPC
+CONFIG_ONEWIRE
+CONFIG_ONEWIRE_LED
+CONFIG_PANIC_HELP
+CONFIG_PECI
+CONFIG_PMU_BOARD_INIT
+CONFIG_PMU_FORCE_FET
+CONFIG_PMU_HARD_RESET
+CONFIG_PMU_TPS65090
+CONFIG_POWER_BUTTON
+CONFIG_PSTORE
+CONFIG_PWM_FAN
+CONFIG_PWM_KBLIGHT
+CONFIG_RAM_BASE
+CONFIG_RAM_SIZE
+CONFIG_SMART_BATTERY
+CONFIG_SPI
+CONFIG_STACK_SIZE
+CONFIG_SYSTEM_UNLOCKED
+CONFIG_TASK_LIST
+CONFIG_TASK_PROFILING
+CONFIG_TEMP_SENSOR
+CONFIG_TEMP_SENSOR_G781
+CONFIG_TEMP_SENSOR_TMP006
+CONFIG_TEST_TASK_LIST
+CONFIG_UART_BAUD_RATE
+CONFIG_UART_RX_BUF_SIZE
+CONFIG_UART_TX_BUF_SIZE
+CONFIG_USB_PORT_POWER_DUMB
+CONFIG_USB_PORT_POWER_SMART
+CONFIG_USB_SWITCH_TSU6721
+CONFIG_WATCHDOG
+CONFIG_WATCHDOG_HELP
+CONFIG_WIRELESS
+CONFIG_WP_ACTIVE_HIGH
+
+ * Also describe the HAS_TASK_* macro and how/when it should be used vs. a
+ * config define.
+ */
+
+/*
+ * Include board and core configs, since those hold the CONFIG_ constants for a
+ * given configuration. This guarantees they get included everywhere, and
+ * fixes a fairly common bug where we gate out code with #ifndef
+ * CONFIG_SOMETHING and but forget to include both of these.
+ *
+ * Board is included after chip, so that chip defaults can be overridden on a
+ * per-board basis as needed.
+ */
+#include "config_chip.h"
+#include "board.h"
+
+#endif /* __CROS_EC_CONFIG_H */