diff options
-rw-r--r-- | common/main.c | 15 | ||||
-rw-r--r-- | common/system.c | 18 | ||||
-rw-r--r-- | include/system.h | 5 | ||||
-rw-r--r-- | zephyr/CMakeLists.txt | 3 | ||||
-rw-r--r-- | zephyr/app/ec/ec_app_main.c | 6 | ||||
-rw-r--r-- | zephyr/shim/src/ztest_system.c | 6 |
6 files changed, 34 insertions, 19 deletions
diff --git a/common/main.c b/common/main.c index c1626e41fc..75df57066c 100644 --- a/common/main.c +++ b/common/main.c @@ -143,20 +143,7 @@ test_mockable __keep int main(void) if (mpu_pre_init_rv != EC_SUCCESS) panic("MPU init failed"); - /* be less verbose if we boot for USB resume to meet spec timings */ - if (!(system_get_reset_flags() & EC_RESET_FLAG_USB_RESUME)) { - CPUTS("\n"); - if (system_jumped_to_this_image()) - CPRINTS("UART initialized after sysjump"); - else - CPUTS("\n--- UART initialized after reboot ---\n"); - CPRINTF("[Image: %s, %s]\n", - system_get_image_copy_string(), - system_get_build_info()); - CPUTS("[Reset cause: "); - system_print_reset_flags(); - CPUTS("]\n"); - } + system_print_banner(); #ifdef CONFIG_BRINGUP ccprintf("\n\nWARNING: BRINGUP BUILD\n\n\n"); diff --git a/common/system.c b/common/system.c index 6b473a33b8..0e4f9848d9 100644 --- a/common/system.c +++ b/common/system.c @@ -287,6 +287,24 @@ void system_print_reset_flags(void) print_reset_flags(reset_flags); } +void system_print_banner(void) +{ + /* be less verbose if we boot for USB resume to meet spec timings */ + if (!(system_get_reset_flags() & EC_RESET_FLAG_USB_RESUME)) { + CPUTS("\n"); + if (system_jumped_to_this_image()) + CPRINTS("UART initialized after sysjump"); + else + CPUTS("\n--- UART initialized after reboot ---\n"); + CPRINTF("[Image: %s, %s]\n", + system_get_image_copy_string(), + system_get_build_info()); + CPUTS("[Reset cause: "); + system_print_reset_flags(); + CPUTS("]\n"); + } +} + int system_jumped_to_this_image(void) { return jumped_to_image; diff --git a/include/system.h b/include/system.h index d6427cb676..03ab3f9a05 100644 --- a/include/system.h +++ b/include/system.h @@ -121,6 +121,11 @@ void system_clear_reset_flags(uint32_t flags); void system_print_reset_flags(void); /** + * Print a banner at boot, including image type, version, and reset type + */ +void system_print_banner(void); + +/** * Check if system is locked down for normal consumer use. * * @return non-zero if the system is locked down for normal consumer use. diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 95bf2046ea..f16ce4dd1a 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -31,7 +31,8 @@ if(DEFINED CONFIG_PLATFORM_EC) # Create the command used to generate the ec_version.h file. add_custom_command( OUTPUT ${ec_version_file} - COMMAND ${PLATFORM_EC}/util/getversion.sh BOARD=${BOARD} > ${ec_version_file} + # TODO(b/185249526): zephyr: add project name to the version output + COMMAND BOARD=${BOARD}_zephyr ${PLATFORM_EC}/util/getversion.sh > ${ec_version_file} WORKING_DIRECTORY ${PLATFORM_EC} ) # Create a custom target that will depend on the file. diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c index ad8498efc6..3853dc58fc 100644 --- a/zephyr/app/ec/ec_app_main.c +++ b/zephyr/app/ec/ec_app_main.c @@ -23,10 +23,6 @@ */ void ec_app_main(void) { - printk("Hello from a Chrome EC!\n"); - printk(" BOARD=%s\n", CONFIG_BOARD); - printk(" ACTIVE_COPY=%s\n", CONFIG_CROS_EC_ACTIVE_COPY); - system_common_pre_init(); /* @@ -38,6 +34,8 @@ void ec_app_main(void) init_reset_log(); } + system_print_banner(); + /* * Keyboard scan init/Button init can set recovery events to * indicate to host entry into recovery mode. Before this is diff --git a/zephyr/shim/src/ztest_system.c b/zephyr/shim/src/ztest_system.c index 625502ed82..5fbc3dc50d 100644 --- a/zephyr/shim/src/ztest_system.c +++ b/zephyr/shim/src/ztest_system.c @@ -4,6 +4,7 @@ */ #include "system.h" +#include "cros_version.h" /* Ongoing actions preventing going into deep-sleep mode. */ uint32_t sleep_mask; @@ -46,3 +47,8 @@ uint32_t system_get_reset_flags(void) { return 0; } + +void system_print_banner(void) +{ + printk("Image: %s\n", build_info); +} |