[PATCH] test/cmd/mem_copy.c: Use CONFIG_SYS_LOAD_ADDR for base

Tom Rini trini at konsulko.com
Thu Oct 31 19:11:00 CET 2024


On Thu, Oct 31, 2024 at 06:51:52PM +0100, Simon Glass wrote:
> Hi Tom,
> 
> On Wed, 30 Oct 2024 at 01:36, Tom Rini <trini at konsulko.com> wrote:
> >
> > When reading/writing to memory we cannot assume that a base address of
> > 0x0 is correct and functional. So use CONFIG_SYS_LOAD_ADDR as the base
> > from which we add a bit more padding and being our tests.
> >
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> >  test/cmd/mem_copy.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/test/cmd/mem_copy.c b/test/cmd/mem_copy.c
> > index 1ba0cebbbe04..67eca328777a 100644
> > --- a/test/cmd/mem_copy.c
> > +++ b/test/cmd/mem_copy.c
> > @@ -21,7 +21,7 @@ struct param {
> >  static int do_test(struct unit_test_state *uts,
> >                    const char *suffix, int d, int s, int count)
> >  {
> > -       const long addr = 0x1000;
> > +       const long addr = CONFIG_SYS_LOAD_ADDR + 0x1000;
> 
> CFG_SYS_SDRAM_BASE would be better here, since it is the start of
> memory (0 on sandbox and most boards).

Why do we want start of memory? CONFIG_SYS_LOAD_ADDR is the address for
where it's safe to load things to memory and fiddle with them.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20241031/e99c03d7/attachment.sig>


More information about the U-Boot mailing list