From 9f7fa4e800ffb7cffc4d40d170785caf7e6a38e9 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 2 May 2012 15:53:35 +0000 Subject: [PATCH] make verified boot feature optional this fixes the build breakage on stm32-based platforms. In the linker script, remove the ASSERT since this macro is not designed to work in that context and this size condition is already verified by the linker by setting the "length" of the "FLASH" memory region. Signed-off-by: Vincent Palatin BUG=None TEST=make BOARD=link && make BOARD=daisy boot on Link and Daisy Change-Id: I08964749d44f47caa0a359bc93c303a9611e5d73 --- chip/lm4/config.h | 1 + common/build.mk | 5 +++-- common/main.c | 4 ++++ core/cortex-m/ec.lds.S | 5 +---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/chip/lm4/config.h b/chip/lm4/config.h index bb82dd7b31..88354a2ea2 100644 --- a/chip/lm4/config.h +++ b/chip/lm4/config.h @@ -50,6 +50,7 @@ #define CONFIG_ADC #define CONFIG_EEPROM #define CONFIG_FLASH +#define CONFIG_VBOOT #define CONFIG_FPU #define CONFIG_I2C #define CONFIG_LPC diff --git a/common/build.mk b/common/build.mk index 2c32fc292e..8c81d9866b 100644 --- a/common/build.mk +++ b/common/build.mk @@ -5,9 +5,9 @@ # Common files build # -common-y=main.o message.o util.o console.o vboot.o uart_buffering.o +common-y=main.o message.o util.o console.o uart_buffering.o common-y+=memory_commands.o shared_mem.o system_common.o hooks.o -common-y+=gpio_commands.o version.o fmap.o +common-y+=gpio_commands.o version.o common-$(CONFIG_BATTERY_ATL706486)+=battery_atl706486.o common-$(CONFIG_CHARGER_BQ24725)+=charger_bq24725.o common-$(CONFIG_EOPTION)+=eoption.o @@ -27,3 +27,4 @@ common-$(CONFIG_TASK_THERMAL)+=thermal.o thermal_commands.o common-$(CONFIG_TASK_X86POWER)+=x86_power.o common-$(CONFIG_TMP006)+=tmp006.o common-$(CONFIG_USB_CHARGE)+=usb_charge.o usb_charge_commands.o +common-$(CONFIG_VBOOT)+=vboot.o fmap.o diff --git a/common/main.c b/common/main.c index 044ae45027..9a37179cc1 100644 --- a/common/main.c +++ b/common/main.c @@ -43,9 +43,11 @@ int main(void) flash_pre_init(); #endif +#ifdef CONFIG_VBOOT /* Verified boot pre-init. This write-protects flash if necessary. * Flash and GPIOs must be initialized first. */ vboot_pre_init(); +#endif /* Initialize the system module. This enables the hibernate clock * source we need to calibrate the internal oscillator. */ @@ -87,6 +89,7 @@ int main(void) keyboard_scan_init(); #endif +#ifdef CONFIG_VBOOT /* Verified boot initialization. This may jump to another image, which * will need to reconfigure / reinitialize the system, so as little as * possible should be done above this step. @@ -94,6 +97,7 @@ int main(void) * Note that steps above here may be done TWICE per boot, once in the * RO image and once in the RW image. */ vboot_init(); +#endif /* Initialize other driver modules. These can occur in any order. * Non-driver modules with tasks do their inits from their task diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index 00e7cf9e68..eb72c4fc19 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -78,13 +78,10 @@ SECTIONS . = ALIGN(4); __data_end = .; } > IRAM -#ifdef SECTION_IS_RO +#if defined(SECTION_IS_RO) && defined(CONFIG_VBOOT) .google CONFIG_FW_RO_GBB_OFF : AT(CONFIG_FW_RO_GBB_OFF) { *(.google) - . += 16; } > FLASH - ASSERT(SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.data) + SIZEOF(.google) - <= CONFIG_FW_IMAGE_SIZE, "Too much stuff to fit in the image") #else /DISCARD/ : { *(.google)