diff mbox series

[v3,11/43] bdinfo: Show the RAM top and approximate stack pointer

Message ID 20230504165823.v3.11.Ib35b8f5950b2eceb28aaf39b527c3463cc5c394f@changeid
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Use qemu-x86_64 to boot EFI installers | expand

Commit Message

Simon Glass May 4, 2023, 10:57 p.m. UTC
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@chromium.org>
---

(no changes since v1)

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

Comments

Nikhil Jain May 5, 2023, 7:49 a.m. UTC | #1
On 05/05/23 04:27, Simon Glass wrote:
> 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@chromium.org>
> ---
> 
> (no changes since v1)
> 
>   cmd/Kconfig  | 8 ++++++++
>   cmd/bdinfo.c | 5 +++++
>   2 files changed, 13 insertions(+)

Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Tested-by: Nikhil M Jain <n-jain1@ti.com>
diff mbox series

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 56f5ab02239..26ad696c6a6 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 f709904c516..4e0c763a709 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;