diff options
author | Heinrich Schuchardt | 2020-07-22 17:46:02 +0200 |
---|---|---|
committer | Marek Vasut | 2020-09-01 14:47:43 +0200 |
commit | 73f4ebb659df4996e154b17f14866fb166447be0 (patch) | |
tree | 840d05be38ffc1690c7e9aedc291c067c0731189 /drivers/dfu/dfu_ram.c | |
parent | 9337037518e7a1fb8d2e16e1eaacfea8b1fb5b01 (diff) |
dfu: fix dfu tftp on sandbox
The environment variable loadaddr is in the virtual address space of the
sandbox. To get the actual memory address where the FIT image has been
loaded we have to convert this address according to the memory mapping of
the sandbox.
Equally the addresses in the *.its file have to be converted when used in
the dfu_ram driver.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'drivers/dfu/dfu_ram.c')
-rw-r--r-- | drivers/dfu/dfu_ram.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/dfu/dfu_ram.c b/drivers/dfu/dfu_ram.c index cc98668e7a4..ab0ce9e6fa9 100644 --- a/drivers/dfu/dfu_ram.c +++ b/drivers/dfu/dfu_ram.c @@ -10,6 +10,7 @@ #include <common.h> #include <malloc.h> +#include <mapmem.h> #include <errno.h> #include <dfu.h> @@ -27,9 +28,9 @@ static int dfu_transfer_medium_ram(enum dfu_op op, struct dfu_entity *dfu, } if (op == DFU_OP_WRITE) - memcpy(dfu->data.ram.start + offset, buf, *len); + memcpy(map_sysmem(dfu->data.ram.start + offset, 0), buf, *len); else - memcpy(buf, dfu->data.ram.start + offset, *len); + memcpy(buf, map_sysmem(dfu->data.ram.start + offset, 0), *len); return 0; } @@ -73,7 +74,7 @@ int dfu_fill_entity_ram(struct dfu_entity *dfu, char *devstr, char *s) } dfu->layout = DFU_RAM_ADDR; - dfu->data.ram.start = (void *)simple_strtoul(argv[1], NULL, 16); + dfu->data.ram.start = simple_strtoul(argv[1], NULL, 16); dfu->data.ram.size = simple_strtoul(argv[2], NULL, 16); dfu->write_medium = dfu_write_medium_ram; |