Skip to content

Commit b279f51

Browse files
sjg20lbmeng
authored andcommitted
bdinfo: Show the RAM top and approximate stack pointer
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 <[email protected]> Reviewed-by: Nikhil M Jain <[email protected]> Reviewed-by: Bin Meng <[email protected]> Tested-by: Nikhil M Jain <[email protected]>
1 parent 2971841 commit b279f51

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

cmd/Kconfig

+8
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ config CMD_BDI
135135
help
136136
Print board info
137137

138+
config CMD_BDINFO_EXTRA
139+
bool "bdinfo extra features"
140+
default y if SANDBOX || X86
141+
help
142+
Show additional information about the board. This uses a little more
143+
code space but provides more options, particularly those useful for
144+
bringup, development and debugging.
145+
138146
config CMD_CONFIG
139147
bool "config"
140148
default SANDBOX

cmd/bdinfo.c

+5
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
173173
}
174174
print_serial(gd->cur_serial_dev);
175175

176+
if (IS_ENABLED(CONFIG_CMD_BDINFO_EXTRA)) {
177+
bdinfo_print_num_ll("stack ptr", (ulong)&bd);
178+
bdinfo_print_num_ll("ram_top ptr", (ulong)gd->ram_top);
179+
}
180+
176181
arch_print_bdinfo();
177182

178183
return 0;

test/cmd/bdinfo.c

+7
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@ static int bdinfo_test_move(struct unit_test_state *uts)
205205
ut_assertok(test_num_l(uts, " clock", info.clock));
206206
}
207207

208+
if (IS_ENABLED(CONFIG_CMD_BDINFO_EXTRA)) {
209+
ut_assert_nextlinen("stack ptr");
210+
ut_assertok(test_num_ll(uts, "ram_top ptr",
211+
(unsigned long long)gd->ram_top));
212+
ut_assertok(test_num_l(uts, "malloc base", gd_malloc_start()));
213+
}
214+
208215
ut_assertok(ut_check_console_end(uts));
209216

210217
return 0;

0 commit comments

Comments
 (0)