diff --git a/src/gdb_main.c b/src/gdb_main.c index 33a37eef027..62fb78784c3 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -744,7 +744,7 @@ static void handle_v_packet(char *packet, const size_t plen) /* Write Flash Memory */ const uint32_t count = plen - bin; DEBUG_GDB("Flash Write %08" PRIX32 " %08" PRIX32 "\n", addr, count); - if (cur_target && target_flash_write(cur_target, addr, (void *)packet + bin, count)) + if (cur_target && target_flash_write(cur_target, addr, (uint8_t *)packet + bin, count)) gdb_putpacketz("OK"); else { target_flash_complete(cur_target); diff --git a/src/rtt.c b/src/rtt.c index e3e35086c2d..df5f0ef504d 100644 --- a/src/rtt.c +++ b/src/rtt.c @@ -275,7 +275,7 @@ uint32_t rtt_aligned_mem_read(target_s *t, void *dest, target_addr_t src, size_t return target_mem_read(t, dest, src, len); const uint32_t retval = target_mem_read(t, dest, src0, len0); - memmove(dest, dest + offset, len); + memmove(dest, (uint8_t *)dest + offset, len); return retval; } diff --git a/src/target/ch32f1.c b/src/target/ch32f1.c index 98398d1bbd5..79f331f73ed 100644 --- a/src/target/ch32f1.c +++ b/src/target/ch32f1.c @@ -279,7 +279,7 @@ static bool ch32f1_wait_flash_ready(target_s *t, uint32_t addr) } /* Fast flash for ch32. Load 128 bytes chunk and then write them */ -static int ch32f1_upload(target_s *t, uint32_t dest, const void *src, uint32_t offset) +static int ch32f1_upload(target_s *t, uint32_t dest, const uint8_t *src, uint32_t offset) { volatile uint32_t sr, magic; const uint32_t *ss = (const uint32_t *)(src + offset); @@ -319,7 +319,7 @@ static bool ch32f1_flash_write(target_flash_s *f, target_addr_t dest, const void size_t length = len; #ifdef CH32_VERIFY target_addr_t org_dest = dest; - const void *org_src = src; + const uint8_t *org_src = (const uint8_t *)src; #endif DEBUG_INFO("CH32: flash write 0x%" PRIx32 " ,size=%" PRIu32 "\n", dest, (uint32_t)len); @@ -337,7 +337,7 @@ static bool ch32f1_flash_write(target_flash_s *f, target_addr_t dest, const void return false; for (size_t i = 0; i < 8U; i++) { - if (ch32f1_upload(t, dest, src, i * 16U)) { + if (ch32f1_upload(t, dest, (const uint8_t *)src, i * 16U)) { DEBUG_ERROR("Cannot upload to buffer\n"); return false; } @@ -359,7 +359,7 @@ static bool ch32f1_flash_write(target_flash_s *f, target_addr_t dest, const void else length = 0; dest += 128U; - src += 128U; + src = (const uint8_t *)src + 128U; sr = target_mem_read32(t, FLASH_SR); // 13 ch32f1_flash_lock(t); diff --git a/src/target/kinetis.c b/src/target/kinetis.c index 1e5c5853772..f737c4ab94d 100644 --- a/src/target/kinetis.c +++ b/src/target/kinetis.c @@ -473,7 +473,7 @@ static bool kinetis_flash_cmd_write(target_flash_s *f, target_addr_t dest, const else len = 0; dest += kf->write_len; - src += kf->write_len; + src = (const uint8_t *)src + kf->write_len; } return true; diff --git a/src/target/renesas.c b/src/target/renesas.c index e83e3fd02e4..116978b103f 100644 --- a/src/target/renesas.c +++ b/src/target/renesas.c @@ -596,7 +596,7 @@ static bool renesas_rv40_flash_write(target_flash_s *const f, target_addr_t dest target_mem_write16(t, RV40_CMD, *(uint16_t *)src); /* 2 bytes of data */ - src += 2U; + src = (const uint8_t *)src + 2U; } /* Issue write end command */ diff --git a/src/target/target.c b/src/target/target.c index 8a162e6d66d..e90a9cd9262 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -313,7 +313,7 @@ void target_regs_read(target_s *t, void *data) t->regs_read(t, data); else { for (size_t x = 0, i = 0; x < t->regs_size;) - x += target_reg_read(t, i++, data + x, t->regs_size - x); + x += target_reg_read(t, i++, (uint8_t *)data + x, t->regs_size - x); } } @@ -323,7 +323,7 @@ void target_regs_write(target_s *t, const void *data) t->regs_write(t, data); else { for (size_t x = 0, i = 0; x < t->regs_size;) - x += target_reg_write(t, i++, data + x, t->regs_size - x); + x += target_reg_write(t, i++, (const uint8_t *)data + x, t->regs_size - x); } } diff --git a/src/target/target_flash.c b/src/target/target_flash.c index bacd19a1c51..f20b7042d1b 100644 --- a/src/target/target_flash.c +++ b/src/target/target_flash.c @@ -213,7 +213,7 @@ static bool flash_buffered_flush(target_flash_s *flash) return result; } -static bool flash_buffered_write(target_flash_s *flash, target_addr_t dest, const void *src, size_t len) +static bool flash_buffered_write(target_flash_s *flash, target_addr_t dest, const uint8_t *src, size_t len) { bool result = true; /* Catch false returns with &= */ while (len) { @@ -292,7 +292,7 @@ bool target_flash_write(target_s *target, target_addr_t dest, const void *src, s } dest = local_end_addr; - src += local_length; + src = (const uint8_t *)src + local_length; len -= local_length; } return result; diff --git a/src/target/target_internal.h b/src/target/target_internal.h index b108d964b1a..ff932b954ea 100644 --- a/src/target/target_internal.h +++ b/src/target/target_internal.h @@ -65,7 +65,7 @@ struct target_flash { flash_erase_func erase; /* Erase a range of flash */ flash_write_func write; /* Write to flash */ flash_done_func done; /* Finish flash operations */ - void *buf; /* Buffer for flash operations */ + uint8_t *buf; /* Buffer for flash operations */ target_addr_t buf_addr_base; /* Address of block this buffer is for */ target_addr_t buf_addr_low; /* Address of lowest byte written */ target_addr_t buf_addr_high; /* Address of highest byte written */