From 55f990cd0f52ea1550e0ac481fe990d06a06192e Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Thu, 2 Feb 2012 19:15:06 +0000 Subject: [PATCH] Fix image copy detection When the flash base address is not zero (e.g. STM32L chip), the current image index is wrongly computed. Signed-off-by: Vincent Palatin BUG=None TEST=check it compiles for all boards, run on Discovery board and see proper value. Change-Id: I06f5508cdffce6d754bd93e870d64087d299c9c7 --- common/system.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/system.c b/common/system.c index 53254b092c..0bfe3aa193 100644 --- a/common/system.c +++ b/common/system.c @@ -51,7 +51,8 @@ const char *system_get_reset_cause_string(void) enum system_image_copy_t system_get_image_copy(void) { - int copy = (uint32_t)system_get_image_copy / CONFIG_FW_IMAGE_SIZE; + int copy = ((uint32_t)system_get_image_copy - CONFIG_FLASH_BASE) / + CONFIG_FW_IMAGE_SIZE; switch (copy) { case 0: return SYSTEM_IMAGE_RO;