summaryrefslogtreecommitdiff
path: root/common/flash_common.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-05-18 18:55:52 -0700
committerBill Richardson <wfrichar@chromium.org>2012-05-21 14:20:02 -0700
commitadd419009fe4f9f6a9f11780a582657c7805d6f0 (patch)
treee0d22b86c569cad9d42a39e981a440b72f7c712d /common/flash_common.c
parent1ac197d566d74b5dfd2abbd57c191e464aa46d8b (diff)
downloadchrome-ec-add419009fe4f9f6a9f11780a582657c7805d6f0.tar.gz
Clean up linker scripts; detect out-of-flash problem.
The VMA of the .data segment is in RAM, but we actually put it into FLASH. The linker doesn't notice if it runs out of flash, so it creates an invalid image. This adds an explicit check to be sure it all fits. It also refactors the region declarations to be more explicit. For vboot-enabled configurations, CONFIG_SECTION_* - describes the extent of flash for one entire image CONFIG_FW_* - the region within the SECTION for the firmware only CONFIG_VBLOCK_* - the region within the RW SECTIONs for the vblocks CONFIG_VBOOT_ROOTKEY - the region within the RO SECTION for the root key Look at chip/lm4/config.h for the best example. BUG=chrome-os-partner:9839 TEST=manual Build it, run it. Change-Id: I3c652e82d58a5328115cc750c80ecba6a3fd99a3 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/flash_common.c')
-rw-r--r--common/flash_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/flash_common.c b/common/flash_common.c
index 466742a66f..2582a32621 100644
--- a/common/flash_common.c
+++ b/common/flash_common.c
@@ -14,7 +14,7 @@
#define PERSIST_STATE_VERSION 1
#define MAX_BANKS (CONFIG_FLASH_SIZE / CONFIG_FLASH_BANK_SIZE)
-/* Persistent protection state */
+/* Persistent protection state - emulates a SPI status register for flashrom */
struct persist_state {
uint8_t version; /* Version of this struct */
uint8_t lock; /* Lock flags */
@@ -337,7 +337,7 @@ int flash_get_protect_lock(void)
int flash_pre_init(void)
{
/* Calculate usable flash size. Reserve one protection block
- * at the top to hold the write protect data. */
+ * at the top to hold the "pretend SPI" write protect data. */
usable_flash_size = flash_physical_size() -
flash_get_protect_block_size();