summaryrefslogtreecommitdiff
path: root/test/cmd
diff options
context:
space:
mode:
authorHeinrich Schuchardt <[email protected]>2025-11-09 11:10:07 +0100
committerHeinrich Schuchardt <[email protected]>2025-11-21 19:18:22 +0100
commit1a498e5fb8a70ba9be7bb8e7c88227e9229d1d99 (patch)
tree7ee6e41b0bbadef43fabf682995b868a4a4e1b25 /test/cmd
parent394c39960e2791a90d1294d3e5a84731883c1e8f (diff)
test: cmd/fdt: do not use fixed buffer addresses
The location of memory depends on the board. Do not assume memory at fixed memory locations. Use memalign() instead to allocate a buffer. Acked-by: Ilias Apalodimas <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'test/cmd')
-rw-r--r--test/cmd/fdt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index b950123b6da..4c3c6308ab4 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -265,7 +265,7 @@ FDT_TEST(fdt_test_addr_resize, UTF_CONSOLE);
static int fdt_test_move(struct unit_test_state *uts)
{
char fdt[256];
- ulong addr, newaddr = 0x10000;
+ ulong addr, newaddr;
const int size = sizeof(fdt);
uint32_t ts;
void *buf;
@@ -275,8 +275,10 @@ static int fdt_test_move(struct unit_test_state *uts)
ts = fdt_totalsize(fdt);
/* Moved target DT location */
- buf = map_sysmem(newaddr, size);
+ buf = memalign(8, size);
+ ut_assertnonnull(buf);
memset(buf, 0, size);
+ newaddr = map_to_sysmem(buf);
/* Test moving the working FDT to a new location */
ut_assertok(run_commandf("fdt move %08lx %08lx %x", addr, newaddr, ts));
@@ -288,6 +290,8 @@ static int fdt_test_move(struct unit_test_state *uts)
ut_assert_nextline("Total of %d byte(s) were the same", ts);
ut_assert_console_end();
+ free(buf);
+
return 0;
}
FDT_TEST(fdt_test_move, UTF_CONSOLE);