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 <vpalatin@chromium.org>

BUG=None
TEST=check it compiles for all boards, run on Discovery board and see
proper value.

Change-Id: I06f5508cdffce6d754bd93e870d64087d299c9c7
This commit is contained in:
Vincent Palatin
2012-02-02 19:15:06 +00:00
parent 77b154dd71
commit 55f990cd0f

View File

@@ -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;