diff options
author | Wealian Liao <whliao@nuvoton.corp-partner.google.com> | 2021-02-23 15:20:38 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-25 17:15:24 +0000 |
commit | cad54c16176dbc5d94be576c9d9addd9ada695fb (patch) | |
tree | 4a13105229ee874b2852d6118f3fc6c253ddd36f | |
parent | 2b470623642407eae6a35a89dad145adb004b3ef (diff) | |
download | chrome-ec-cad54c16176dbc5d94be576c9d9addd9ada695fb.tar.gz |
zephyr: enable md & rw console command
This enables the memory accessing console command (e.g., md, rw) in
Zephyr. The commands are used to access the ec memory space for driver
developing & bug investigating.
BUG=b:177604307
BRANCH=None.
TEST=read the npcx firmware header by 'rw 0x64000000' & get the
following 'read 0x64000000 = 0x2a3b4d5e'
Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com>
Change-Id: I560be52fb1e09a3e72c8619ee9cdf0c1b9dcbcf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2714723
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/Kconfig | 39 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 15 |
3 files changed, 56 insertions, 0 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 855bd1d753..f250710c74 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -192,6 +192,8 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CHARGE_RAMP_SW "${PLATFORM_EC}/common/charge_ramp_sw.c") zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CBI "${PLATFORM_EC}/common/cbi.c") +zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CONSOLE_CMD_MEM + "${PLATFORM_EC}/common/memory_commands.c") zephyr_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ "${PLATFORM_EC}/common/chipset.c") zephyr_sources_ifdef(CONFIG_PLATFORM_EC_ESPI "${PLATFORM_EC}/common/espi.c") diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 3b46a307e9..2393b228d4 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -201,6 +201,45 @@ config PLATFORM_EC_CHIPSET_RESET_HOOK Then do_something() will be called just before the reset happens. +config PLATFORM_EC_CONSOLE_CMD_MEM + bool "Console command: md, rw" + default y + help + Enable memory related console commands. + + md - dump memory values + rw - read or write in memory + +if PLATFORM_EC_CONSOLE_CMD_MEM + +config PLATFORM_EC_CONSOLE_CMD_MD + bool "Console command: md" + default y + help + Enable the "md" command. This dumps memory value from a specified + address, optionally specifying the format. + + Example: + md 0x64000000 10 + + 64000000: 2a3b4d5e 030054e1 07000000 09297110 + 64000010: 00000010 03db4f00 03db5000 00000100 + 64000020: 00000000 00000000 + +config PLATFORM_EC_CONSOLE_CMD_RW + bool "Console command: rw" + default y + help + Enable the "rw" command. This Read or write in memory optionally + specifying the size. + + Example: + rw 0x64000000 + + read 0x64000000 = 0x2a3b4d5e + +endif # PLATFORM_EC_CONSOLE_CMD_MEM + config PLATFORM_EC_DEBUG_ASSERT bool "Enable assertion failures" default y diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 56e0ac7ae0..c0e01b6ea6 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -1055,6 +1055,21 @@ enum battery_type { #define CONFIG_CMD_STACKOVERFLOW #endif +#undef CONFIG_CMD_MEM +#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_MEM +#define CONFIG_CMD_MEM +#endif + +#undef CONFIG_CMD_MD +#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_MD +#define CONFIG_CMD_MD +#endif + +#undef CONFIG_CMD_RW +#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_RW +#define CONFIG_CMD_RW +#endif + #undef CONFIG_RTC #ifdef CONFIG_PLATFORM_EC_RTC #define CONFIG_RTC |