summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-02-28 14:29:52 -0800
committerRandall Spangler <rspangler@chromium.org>2012-02-28 14:29:52 -0800
commitb2b5455f327804bd1f72b3c617745fd5c5ca086b (patch)
tree700bf38ef03009ed976ed17c27024c8ac358a8d4
parent4c89ccd89eea60092118e49ca6b68a04d21d8870 (diff)
downloadchrome-ec-b2b5455f327804bd1f72b3c617745fd5c5ca086b.tar.gz
Fix version command crashing if no image B
Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8253 TEST=manual Change-Id: Ie14465283c09029c3d2fa9a32296f32ce7304760
-rw-r--r--common/host_command.c16
-rw-r--r--common/system.c18
2 files changed, 18 insertions, 16 deletions
diff --git a/common/host_command.c b/common/host_command.c
index faf29bfa63..bc09002fc4 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -158,22 +158,6 @@ static void command_process(int slot)
}
/*****************************************************************************/
-/* Console commands */
-
-/* Command handler - prints EC version. */
-static int command_version(int argc, char **argv)
-{
- uart_printf("RO version: %s\n",
- system_get_version(SYSTEM_IMAGE_RO));
- uart_printf("RW-A version: %s\n",
- system_get_version(SYSTEM_IMAGE_RW_A));
- uart_printf("RW-B version: %s\n",
- system_get_version(SYSTEM_IMAGE_RW_B));
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(version, command_version);
-
-/*****************************************************************************/
/* Initialization / task */
static int host_command_init(void)
diff --git a/common/system.c b/common/system.c
index 0bfe3aa193..ff242b9796 100644
--- a/common/system.c
+++ b/common/system.c
@@ -86,8 +86,10 @@ int system_run_image_copy(enum system_image_copy_t copy)
/* Load the appropriate reset vector */
if (copy == SYSTEM_IMAGE_RW_A)
init_addr = *(uint32_t *)(CONFIG_FW_A_OFF + 4);
+#ifndef CONFIG_NO_RW_B
else if (copy == SYSTEM_IMAGE_RW_B)
init_addr = *(uint32_t *)(CONFIG_FW_B_OFF + 4);
+#endif
else
return EC_ERROR_UNKNOWN;
@@ -128,9 +130,11 @@ const char *system_get_version(enum system_image_copy_t copy)
case SYSTEM_IMAGE_RW_A:
imoffset = CONFIG_FW_A_OFF;
break;
+#ifndef CONFIG_NO_RW_B
case SYSTEM_IMAGE_RW_B:
imoffset = CONFIG_FW_B_OFF;
break;
+#endif
default:
return "";
}
@@ -185,6 +189,7 @@ static int command_set_scratchpad(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(setscratchpad, command_set_scratchpad);
+
static int command_hibernate(int argc, char **argv)
{
int seconds;
@@ -206,3 +211,16 @@ static int command_hibernate(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(hibernate, command_hibernate);
+
+
+static int command_version(int argc, char **argv)
+{
+ uart_printf("RO version: %s\n",
+ system_get_version(SYSTEM_IMAGE_RO));
+ uart_printf("RW-A version: %s\n",
+ system_get_version(SYSTEM_IMAGE_RW_A));
+ uart_printf("RW-B version: %s\n",
+ system_get_version(SYSTEM_IMAGE_RW_B));
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(version, command_version);