From 2d4d6aa65a57bfb0c8ecdfc438aa86e01cbd6f0c Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 31 May 2022 09:44:51 -0400 Subject: [PATCH] ch32f1: Fixed the assumption that uint32_t is an `unsigned int` --- src/target/ch32f1.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/target/ch32f1.c b/src/target/ch32f1.c index 016c414..8f23c9c 100644 --- a/src/target/ch32f1.c +++ b/src/target/ch32f1.c @@ -241,17 +241,16 @@ int ch32f1_flash_erase (struct target_flash *f, target_addr addr, size_t len) NB: Just reading fff is not enough as it could be a transient previous operation value */ -static bool ch32f1_wait_flash_ready(target *t,uint32_t adr) +static bool ch32f1_wait_flash_ready(target *t, uint32_t adr) { - uint32_t ff; - for(int i = 0; i < 32; i++) { - ff = target_mem_read32(t,adr); - } - if(ff != 0xffffffffUL) { - ERROR_CH("ch32f1 Not erased properly at %x or flash access issue\n",adr); - return false; - } - return true; + uint32_t ff; + for (int i = 0; i < 32; i++) + ff = target_mem_read32(t, adr); + if (ff != 0xffffffffUL) { + ERROR_CH("ch32f1 Not erased properly at %" PRIx32 " or flash access issue\n", adr); + return false; + } + return true; } /** \fn ch32f1_flash_write