diff options
-rw-r--r-- | Makefile.rules | 27 | ||||
-rw-r--r-- | board/bds/board.h | 5 | ||||
-rw-r--r-- | board/daisy/board.h | 4 | ||||
-rw-r--r-- | board/link/board.h | 4 | ||||
-rw-r--r-- | board/snow/board.h | 4 | ||||
-rw-r--r-- | chip/stm32/config-stm32f100.h | 10 | ||||
-rw-r--r-- | common/firmware_image.S | 7 | ||||
-rw-r--r-- | common/firmware_image.lds.S | 3 | ||||
-rw-r--r-- | common/fmap.c | 5 | ||||
-rw-r--r-- | common/system_common.c | 5 | ||||
-rw-r--r-- | common/vboot.c | 2 | ||||
-rw-r--r-- | common/vboot_sig.c | 8 | ||||
-rw-r--r-- | util/burn_my_ec.c | 4 |
13 files changed, 58 insertions, 30 deletions
diff --git a/Makefile.rules b/Makefile.rules index 7b3274f914..7a06001237 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -48,16 +48,21 @@ cmd_sign = vbutil_ec --sign $@ \ --signpubkey $(VBOOT_DEVKEYS)/ec_root_key.vbpubk \ $(silent) cmd_mv = mv $^ $@ -cmd_extractab = cd $(out) && \ - dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_A RW_SECTION_B $(silent) && \ - mv RW_SECTION_A $(PROJECT).A.bin && mv RW_SECTION_B $(PROJECT).B.bin -cmd_copyab = cd $(out) && cp $(PROJECT).A.flat $(PROJECT).A.bin && \ - cp $(PROJECT).B.flat $(PROJECT).B.bin +cmd_extractab-y = cd $(out) && \ + dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_A $(silent) && \ + mv RW_SECTION_A $(PROJECT).A.bin +cmd_extractab-$(CONFIG_RW_B) += && \ + dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_B $(silent) && \ + mv RW_SECTION_B $(PROJECT).B.bin +cmd_copyab-y = cd $(out) && cp $(PROJECT).A.flat $(PROJECT).A.bin +cmd_copyab-$(CONFIG_RW_B) += && cp $(PROJECT).B.flat $(PROJECT).B.bin .PHONY: all tests utils all: $(out)/$(PROJECT).bin utils -dis: $(foreach s,A B RO,$(out)/$(PROJECT).$(s).dis) +dis-y = $(out)/$(PROJECT).RO.dis $(out)/$(PROJECT).A.dis +dis-$(CONFIG_RW_B) += $(out)/$(PROJECT).B.dis +dis: $(dis-y) utils: $(build-utils) $(host-utils) @@ -88,11 +93,13 @@ $(out)/%.bin: $(out)/%.bin.tmp $(out)/%.bin.tmp: $(out)/%.obj $(call quiet,obj_to_bin,OBJCOPY) $(if $(sign-y),$(call quiet,sign,SIGN ),) - $(if $(sign-y),$(call quiet,extractab,EXTR_AB), \ - $(call quiet,copyab,COPY_AB)) + $(if $(sign-y),$(call quiet,extractab-y,EXTR_AB), \ + $(call quiet,copyab-y,COPY_AB)) -$(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds \ - $(out)/%.RO.flat $(out)/%.A.flat $(out)/%.B.flat +flat-y = $(out)/$(PROJECT).RO.flat $(out)/$(PROJECT).A.flat +flat-$(CONFIG_RW_B) += $(out)/$(PROJECT).B.flat + +$(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds $(flat-y) $(call quiet,flat_to_obj,CAT ) $(out)/%.dis: $(out)/%.elf diff --git a/board/bds/board.h b/board/bds/board.h index 7353cce42f..49a3fc94c4 100644 --- a/board/bds/board.h +++ b/board/bds/board.h @@ -10,10 +10,13 @@ /* Optional features */ #define CONFIG_CONSOLE_CMDHELP +#define CONFIG_RW_B /* RW firmware A *and* B */ #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */ #define CONFIG_VBOOT #define CONFIG_VBOOT_SIG +#ifndef __ASSEMBLER__ + enum adc_channel { ADC_CH_EC_TEMP = 0, /* EC internal die temperature in degrees K. */ @@ -44,4 +47,6 @@ enum gpio_signal { void configure_board(void); +#endif /* !__ASSEMBLER__ */ + #endif /* __BOARD_H */ diff --git a/board/daisy/board.h b/board/daisy/board.h index 3c88816f69..9a772ddc8c 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -24,6 +24,8 @@ * Once we complete the vboot and autoupdate, we should remove this. */ #define CONFIG_SYSTEM_UNLOCKED +#ifndef __ASSEMBLER__ + /* By default, enable all console messages except keyboard */ #define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN)) @@ -101,4 +103,6 @@ void board_interrupt_host(int active); /* Auto detect EC i2c host port */ int board_i2c_host_port(void); +#endif /* !__ASSEMBLER__ */ + #endif /* __BOARD_H */ diff --git a/board/link/board.h b/board/link/board.h index 8886271b61..7bcac35af5 100644 --- a/board/link/board.h +++ b/board/link/board.h @@ -31,6 +31,8 @@ /* Enable the fake developer switch. See crosbug.com/p/8884 */ #define CONFIG_FAKE_DEV_SWITCH +#ifndef __ASSEMBLER__ + /* Fan PWM channels */ #define FAN_CH_CPU 0 /* CPU fan */ #define FAN_CH_KBLIGHT 1 /* Keyboard backlight */ @@ -238,4 +240,6 @@ enum board_version { void configure_board(void); +#endif /* !__ASSEMBLER__ */ + #endif /* __BOARD_H */ diff --git a/board/snow/board.h b/board/snow/board.h index df18e1ec77..b09d0238d8 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -31,6 +31,8 @@ * Once we complete the vboot and autoupdate, we should remove this. */ #define CONFIG_SYSTEM_UNLOCKED +#ifndef __ASSEMBLER__ + /* By default, enable all console messages except keyboard */ #define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN)) @@ -105,4 +107,6 @@ void board_interrupt_host(int active); /* Auto detect EC i2c host port */ int board_i2c_host_port(void); +#endif /* !__ASSEMBLER__ */ + #endif /* __BOARD_H */ diff --git a/chip/stm32/config-stm32f100.h b/chip/stm32/config-stm32f100.h index 27327846b3..cf9c32b86b 100644 --- a/chip/stm32/config-stm32f100.h +++ b/chip/stm32/config-stm32f100.h @@ -13,8 +13,6 @@ /* Size of one firmware image in flash */ #define CONFIG_FW_IMAGE_SIZE (32 * 1024) -#define CONFIG_NO_RW_B - #define CONFIG_FW_RO_OFF 0 #define CONFIG_FW_RO_SIZE CONFIG_FW_IMAGE_SIZE #define CONFIG_FW_A_OFF CONFIG_FW_IMAGE_SIZE @@ -27,11 +25,11 @@ #define CONFIG_SECTION_A_OFF CONFIG_FW_A_OFF #define CONFIG_SECTION_A_SIZE CONFIG_FW_A_SIZE #define CONFIG_SECTION_B_OFF CONFIG_FW_B_OFF -#ifdef CONFIG_NO_RW_B -#define CONFIG_SECTION_B_SIZE 0 -#else /* CONFIG_NO_RW_B */ +#ifdef CONFIG_RW_B #define CONFIG_SECTION_B_SIZE CONFIG_FW_B_SIZE -#endif /* CONFIG_NO_RW_B */ +#else /* CONFIG_RW_B */ +#define CONFIG_SECTION_B_SIZE 0 +#endif /* CONFIG_RW_B */ /* no keys for now */ #define CONFIG_VBOOT_ROOTKEY_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE) diff --git a/common/firmware_image.S b/common/firmware_image.S index 8ffe1eb76b..0c086728aa 100644 --- a/common/firmware_image.S +++ b/common/firmware_image.S @@ -1,10 +1,11 @@ -/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2012 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. * - * Build the full image with 3 copies (Read only, A, B) of the program + * 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 @@ -20,7 +21,7 @@ .section .image.A, "ax" .incbin FW_IMAGE(A) -#ifndef CONFIG_NO_RW_B +#ifdef CONFIG_RW_B /* Read Write firmware copy B */ .section .image.B, "ax" .incbin FW_IMAGE(B) diff --git a/common/firmware_image.lds.S b/common/firmware_image.lds.S index cf1e79ff39..cd095f9634 100644 --- a/common/firmware_image.lds.S +++ b/common/firmware_image.lds.S @@ -3,6 +3,7 @@ * found in the LICENSE file. */ +#include "board.h" #include "config.h" OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") @@ -22,7 +23,7 @@ SECTIONS *(.image.A) BYTE(0xEA) /* Mark end explicitly */ } > FLASH =0xff -#ifndef CONFIG_NO_RW_B +#ifdef CONFIG_RW_B . = ALIGN(CONFIG_FLASH_BANK_SIZE); .image.B : AT(CONFIG_FLASH_BASE + CONFIG_SECTION_B_OFF) { *(.image.B) diff --git a/common/fmap.c b/common/fmap.c index da139f7cc1..a0bbf43472 100644 --- a/common/fmap.c +++ b/common/fmap.c @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include "board.h" #include "config.h" #include "version.h" @@ -150,7 +151,7 @@ const struct _ec_fmap { .area_flags = FMAP_AREA_STATIC, }, -#ifndef CONFIG_NO_RW_B +#ifdef CONFIG_RW_B /* Firmware B */ { .area_name = "RW_SECTION_B", @@ -178,6 +179,6 @@ const struct _ec_fmap { .area_size = CONFIG_VBLOCK_SIZE, .area_flags = FMAP_AREA_STATIC, }, -#endif /* CONFIG_NO_RW_B */ +#endif /* CONFIG_RW_B */ } }; diff --git a/common/system_common.c b/common/system_common.c index 4fb05422e7..353068365f 100644 --- a/common/system_common.c +++ b/common/system_common.c @@ -7,6 +7,7 @@ #include "board.h" #include "clock.h" +#include "config.h" #include "console.h" #include "ec_commands.h" #include "flash.h" @@ -294,7 +295,7 @@ static uint32_t get_base(enum system_image_copy_t copy) return CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF; case SYSTEM_IMAGE_RW_A: return CONFIG_FLASH_BASE + CONFIG_FW_A_OFF; -#ifndef CONFIG_NO_RW_B +#ifdef CONFIG_RW_B case SYSTEM_IMAGE_RW_B: return CONFIG_FLASH_BASE + CONFIG_FW_B_OFF; #endif @@ -311,7 +312,7 @@ static uint32_t get_size(enum system_image_copy_t copy) return CONFIG_FW_RO_SIZE; case SYSTEM_IMAGE_RW_A: return CONFIG_FW_A_SIZE; -#ifndef CONFIG_NO_RW_B +#ifdef CONFIG_RW_B case SYSTEM_IMAGE_RW_B: return CONFIG_FW_B_SIZE; #endif diff --git a/common/vboot.c b/common/vboot.c index 5bb13624ed..060e5bc72c 100644 --- a/common/vboot.c +++ b/common/vboot.c @@ -5,6 +5,8 @@ /* Verified boot module for Chrome EC */ +#include "board.h" +#include "config.h" #include "console.h" #include "eoption.h" #include "host_command.h" diff --git a/common/vboot_sig.c b/common/vboot_sig.c index f7eccc2593..855a3334a2 100644 --- a/common/vboot_sig.c +++ b/common/vboot_sig.c @@ -150,9 +150,7 @@ int vboot_check_signature(void) CPRINTF("[Image A is invalid]\n"); } -#ifdef CONFIG_NO_RW_B - CPRINTF("[Vboot no image B to check]\n"); -#else +#ifdef CONFIG_RW_B CPRINTF("[%T Vboot check image B...]\n"); ts1 = get_time(); @@ -177,7 +175,9 @@ int vboot_check_signature(void) default: CPRINTF("[Image B is invalid]\n"); } -#endif +#else /* CONFIG_RW_B */ + CPRINTF("[Vboot no image B to check]\n"); +#endif /* CONFIG_RW_B */ bad: CPRINTF("[Staying in RO mode]\n"); diff --git a/util/burn_my_ec.c b/util/burn_my_ec.c index 522f461e62..56c15af1b9 100644 --- a/util/burn_my_ec.c +++ b/util/burn_my_ec.c @@ -135,10 +135,10 @@ int main(int argc, char *argv[]) if (comm_init() < 0) return -3; -#ifndef CONFIG_NO_RW_B +#ifdef CONFIG_RW_B flash_partition(EC_IMAGE_RW_B, data + CONFIG_FW_B_OFF, CONFIG_FW_B_OFF, CONFIG_FW_B_SIZE); -#endif /* !CONFIG_NO_RW_B */ +#endif /* CONFIG_RW_B */ flash_partition(EC_IMAGE_RW_A, data + CONFIG_FW_A_OFF, CONFIG_FW_A_OFF, CONFIG_FW_A_SIZE); flash_partition(EC_IMAGE_RO, data + CONFIG_FW_RO_OFF, |