From 88e65b4db6555ac44c8fd6e69459e808ed2f0aa1 Mon Sep 17 00:00:00 2001 From: internal <> Date: Sat, 22 Jul 2023 21:28:35 +0200 Subject: [PATCH] adjust image start to card type --- apps/octonet/ddupdate.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/octonet/ddupdate.c b/apps/octonet/ddupdate.c index d010eab..5c97692 100644 --- a/apps/octonet/ddupdate.c +++ b/apps/octonet/ddupdate.c @@ -36,6 +36,7 @@ static int update_flash(struct ddflash *ddf) char *fname, *default_fname; int res, stat = 0; char *name = 0, *dname; + uint32_t imgadr = 0x10000; switch (ddf->id.device) { case 0x300: @@ -108,7 +109,21 @@ static int update_flash(struct ddflash *ddf) stat |= 1; return stat; break; + case 0x21: + case 0x22: + case 0x24: + case 0x14: + imgadr = 0; default: + { + uint32_t val; + if (!readreg(ddf->fd, (ddf->link << 28) | 0x10, &val)) { + printf("reg0x10=%08x\n", val); + if ((val >> 24) == 5) + imgadr = 0; + } + printf("imgadr= %08x\n", imgadr); + } fname = ddf->fname; default_fname = devid2fname(ddf->id.device, &name); if (!fname) @@ -119,7 +134,8 @@ static int update_flash(struct ddflash *ddf) printf("Flash: %s\n", ddf->flash_name); printf("Version: %08x\n", ddf->id.hw); printf("REGMAP : %08x\n", ddf->id.regmap); - if ((res = update_image(ddf, fname, 0x10000, ddf->size / 2, 1, 0)) == 1) + printf("Address: %08x\n", imgadr); + if ((res = update_image(ddf, fname, imgadr, ddf->size / 2, 1, 0)) == 1) stat |= 1; return stat; }