Allow %z specifier in windows builds. Supercedes #562.

This commit is contained in:
Uwe Bonnes 2019-12-08 15:32:28 +01:00
parent 1bef51e145
commit ab396f9745
3 changed files with 7 additions and 16 deletions

View File

@ -22,6 +22,7 @@
#define __GENERAL_H
#define _GNU_SOURCE
#define __USE_MINGW_ANSI_STDIO 1
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
@ -44,15 +45,5 @@
#undef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#ifdef _WIN32
# ifdef _WIN64
# define PRI_SIZET PRIu64
# else
# define PRI_SIZET PRIu32
# endif
#else
# define PRI_SIZET "zu"
#endif
#endif

View File

@ -398,7 +398,7 @@ static int send_recv(uint8_t *txbuf, size_t txsize,
if (res >0) {
int i;
uint8_t *p = rxbuf;
DEBUG_USB(" Rec (%" PRI_SIZET "/%d)", rxsize, res);
DEBUG_USB(" Rec (%zu/%d)", rxsize, res);
for (i = 0; i < res && i < 32 ; i++) {
if ( i && ((i & 7) == 0))
DEBUG_USB(".");
@ -1233,7 +1233,7 @@ void stlink_readmem(ADIv5_AP_t *ap, void *dest, uint32_t src, size_t len)
type = STLINK_DEBUG_READMEM_32BIT;
}
DEBUG_STLINK("%s len %" PRI_SIZET " addr 0x%08" PRIx32 " AP %d : ",
DEBUG_STLINK("%s len %zu addr 0x%08" PRIx32 " AP %d : ",
CMD, len, src, ap->apsel);
uint8_t cmd[16] = {
STLINK_DEBUG_COMMAND,
@ -1263,7 +1263,7 @@ void stlink_readmem(ADIv5_AP_t *ap, void *dest, uint32_t src, size_t len)
void stlink_writemem8(ADIv5_AP_t *ap, uint32_t addr, size_t len,
uint8_t *buffer)
{
DEBUG_STLINK("Mem Write8 AP %d len %" PRI_SIZET " addr 0x%08" PRIx32 ": ",
DEBUG_STLINK("Mem Write8 AP %d len %zu addr 0x%08" PRIx32 ": ",
ap->apsel, len, addr);
for (size_t t = 0; t < len; t++) {
DEBUG_STLINK("%02x", buffer[t]);
@ -1292,7 +1292,7 @@ void stlink_writemem8(ADIv5_AP_t *ap, uint32_t addr, size_t len,
void stlink_writemem16(ADIv5_AP_t *ap, uint32_t addr, size_t len,
uint16_t *buffer)
{
DEBUG_STLINK("Mem Write16 AP %d len %" PRI_SIZET " addr 0x%08" PRIx32 ": ",
DEBUG_STLINK("Mem Write16 AP %d len %zu addr 0x%08" PRIx32 ": ",
ap->apsel, len, addr);
for (size_t t = 0; t < len; t+=2) {
DEBUG_STLINK("%04x", buffer[t]);
@ -1312,7 +1312,7 @@ void stlink_writemem16(ADIv5_AP_t *ap, uint32_t addr, size_t len,
void stlink_writemem32(ADIv5_AP_t *ap, uint32_t addr, size_t len,
uint32_t *buffer)
{
DEBUG_STLINK("Mem Write32 AP %d len %" PRI_SIZET " addr 0x%08" PRIx32 ": ",
DEBUG_STLINK("Mem Write32 AP %d len %zu addr 0x%08" PRIx32 ": ",
ap->apsel, len, addr);
for (size_t t = 0; t < len; t+=4) {
DEBUG_STLINK("%04x", buffer[t]);

View File

@ -298,7 +298,7 @@ static int msp432_flash_write(struct target_flash *f, target_addr dest,
regs[1] = dest; // Flash address to be write to in R1
regs[2] = len; // Size of buffer to be flashed in R2
DEBUG("Writing 0x%04" PRIX32 " bytes at 0x%08" PRI_SIZET "\n", dest, len);
DEBUG("Writing 0x%04" PRIX32 " bytes at 0x%08zu\n", dest, len);
/* Call ROM */
msp432_call_ROM(t, mf->FlashCtl_programMemory, regs);