Fix zu missing on Windows toolchains. Use unsigned int casts instead.

pull/440/head
texane 2016-06-20 20:36:51 +02:00
rodzic 3f7d0f9df3
commit 72fbf6a2c8
6 zmienionych plików z 18 dodań i 15 usunięć

Wyświetl plik

@ -611,9 +611,9 @@ int stlink_load_device_params(stlink_t *sl) {
ILOG("Device connected is: %s, id %#x\n", params->description, chip_id);
// TODO make note of variable page size here.....
ILOG("SRAM size: %#x bytes (%d KiB), Flash: %#x bytes (%d KiB) in pages of %zd bytes\n",
ILOG("SRAM size: %#x bytes (%d KiB), Flash: %#x bytes (%d KiB) in pages of %u bytes\n",
sl->sram_size, sl->sram_size / 1024, sl->flash_size, sl->flash_size / 1024,
sl->flash_pgsz);
(unsigned int)sl->flash_pgsz);
return 0;
}
@ -1445,7 +1445,7 @@ int stlink_verify_write_flash(stlink_t *sl, stm32_addr_t address, uint8_t *data,
stlink_read_mem32(sl, address + (uint32_t) off, aligned_size);
if (memcmp(sl->q_buf, data + off, cmp_size)) {
ELOG("Verification of flash failed at offset: %zd\n", off);
ELOG("Verification of flash failed at offset: %u\n", (unsigned int)off);
return -1;
}
}
@ -1608,7 +1608,7 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
for(off = 0; off < len;) {
size_t size = len - off > 0x8000 ? 0x8000 : len - off;
printf("size: %zu\n", size);
printf("size: %u\n", (unsigned int)size);
if (stlink_flash_loader_run(sl, &fl, addr + (uint32_t) off, base + off, size) == -1) {
ELOG("stlink_flash_loader_run(%#zx) failed! == -1\n", addr + off);
@ -1677,8 +1677,9 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
fprintf(stdout, "\r");
if ((off % sl->flash_pgsz) > (sl->flash_pgsz -5)) {
fprintf(stdout, "\r%3zd/%3zd pages written",
off/sl->flash_pgsz, len/sl->flash_pgsz);
fprintf(stdout, "\r%3u/%3u pages written",
(unsigned int)(off/sl->flash_pgsz),
(unsigned int)(len/sl->flash_pgsz));
fflush(stdout);
}

Wyświetl plik

@ -263,7 +263,7 @@ int stlink_flash_loader_run(stlink_t *sl, flash_loader_t* fl, stm32_addr_t targe
int i = 0;
size_t count = 0;
DLOG("Running flash loader, write address:%#x, size: %zd\n", target, size);
DLOG("Running flash loader, write address:%#x, size: %u\n", target, (unsigned int)size);
// FIXME This can never return -1
if (write_buffer_to_sram(sl, fl, buf, size) == -1) {
// IMPOSSIBLE!

Wyświetl plik

@ -460,7 +460,7 @@ dev_format_chip_id (guint32 chip_id)
static gchar *
dev_format_mem_size (gsize flash_size)
{
return g_strdup_printf ("%zu kB", flash_size / 1024);
return g_strdup_printf ("%u kB", (unsigned int)(flash_size / 1024));
}

Wyświetl plik

@ -49,8 +49,10 @@ static void stlink_print_info(stlink_t *sl)
printf("openocd: ");
stlink_print_serial(sl, true);
printf(" flash: %zu (pagesize: %zu)\n", sl->flash_size, sl->flash_pgsz);
printf(" sram: %zu\n", sl->sram_size);
printf(" flash: %u (pagesize: %u)\n",
(unsigned int)sl->flash_size, (unsigned int)sl->flash_pgsz);
printf(" sram: %u\n", (unsigned int)sl->sram_size);
printf(" chipid: 0x%.4x\n", sl->chip_id);
params = stlink_chipid_get_params(sl->chip_id);
@ -65,7 +67,7 @@ static void stlink_probe(void)
size = stlink_probe_usb(&stdevs);
printf("Found %zu stlink programmers\n", size);
printf("Found %u stlink programmers\n", (unsigned int)size);
for (size_t n = 0; n < size; n++)
stlink_print_info(stdevs[n]);

Wyświetl plik

@ -103,7 +103,7 @@ struct stlinky* stlinky_detect(stlink_t* sl)
st->off = sram_base + off;
stlink_read_mem32(sl, st->off + 4, 4);
st->bufsize = READ_UINT32_LE(sl->q_buf);
printf("stlinky buffer size 0x%zu \n", st->bufsize);
printf("stlinky buffer size 0x%u \n", (unsigned int)st->bufsize);
multiple++;
}
}
@ -283,7 +283,7 @@ int main(int ac, char** av) {
printf("using stlinky at 0x%x\n", st->off);
stlink_read_mem32(gsl, st->off + 4, 4);
st->bufsize = READ_UINT32_LE(gsl->q_buf);
printf("stlinky buffer size 0x%zu \n", st->bufsize);
printf("stlinky buffer size 0x%u \n", (unsigned int)st->bufsize);
}else{
cleanup(0);
}

Wyświetl plik

@ -44,8 +44,8 @@ ssize_t send_recv(struct stlink_libusb* handle, int terminate,
printf("[!] send_recv send request failed: %s\n", libusb_error_name(t));
return -1;
} else if ((size_t)res != txsize) {
printf("[!] send_recv send request wrote %d bytes (instead of %d).\n",
res, txsize);
printf("[!] send_recv send request wrote %u bytes (instead of %u).\n",
(unsigned int)res, (unsigned int)txsize);
}
if (rxsize != 0) {