[PATCH v2 11/42] bdinfo: Show the RAM top and approximate stack pointer

Simon Glass sjg at chromium.org
Wed Apr 19 06:02:43 CEST 2023


These are useful pieces of information when debugging. The RAM top shows
where U-Boot started allocating memory from, before it relocated. The
stack pointer can be checked to ensure it is in the correct region.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 cmd/Kconfig  | 8 ++++++++
 cmd/bdinfo.c | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 56f5ab02239b..26ad696c6a6e 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -135,6 +135,14 @@ config CMD_BDI
 	help
 	  Print board info
 
+config CMD_BDINFO_EXTRA
+	bool "bdinfo extra features"
+	default y if SANDBOX || X86
+	help
+	  Show additional information about the board. This uses a little more
+	  code space but provides more options, particularly those useful for
+	  bringup, development and debugging.
+
 config CMD_CONFIG
 	bool "config"
 	default SANDBOX
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f709904c5167..4e0c763a7096 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -145,6 +145,11 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 			printf("devicetree  = %s\n", fdtdec_get_srcname());
 	}
 
+	if (IS_ENABLED(CONFIG_CMD_BDINFO_EXTRA)) {
+		bdinfo_print_num_ll("stack ptr", (ulong)&bd);
+		bdinfo_print_num_ll("ram_top ptr", (ulong)gd->ram_top);
+	}
+
 	arch_print_bdinfo();
 
 	return 0;
-- 
2.40.0.634.g4ca3ef3211-goog



More information about the U-Boot mailing list