flash: use proper format with uint32_t 16/5816/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 18 Aug 2020 16:56:03 +0000 (18:56 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 5 Sep 2020 16:12:32 +0000 (17:12 +0100)
Modify the format strings to properly handle uint32_t data types.

Change the type of variable retval in 'nor/ambiqmicro.c' to match
both the value to carry and the returned type of the function.

Fix the prototype mismatch of function lpc2900_address2sector()
between the header and the C file.

Change-Id: I68ffba9bd83eec8132f83bff3af993861fd09d84
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5816
Tested-by: jenkins
38 files changed:
src/flash/nand/mx3.c
src/flash/nand/mxc.c
src/flash/nand/tcl.c
src/flash/nor/aducm360.c
src/flash/nor/ambiqmicro.c
src/flash/nor/at91sam4.c
src/flash/nor/at91sam4l.c
src/flash/nor/at91sam7.c
src/flash/nor/ath79.c
src/flash/nor/atsame5.c
src/flash/nor/atsamv.c
src/flash/nor/avrf.c
src/flash/nor/bluenrg-x.c
src/flash/nor/cc26xx.c
src/flash/nor/cfi.c
src/flash/nor/core.c
src/flash/nor/esirisc_flash.c
src/flash/nor/fespi.c
src/flash/nor/fm4.c
src/flash/nor/kinetis.c
src/flash/nor/lpc2000.c
src/flash/nor/lpc2900.c
src/flash/nor/max32xxx.c
src/flash/nor/msp432.c
src/flash/nor/niietcm4.c
src/flash/nor/numicro.c
src/flash/nor/pic32mx.c
src/flash/nor/psoc5lp.c
src/flash/nor/psoc6.c
src/flash/nor/renesas_rpchf.c
src/flash/nor/sh_qspi.c
src/flash/nor/stm32l4x.c
src/flash/nor/stm32lx.c
src/flash/nor/tcl.c
src/flash/nor/tms470.c
src/flash/nor/w600.c
src/flash/nor/xcf.c
src/flash/nor/xmc1xxx.c

index abeaf159cc2e0d4354587a251e32188dd2894482..b9f5ff1b9f1673d6e52ae47fcb82420f4ad0ad06 100644 (file)
@@ -40,7 +40,7 @@ get_next_halfword_from_sram_buffer() not tested
 static const char target_not_halted_err_msg[] =
                "target must be halted to use mx3 NAND flash controller";
 static const char data_block_size_err_msg[] =
-               "minimal granularity is one half-word, %" PRId32 " is incorrect";
+               "minimal granularity is one half-word, %" PRIu32 " is incorrect";
 static const char sram_buffer_bounds_err_msg[] =
                "trying to access out of SRAM buffer bound (addr=0x%" PRIx32 ")";
 static const char get_status_register_err_msg[] = "can't get NAND status";
index bc2ae9324bebf8d758d6d7cc417081bd5b0a3be2..2c5de0394e1eded81b2a4939745211e77cda11db 100644 (file)
@@ -65,7 +65,7 @@
 static const char target_not_halted_err_msg[] =
        "target must be halted to use mxc NAND flash controller";
 static const char data_block_size_err_msg[] =
-       "minimal granularity is one half-word, %" PRId32 " is incorrect";
+       "minimal granularity is one half-word, %" PRIu32 " is incorrect";
 static const char sram_buffer_bounds_err_msg[] =
        "trying to access out of SRAM buffer bound (addr=0x%" PRIx32 ")";
 static const char get_status_register_err_msg[] = "can't get NAND status";
index 5480e0d61ea2d5ed693cd40e5d3fde4485880af2..ca8b9dad4d191d624bdaa5644458b7c0e27ce70e 100644 (file)
@@ -124,7 +124,7 @@ COMMAND_HANDLER(handle_nand_info_command)
                        bad_state = " (block condition unknown)";
 
                command_print(CMD,
-                       "\t#%i: 0x%8.8" PRIx32 " (%" PRId32 "kB) %s%s",
+                       "\t#%i: 0x%8.8" PRIx32 " (%" PRIu32 "kB) %s%s",
                        j,
                        p->blocks[j].offset,
                        p->blocks[j].size / 1024,
index 5e0a666ea34cf3d58252e80d26cae4bfffe58001..4e816fd618f3cef46a02ea2ba51d694a70de29dc 100644 (file)
@@ -285,7 +285,7 @@ static int aducm360_write_block_sync(
 
                res = buf_get_u32(reg_params[4].value, 0, 32);
                if (res) {
-                       LOG_ERROR("aducm360 fast sync algorithm reports an error (%02X)", res);
+                       LOG_ERROR("aducm360 fast sync algorithm reports an error (%02" PRIX32 ")", res);
                        retval = ERROR_FAIL;
                        break;
                }
@@ -401,7 +401,7 @@ static int aducm360_write_block_async(
        } else {
                res = buf_get_u32(reg_params[4].value, 0, 32);  /*RESULT*/
                if (res) {
-                       LOG_ERROR("aducm360 fast async algorithm reports an error (%02X)", res);
+                       LOG_ERROR("aducm360 fast async algorithm reports an error (%02" PRIX32 ")", res);
                        retval = ERROR_FAIL;
                }
        }
index 28dc42d8272f8c3903962a4e4bc1471a556c83c0..1c4dce87dcd525016e789903d3d2d96f046074cb 100644 (file)
@@ -212,7 +212,7 @@ static int ambiqmicro_read_part_info(struct flash_bank *bank)
                /* Set PartNum to default device */
                PartNum = 0;
        }
-       LOG_DEBUG("Part number: 0x%x", PartNum);
+       LOG_DEBUG("Part number: 0x%" PRIx32, PartNum);
 
        /*
         * Determine device class.
@@ -260,7 +260,7 @@ static int ambiqmicro_read_part_info(struct flash_bank *bank)
                ambiqmicro_info->target_name =
                        ambiqmicroParts[0].partname;
 
-       LOG_DEBUG("num_pages: %d, pagesize: %d, flash: %d, sram: %d",
+       LOG_DEBUG("num_pages: %" PRIu32 ", pagesize: %" PRIu32 ", flash: %" PRIu32 ", sram: %" PRIu32,
                ambiqmicro_info->num_pages,
                ambiqmicro_info->pagesize,
                ambiqmicro_info->flshsiz,
@@ -304,7 +304,7 @@ static int check_flash_status(struct target *target, uint32_t address)
        }
        /* target flash failed, unknown cause. */
        if (retflash != 0) {
-               LOG_ERROR("Flash not happy: status(0x%x)", retflash);
+               LOG_ERROR("Flash not happy: status(0x%" PRIx32 ")", retflash);
                return ERROR_FLASH_OPERATION_FAILED;
        }
        return ERROR_OK;
@@ -432,7 +432,7 @@ static int ambiqmicro_erase(struct flash_bank *bank, unsigned int first,
 {
        struct ambiqmicro_flash_bank *ambiqmicro_info = bank->driver_priv;
        struct target *target = bank->target;
-       uint32_t retval = ERROR_OK;
+       int retval;
 
        if (bank->target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
@@ -615,7 +615,7 @@ static int ambiqmicro_write_block(struct flash_bank *bank,
                        break;
                }
 
-               LOG_DEBUG("address = 0x%08x", address);
+               LOG_DEBUG("address = 0x%08" PRIx32, address);
 
                retval = ambiqmicro_exec_command(target, FLASH_PROGRAM_MAIN_FROM_SRAM, 0x1000000c);
                CHECK_STATUS(retval, "error executing ambiqmicro flash write algorithm");
@@ -641,7 +641,7 @@ static int ambiqmicro_write_block(struct flash_bank *bank,
 static int ambiqmicro_write(struct flash_bank *bank, const uint8_t *buffer,
        uint32_t offset, uint32_t count)
 {
-       uint32_t retval;
+       int retval;
 
        /* try using a block write */
        retval = ambiqmicro_write_block(bank, buffer, offset, count);
@@ -654,7 +654,7 @@ static int ambiqmicro_write(struct flash_bank *bank, const uint8_t *buffer,
 static int ambiqmicro_probe(struct flash_bank *bank)
 {
        struct ambiqmicro_flash_bank *ambiqmicro_info = bank->driver_priv;
-       uint32_t retval;
+       int retval;
 
        /* If this is a ambiqmicro chip, it has flash; probe() is just
         * to figure out how much is present.  Only do it once.
@@ -698,7 +698,7 @@ static int ambiqmicro_otp_program(struct flash_bank *bank,
 {
        struct target *target = NULL;
        struct ambiqmicro_flash_bank *ambiqmicro_info = NULL;
-       uint32_t retval = ERROR_OK;
+       int retval;
 
        ambiqmicro_info = bank->driver_priv;
        target = bank->target;
@@ -757,7 +757,7 @@ static int ambiqmicro_otp_program(struct flash_bank *bank,
        /*
         * Program OTP.
         */
-       LOG_INFO("Programming OTP offset 0x%08x", offset);
+       LOG_INFO("Programming OTP offset 0x%08" PRIx32, offset);
 
        /*
         * passed pc, addr = ROM function, handle breakpoints, not debugging.
@@ -778,7 +778,7 @@ COMMAND_HANDLER(ambiqmicro_handle_mass_erase_command)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        struct flash_bank *bank;
-       uint32_t retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -798,7 +798,7 @@ COMMAND_HANDLER(ambiqmicro_handle_page_erase_command)
 {
        struct flash_bank *bank;
        uint32_t first, last;
-       uint32_t retval;
+       int retval;
 
        if (CMD_ARGC < 3)
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -826,7 +826,7 @@ COMMAND_HANDLER(ambiqmicro_handle_program_otp_command)
 {
        struct flash_bank *bank;
        uint32_t offset, count;
-       uint32_t retval;
+       int retval;
 
        if (CMD_ARGC < 3)
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -834,7 +834,7 @@ COMMAND_HANDLER(ambiqmicro_handle_program_otp_command)
        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], offset);
        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], count);
 
-       command_print(CMD, "offset=0x%08x count=%d", offset, count);
+       command_print(CMD, "offset=0x%08" PRIx32 " count=%" PRIu32, offset, count);
 
        CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
 
index 3f9ea9bfa1fd228f0d1066265452634d333efc0c..1c61064253d69722fafb60d323bec9f7b87cb000 100644 (file)
@@ -1896,7 +1896,7 @@ static uint32_t sam4_reg_fieldname(struct sam4_chip *pChip,
        }
 
        /* show the basics */
-       LOG_USER_N("\t%*s: %*" PRId32 " [0x%0*" PRIx32 "] ",
+       LOG_USER_N("\t%*s: %*" PRIu32 " [0x%0*" PRIx32 "] ",
                REG_NAME_WIDTH, regname,
                dwidth, v,
                hwidth, v);
@@ -2549,7 +2549,7 @@ static int sam4_GetDetails(struct sam4_bank_private *pPrivate)
                sam4_explain_chipid_cidr(pPrivate->pChip);
                return ERROR_FAIL;
        } else {
-               LOG_DEBUG("SAM4 Found chip %s, CIDR 0x%08x", pDetails->name, pDetails->chipid_cidr);
+               LOG_DEBUG("SAM4 Found chip %s, CIDR 0x%08" PRIx32, pDetails->name, pDetails->chipid_cidr);
        }
 
        /* DANGER: THERE ARE DRAGONS HERE */
index 4ee4ff853278c640d2e0b2f8dbbabf958f6801de..d09414cbe771a78169f30291a97fb9ffee8a32a5 100644 (file)
@@ -346,7 +346,7 @@ static int sam4l_probe(struct flash_bank *bank)
        /* Done */
        chip->probed = true;
 
-       LOG_INFO("SAM4L MCU: %s (Rev %c) (%" PRIu32 "KB Flash with %d %" PRId32 "B pages, %" PRIu32 "KB RAM)",
+       LOG_INFO("SAM4L MCU: %s (Rev %c) (%" PRIu32 "KB Flash with %d %" PRIu32 "B pages, %" PRIu32 "KB RAM)",
                        chip->details ? chip->details->name : "unknown", (char)('A' + (id & 0xF)),
                        chip->flash_kb, chip->num_pages, chip->page_size, chip->ram_kb);
 
index 59f5951ae4fe2a23884f19642eef1fdfdf0d4960..3d8fee1afe0ab7a591aad667fd3c29b163844d73 100644 (file)
@@ -954,7 +954,7 @@ static int at91sam7_write(struct flash_bank *bank, const uint8_t *buffer, uint32
                /* Send Write Page command to Flash Controller */
                if (at91sam7_flash_command(bank, WP, pagen) != ERROR_OK)
                        return ERROR_FLASH_OPERATION_FAILED;
-               LOG_DEBUG("Write flash bank:%u page number:%" PRIi32 "", bank->bank_number, pagen);
+               LOG_DEBUG("Write flash bank:%u page number:%" PRIu32, bank->bank_number, pagen);
        }
 
        return ERROR_OK;
index c30ddf3c0b20f825f203202f75690430daf1309b..9a4595f6d1134d62963686c3b674f4b4ed2991a1 100644 (file)
@@ -275,7 +275,7 @@ static int ath79_spi_bitbang_chunk(struct flash_bank *bank,
        *transferred = 0;
        pracc_queue_init(&ctx);
 
-       LOG_DEBUG("ath79_spi_bitbang_bytes(%p, %08x, %p, %d)",
+       LOG_DEBUG("ath79_spi_bitbang_bytes(%p, %08" PRIx32 ", %p, %d)",
                  target, ath79_info->io_base, data, len);
 
        LOG_DEBUG("max code %d => max len %d. to_xfer %d",
@@ -568,7 +568,7 @@ static int ath79_write_page(struct flash_bank *bank, const uint8_t *buffer,
                ath79_info->dev->pagesize : SPIFLASH_DEF_PAGESIZE;
 
        if (address & 0xff) {
-               LOG_ERROR("ath79_write_page: unaligned write address: %08x",
+               LOG_ERROR("ath79_write_page: unaligned write address: %08" PRIx32,
                          address);
                return ERROR_FAIL;
        }
@@ -577,7 +577,7 @@ static int ath79_write_page(struct flash_bank *bank, const uint8_t *buffer,
                return ERROR_FAIL;
        }
        if (len > ath79_info->dev->pagesize) {
-               LOG_ERROR("ath79_write_page: len bigger than page size %d: %d",
+               LOG_ERROR("ath79_write_page: len bigger than page size %" PRIu32 ": %" PRIu32,
                        pagesize, len);
                return ERROR_FAIL;
        }
@@ -589,7 +589,7 @@ static int ath79_write_page(struct flash_bank *bank, const uint8_t *buffer,
        if (i == len)  /* all 0xff, no need to program. */
                return ERROR_OK;
 
-       LOG_INFO("writing %d bytes to flash page @0x%08x", len, address);
+       LOG_INFO("writing %" PRIu32 " bytes to flash page @0x%08" PRIx32, len, address);
 
        memcpy(ath79_info->spi.page_buf, buffer, len);
 
@@ -692,12 +692,12 @@ static int ath79_read_buffer(struct flash_bank *bank, uint8_t *buffer,
                  __func__, address, len);
 
        if (address & 0xff) {
-               LOG_ERROR("ath79_read_buffer: unaligned read address: %08x",
+               LOG_ERROR("ath79_read_buffer: unaligned read address: %08" PRIx32,
                          address);
                return ERROR_FAIL;
        }
 
-       LOG_INFO("reading %d bytes from flash @0x%08x", len, address);
+       LOG_INFO("reading %" PRIu32 " bytes from flash @0x%08" PRIx32, len, address);
 
        /* bitbang command */
        ath79_spi_bitbang_prepare(bank);
index 5d6010a2ad2fb25cedf32322a226334e7bd2c729..ed0bef463b61d830073092d72c06fb72da3dbb44 100644 (file)
@@ -740,7 +740,7 @@ FLASH_BANK_COMMAND_HANDLER(same5_flash_bank_command)
 {
        if (bank->base != SAMD_FLASH) {
                LOG_ERROR("Address " TARGET_ADDR_FMT " invalid bank address (try "
-                       "0x%08" PRIx32 "[same5] )", bank->base, SAMD_FLASH);
+                       "0x%08x[same5] )", bank->base, SAMD_FLASH);
                return ERROR_FAIL;
        }
 
index 7db31f140f299eff4c9ceb16f1645a19bf2a6a1f..af48398e09e7535cfa0e7fb441349c355c5bf555 100644 (file)
@@ -615,7 +615,7 @@ static int samv_get_info(struct flash_bank *bank, char *buf, int buf_size)
                if (ERROR_OK != r)
                        return r;
        }
-       snprintf(buf, buf_size, "Cortex-M7 detected with %d kB flash",
+       snprintf(buf, buf_size, "Cortex-M7 detected with %" PRIu32 " kB flash",
                        bank->size / 1024);
        return ERROR_OK;
 }
@@ -661,7 +661,7 @@ COMMAND_HANDLER(samv_handle_gpnvm_command)
                        return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
-       uint32_t v;
+       unsigned v;
        if (!strcmp("show", CMD_ARGV[0])) {
                if (who == -1) {
 showall:
index 70d4d341b506ed1d099ff200af2b9e79a568e929..dd3d077a09a6a5297a544aafa20daed99212a694 100644 (file)
@@ -264,7 +264,7 @@ static int avrf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t o
        }
 
        LOG_DEBUG("offset is 0x%08" PRIx32 "", offset);
-       LOG_DEBUG("count is %" PRId32 "", count);
+       LOG_DEBUG("count is %" PRIu32 "", count);
 
        if (ERROR_OK != avr_jtagprg_enterprogmode(avr))
                return ERROR_FAIL;
index 232f6ba0a61b1ab8adfc40c616fd06269b4d290a..57ea7396f0033627e1d2684a2c3424b1a3bb3399 100644 (file)
@@ -184,7 +184,7 @@ static int bluenrgx_erase(struct flash_bank *bank, unsigned int first,
                command = FLASH_CMD_ERASE_PAGE;
                for (unsigned int i = first; i <= last; i++) {
                        address = bank->base+i*FLASH_PAGE_SIZE(bluenrgx_info);
-                       LOG_DEBUG("address = %08x, index = %u", address, i);
+                       LOG_DEBUG("address = %08" PRIx32 ", index = %u", address, i);
 
                        if (bluenrgx_write_flash_reg(bank, FLASH_REG_IRQRAW, 0x3f) != ERROR_OK) {
                                LOG_ERROR("Register write failed");
@@ -249,7 +249,7 @@ static int bluenrgx_write(struct flash_bank *bank, const uint8_t *buffer,
                return ERROR_FLASH_BANK_NOT_PROBED;
 
        if ((offset + count) > bank->size) {
-               LOG_ERROR("Requested write past beyond of flash size: (offset+count) = %d, size=%d",
+               LOG_ERROR("Requested write past beyond of flash size: (offset+count) = %" PRIu32 ", size=%" PRIu32,
                          (offset + count),
                          bank->size);
                return ERROR_FLASH_DST_OUT_OF_BANK;
@@ -312,8 +312,8 @@ static int bluenrgx_write(struct flash_bank *bank, const uint8_t *buffer,
        LOG_DEBUG("source->address = " TARGET_ADDR_FMT, source->address);
        LOG_DEBUG("source->address+ source->size = " TARGET_ADDR_FMT, source->address+source->size);
        LOG_DEBUG("write_algorithm_sp->address = " TARGET_ADDR_FMT, write_algorithm_sp->address);
-       LOG_DEBUG("address = %08x", address);
-       LOG_DEBUG("count = %08x", count);
+       LOG_DEBUG("address = %08" PRIx32, address);
+       LOG_DEBUG("count = %08" PRIx32, count);
 
        retval = target_run_flash_async_algorithm(target,
                                                  buffer,
index f0a855074b2a2ba162476a5ed28cd0f583362cab..5565aeb41fc8751451ef5a5500b7defa5050b33a 100644 (file)
@@ -527,7 +527,7 @@ static int cc26xx_info(struct flash_bank *bank, char *buf, int buf_size)
        }
 
        printed = snprintf(buf, buf_size,
-               "%s device: ICEPick ID 0x%08x, USER ID 0x%08x\n",
+               "%s device: ICEPick ID 0x%08" PRIx32 ", USER ID 0x%08" PRIx32 "\n",
                device, cc26xx_bank->icepick_id, cc26xx_bank->user_id);
 
        if (printed >= buf_size)
index 964e06ac70a5e0c995530d48be36b19e83eaacf0..5f5071e6966fd46008fe18deba2ac7db4d86ab35 100644 (file)
@@ -2052,7 +2052,7 @@ static int cfi_intel_write_words(struct flash_bank *bank, const uint8_t *word,
 
        /* Check for valid size */
        if (wordcount > bufferwsize) {
-               LOG_ERROR("Number of data words %" PRId32 " exceeds available buffersize %" PRId32,
+               LOG_ERROR("Number of data words %" PRIu32 " exceeds available buffersize %" PRIu32,
                        wordcount, buffersize);
                return ERROR_FLASH_OPERATION_FAILED;
        }
@@ -2167,8 +2167,8 @@ static int cfi_spansion_write_words(struct flash_bank *bank, const uint8_t *word
 
        /* Check for valid size */
        if (wordcount > bufferwsize) {
-               LOG_ERROR("Number of data words %" PRId32 " exceeds available buffersize %"
-                       PRId32, wordcount, buffersize);
+               LOG_ERROR("Number of data words %" PRIu32 " exceeds available buffersize %"
+                       PRIu32, wordcount, buffersize);
                return ERROR_FLASH_OPERATION_FAILED;
        }
 
@@ -2467,7 +2467,7 @@ static int cfi_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t of
 
        /* handle unaligned tail bytes */
        if (count > 0) {
-               LOG_INFO("Fixup %" PRId32 " unaligned tail bytes", count);
+               LOG_INFO("Fixup %" PRIu32 " unaligned tail bytes", count);
 
                /* read a complete word from flash */
                retval = cfi_target_read_memory(bank, write_p, 1, current_word);
index b1a36623d6151ab9f6228e1bb19c06444ed962db..d56301351bdaa5f0c67fd763689cecbfffb7d86d 100644 (file)
@@ -825,7 +825,7 @@ int flash_write_unlock(struct target *target, struct image *image,
                                LOG_WARNING("Section start address " TARGET_ADDR_FMT
                                        " breaks the required alignment of flash bank %s",
                                        run_address, c->name);
-                               LOG_WARNING("Padding %d bytes from " TARGET_ADDR_FMT,
+                               LOG_WARNING("Padding %" PRIu32 " bytes from " TARGET_ADDR_FMT,
                                        padding_at_start, aligned_start);
 
                                run_address -= padding_at_start;
index a5785a964c683840a496dd3d89df2702a0ef243b..88f00bccaa6a0a676a5adcfb2d5232a75ee4bfe3 100644 (file)
@@ -494,7 +494,7 @@ static int esirisc_flash_info(struct flash_bank *bank, char *buf, int buf_size)
        struct esirisc_flash_bank *esirisc_info = bank->driver_priv;
 
        snprintf(buf, buf_size,
-                       "%4s cfg at 0x%" PRIx32 ", clock %" PRId32 ", wait_states %" PRId32,
+                       "%4s cfg at 0x%" PRIx32 ", clock %" PRIu32 ", wait_states %" PRIu32,
                        "",     /* align with first line */
                        esirisc_info->cfg,
                        esirisc_info->clock,
index 6b2793f1b9de742094a0ddd50369d16bf52b1671..02630ac24fa521e30b0ae68d187871e3fdaef895 100644 (file)
@@ -189,7 +189,7 @@ static int fespi_write_reg(struct flash_bank *bank, target_addr_t address, uint3
 
        int result = target_write_u32(target, fespi_info->ctrl_base + address, value);
        if (result != ERROR_OK) {
-               LOG_ERROR("fespi_write_reg() error writing 0x%x to " TARGET_ADDR_FMT,
+               LOG_ERROR("fespi_write_reg() error writing 0x%" PRIx32 " to " TARGET_ADDR_FMT,
                                value, fespi_info->ctrl_base + address);
                return result;
        }
@@ -274,7 +274,7 @@ static int fespi_rx(struct flash_bank *bank, uint8_t *out)
                        break;
                int64_t now = timeval_ms();
                if (now - start > 1000) {
-                       LOG_ERROR("rxfifo didn't go positive (value=0x%x).", value);
+                       LOG_ERROR("rxfifo didn't go positive (value=0x%" PRIx32 ").", value);
                        return ERROR_TARGET_TIMEOUT;
                }
        }
@@ -438,7 +438,7 @@ static int slow_fespi_write_buffer(struct flash_bank *bank,
        uint32_t ii;
 
        if (offset & 0xFF000000) {
-               LOG_ERROR("FESPI interface does not support greater than 3B addressing, can't write to offset 0x%x",
+               LOG_ERROR("FESPI interface does not support greater than 3B addressing, can't write to offset 0x%" PRIx32,
                                offset);
                return ERROR_FAIL;
        }
@@ -651,7 +651,7 @@ static int steps_add_buffer_write(struct algorithm_steps *as,
                const uint8_t *buffer, uint32_t chip_offset, uint32_t len)
 {
        if (chip_offset & 0xFF000000) {
-               LOG_ERROR("FESPI interface does not support greater than 3B addressing, can't write to offset 0x%x",
+               LOG_ERROR("FESPI interface does not support greater than 3B addressing, can't write to offset 0x%" PRIx32,
                                chip_offset);
                return ERROR_FAIL;
        }
index 4daec78a1ce877bfd6d4ba8c56f6976c3d313074..211a008637f35451f83fcdccf7c53127d2fcf6f5 100644 (file)
@@ -172,7 +172,7 @@ static int fm4_flash_erase(struct flash_bank *bank, unsigned int first,
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        goto err_run_ret;
                } else if (result != 0) {
-                       LOG_ERROR("Unexpected error %d from flash sector erase programming algorithm", result);
+                       LOG_ERROR("Unexpected error %" PRIu32 " from flash sector erase programming algorithm", result);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        goto err_run_ret;
                } else
@@ -213,7 +213,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
 #include "../../../contrib/loaders/flash/fm4/write.inc"
        };
 
-       LOG_DEBUG("Spansion FM4 write at 0x%08" PRIx32 " (%" PRId32 " bytes)",
+       LOG_DEBUG("Spansion FM4 write at 0x%08" PRIx32 " (%" PRIu32 " bytes)",
                offset, byte_count);
 
        if (offset & 0x1) {
@@ -222,7 +222,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
                return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
        }
        if (byte_count & 0x1) {
-               LOG_WARNING("length %" PRId32 " is not 2-byte aligned, rounding up",
+               LOG_WARNING("length %" PRIu32 " is not 2-byte aligned, rounding up",
                        byte_count);
        }
 
@@ -273,7 +273,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
                uint32_t halfwords = MIN(halfword_count, data_workarea->size / 2);
                uint32_t addr = bank->base + offset;
 
-               LOG_DEBUG("copying %" PRId32 " bytes to SRAM " TARGET_ADDR_FMT,
+               LOG_DEBUG("copying %" PRIu32 " bytes to SRAM " TARGET_ADDR_FMT,
                        MIN(halfwords * 2, byte_count), data_workarea->address);
 
                retval = target_write_buffer(target, data_workarea->address,
@@ -284,7 +284,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
                        goto err_write_data;
                }
 
-               LOG_DEBUG("writing 0x%08" PRIx32 "-0x%08" PRIx32 " (%" PRId32 "x)",
+               LOG_DEBUG("writing 0x%08" PRIx32 "-0x%08" PRIx32 " (%" PRIu32 "x)",
                        addr, addr + halfwords * 2 - 1, halfwords);
 
                buf_set_u32(reg_params[0].value, 0, 32, (addr & ~0xffff) | 0xAA8);
@@ -312,7 +312,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        goto err_run_ret;
                } else if (result != 0) {
-                       LOG_ERROR("Unexpected error %d from flash write "
+                       LOG_ERROR("Unexpected error %" PRIu32 " from flash write "
                                "programming algorithm", result);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        goto err_run_ret;
index 6b6121d3b4c66dc3a4a48e11925273bdc1c6e153..e6b452e0573ec7bc026dcffae1cec411f2fcf3bb 100644 (file)
@@ -2578,7 +2578,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
                else
                        k_chip->pflash_size = k_chip->fcfg2_maxaddr0_shifted * num_blocks / 2;
                if (k_chip->pflash_size != 2048<<10)
-                       LOG_WARNING("SIM_FCFG1 PFSIZE = 0xf: please check if pflash is %u KB", k_chip->pflash_size>>10);
+                       LOG_WARNING("SIM_FCFG1 PFSIZE = 0xf: please check if pflash is %" PRIu32 " KB", k_chip->pflash_size>>10);
 
                break;
        default:
@@ -2668,7 +2668,7 @@ static int kinetis_probe(struct flash_bank *bank)
                k_bank->protection_block = bank->num_prot_blocks * k_bank->bank_number;
 
                size_k = bank->size / 1024;
-               LOG_DEBUG("Kinetis bank %u: %" PRIu32 "k PFlash, FTFx base 0x%08" PRIx32 ", sect %u",
+               LOG_DEBUG("Kinetis bank %u: %" PRIu32 "k PFlash, FTFx base 0x%08" PRIx32 ", sect %" PRIu32,
                         k_bank->bank_number, size_k, k_bank->prog_base, k_bank->sector_size);
 
        } else if (k_bank->bank_number < num_blocks) {
@@ -2708,7 +2708,7 @@ static int kinetis_probe(struct flash_bank *bank)
                }
 
                size_k = bank->size / 1024;
-               LOG_DEBUG("Kinetis bank %u: %" PRIu32 "k FlexNVM, FTFx base 0x%08" PRIx32 ", sect %u",
+               LOG_DEBUG("Kinetis bank %u: %" PRIu32 "k FlexNVM, FTFx base 0x%08" PRIx32 ", sect %" PRIu32,
                         k_bank->bank_number, size_k, k_bank->prog_base, k_bank->sector_size);
 
        } else {
index a1aa1df3e769f64e75dc04839e9f1d1417b4e6b4..942ef555c96ae09d2750b8b557ec1e955001db0d 100644 (file)
@@ -1556,7 +1556,7 @@ static int get_lpc2000_info(struct flash_bank *bank, char *buf, int buf_size)
 {
        struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
 
-       snprintf(buf, buf_size, "lpc2000 flash driver variant: %i, clk: %" PRIi32 "kHz", lpc2000_info->variant,
+       snprintf(buf, buf_size, "lpc2000 flash driver variant: %i, clk: %" PRIu32 "kHz", lpc2000_info->variant,
                        lpc2000_info->cclk);
 
        return ERROR_OK;
index 386c8bffe25490bbdf54f07e4f0f6ea19b653f99..c8e885aba15644af07799d27a6dbcebc000a7bbc 100644 (file)
@@ -174,7 +174,7 @@ static uint32_t lpc2900_read_security_status(struct flash_bank *bank);
 static uint32_t lpc2900_run_bist128(struct flash_bank *bank,
                uint32_t addr_from, uint32_t addr_to,
                uint32_t signature[4]);
-static uint32_t lpc2900_address2sector(struct flash_bank *bank, uint32_t offset);
+static unsigned int lpc2900_address2sector(struct flash_bank *bank, uint32_t offset);
 static uint32_t lpc2900_calc_tr(uint32_t clock_var, uint32_t time_var);
 
 /***********************  Helper functions  **************************/
index bf54f63ba0d4e469631172d76dd58509cb908eed..9a5e83fa058118c89510fad7e7b66151e16b4997 100644 (file)
@@ -76,7 +76,7 @@ struct max32xxx_flash_bank {
        unsigned int flc_base;
        unsigned int sector_size;
        unsigned int clkdiv_value;
-       unsigned int int_state;
+       uint32_t int_state;
        unsigned int burst_size_bits;
 };
 
@@ -98,13 +98,13 @@ FLASH_BANK_COMMAND_HANDLER(max32xxx_flash_bank_command)
        }
 
        info = calloc(sizeof(struct max32xxx_flash_bank), 1);
-       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], info->flash_size);
-       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[6], info->flc_base);
-       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[7], info->sector_size);
-       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[8], info->clkdiv_value);
+       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], info->flash_size);
+       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[6], info->flc_base);
+       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[7], info->sector_size);
+       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[8], info->clkdiv_value);
 
        if (CMD_ARGC > 9)
-               COMMAND_PARSE_NUMBER(u32, CMD_ARGV[9], info->burst_size_bits);
+               COMMAND_PARSE_NUMBER(uint, CMD_ARGV[9], info->burst_size_bits);
        else
                info->burst_size_bits = 32;
 
@@ -522,7 +522,7 @@ static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                        } while ((--retry > 0) && (flsh_cn & FLSH_CN_PEND));
 
                        if (retry <= 0) {
-                               LOG_ERROR("Timed out waiting for flash write @ 0x%08x", address);
+                               LOG_ERROR("Timed out waiting for flash write @ 0x%08" PRIx32, address);
                                return ERROR_FLASH_OPERATION_FAILED;
                        }
 
@@ -543,7 +543,7 @@ static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer,
 
                while (remaining >= 16) {
                        if ((address & 0xFFF) == 0)
-                               LOG_DEBUG("Writing @ 0x%08x", address);
+                               LOG_DEBUG("Writing @ 0x%08" PRIx32, address);
 
                        target_write_buffer(target, info->flc_base + FLSH_DATA0, 16, buffer);
                        flsh_cn |= 0x00000001;
@@ -556,7 +556,7 @@ static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                        } while ((--retry > 0) && (flsh_cn & FLSH_CN_PEND));
 
                        if (retry <= 0) {
-                               LOG_ERROR("Timed out waiting for flash write @ 0x%08x", address);
+                               LOG_ERROR("Timed out waiting for flash write @ 0x%08" PRIx32, address);
                                return ERROR_FLASH_OPERATION_FAILED;
                        }
 
@@ -587,7 +587,7 @@ static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                        } while ((--retry > 0) && (flsh_cn & FLSH_CN_PEND));
 
                        if (retry <= 0) {
-                               LOG_ERROR("Timed out waiting for flash write @ 0x%08x", address);
+                               LOG_ERROR("Timed out waiting for flash write @ 0x%08" PRIx32, address);
                                return ERROR_FLASH_OPERATION_FAILED;
                        }
 
@@ -625,7 +625,7 @@ static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                } while ((--retry > 0) && (flsh_cn & FLSH_CN_PEND));
 
                if (retry <= 0) {
-                       LOG_ERROR("Timed out waiting for flash write @ 0x%08x", address);
+                       LOG_ERROR("Timed out waiting for flash write @ 0x%08" PRIx32, address);
                        return ERROR_FLASH_OPERATION_FAILED;
                }
        }
@@ -633,7 +633,7 @@ static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer,
        /* Check access violations */
        target_read_u32(target, info->flc_base + FLSH_INT, &flsh_int);
        if (flsh_int & FLSH_INT_AF) {
-               LOG_ERROR("Flash Error writing 0x%x bytes at 0x%08x", count, offset);
+               LOG_ERROR("Flash Error writing 0x%" PRIx32 " bytes at 0x%08" PRIx32, count, offset);
                max32xxx_flash_op_post(bank);
                return ERROR_FLASH_OPERATION_FAILED;
        }
@@ -675,7 +675,7 @@ static int max32xxx_probe(struct flash_bank *bank)
        if ((arm_pid == ARM_PID_DEFAULT_CM3) || arm_pid == ARM_PID_DEFAULT_CM4) {
                uint32_t max326xx_id;
                target_read_u32(target, MAX326XX_ID_REG, &max326xx_id);
-               LOG_DEBUG("max326xx_id = 0x%x", max326xx_id);
+               LOG_DEBUG("max326xx_id = 0x%" PRIx32, max326xx_id);
                max326xx_id = ((max326xx_id & 0xFF000000) >> 24);
                if (max326xx_id == MAX326XX_ID)
                        info->max326xx = 1;
index d2417bc89b227b1ce525b06791216e040e65d205..b6933e1e9bbdd5b1c3d25821592390da9a6b9c23 100644 (file)
@@ -320,7 +320,7 @@ static int msp432_init(struct flash_bank *bank)
                /* Explicit device type check failed. Report this. */
                LOG_WARNING(
                        "msp432: Unrecognized MSP432P4 Device ID and Hardware "
-                       "Rev (%04X, %02X)", msp432_bank->device_id,
+                       "Rev (%04" PRIX32 ", %02" PRIX32 ")", msp432_bank->device_id,
                        msp432_bank->hardware_rev);
        } else if (MSP432P401X_DEPR == msp432_bank->device_type) {
                LOG_WARNING(
@@ -330,7 +330,7 @@ static int msp432_init(struct flash_bank *bank)
                /* Explicit device type check failed. Report this. */
                LOG_WARNING(
                        "msp432: Unrecognized MSP432E4 DID0 and DID1 values "
-                       "(%08X, %08X)", msp432_bank->device_id,
+                       "(%08" PRIX32 ", %08" PRIX32 ")", msp432_bank->device_id,
                        msp432_bank->hardware_rev);
        }
 
@@ -1012,14 +1012,14 @@ static int msp432_info(struct flash_bank *bank, char *buf, int buf_size)
                        break;
                case MSP432E4X_GUESS:
                        printed = snprintf(buf, buf_size,
-                               "Unrecognized MSP432E4 DID0 and DID1 IDs (%08X, %08X)",
+                               "Unrecognized MSP432E4 DID0 and DID1 IDs (%08" PRIX32 ", %08" PRIX32 ")",
                                msp432_bank->device_id, msp432_bank->hardware_rev);
                        break;
                case MSP432P401X_GUESS:
                case MSP432P411X_GUESS:
                default:
                        printed = snprintf(buf, buf_size,
-                               "Unrecognized MSP432P4 Device ID and Hardware Rev (%04X, %02X)",
+                               "Unrecognized MSP432P4 Device ID and Hardware Rev (%04" PRIX32 ", %02" PRIX32 ")",
                                msp432_bank->device_id, msp432_bank->hardware_rev);
                        break;
        }
index 2a20edcee960d8b06bbc60c283f3fffcf1cf330a..1831314ddd1386b3f56a69ba3d9af0a47f34ae29 100644 (file)
@@ -411,7 +411,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_read_byte_command)
        else
                return ERROR_COMMAND_SYNTAX_ERROR;
 
-       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], uflash_addr);
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], uflash_addr);
 
        retval = target_write_u32(target, UFMA, uflash_addr);
        if (retval != ERROR_OK)
@@ -427,8 +427,8 @@ COMMAND_HANDLER(niietcm4_handle_uflash_read_byte_command)
        if (retval != ERROR_OK)
                return retval;
        command_print(CMD,  "Read userflash %s region:\n"
-                                               "address = 0x%04x,\n"
-                                               "value   = 0x%02x.", CMD_ARGV[0], uflash_addr, uflash_data);
+                                               "address = 0x%04" PRIx32 ",\n"
+                                               "value   = 0x%02" PRIx32 ".", CMD_ARGV[0], uflash_addr, uflash_data);
        return retval;
 }
 
@@ -463,14 +463,14 @@ COMMAND_HANDLER(niietcm4_handle_uflash_write_byte_command)
        else
                return ERROR_COMMAND_SYNTAX_ERROR;
 
-       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], uflash_addr);
-       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], uflash_data);
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], uflash_addr);
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], uflash_data);
 
        int page_num = uflash_addr/USERFLASH_PAGE_SIZE;
 
        command_print(CMD, "Write userflash %s region:\n"
-                                          "address = 0x%04x,\n"
-                                          "value   = 0x%02x.\n"
+                                          "address = 0x%04" PRIx32 ",\n"
+                                          "value   = 0x%02" PRIx32 ".\n"
                                           "Please wait ... ", CMD_ARGV[0], uflash_addr, uflash_data);
        /* dump */
        uint32_t uflash_dump[USERFLASH_PAGE_SIZE];
@@ -803,7 +803,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_cfg_command)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        uint32_t pin;
-       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], pin);
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], pin);
        if (pin > 15)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
@@ -1427,7 +1427,7 @@ static int niietcm4_write(struct flash_bank *bank, const uint8_t *buffer,
                /* write 16 bytes per try */
                for (unsigned int i = 0; i < count; i += 16) {
                        /* current addr */
-                       LOG_INFO("%d byte of %d", i, count);
+                       LOG_INFO("%u byte of %" PRIu32, i, count);
                        flash_addr = offset + i;
                        retval = target_write_u32(target, FMA, flash_addr);
                        if (retval != ERROR_OK)
@@ -1596,31 +1596,31 @@ static int niietcm4_probe_k1921vk01t(struct flash_bank *bank)
                                "\n"
                                "MEMORY CONFIGURATION\n"
                                "Bootflash :\n"
-                               "    %d kB total\n"
-                               "    %d pages %d kB each\n"
-                               "    0x%08x base address\n"
+                               "    %" PRIu32 " kB total\n"
+                               "    %" PRIu32 " pages %" PRIu32 " kB each\n"
+                               "    0x%08" PRIx32 " base address\n"
                                "%s"
                                "Info bootflash :\n"
-                               "    %d kB total\n"
-                               "    %d pages %d kB each\n"
+                               "    %" PRIu32 " kB total\n"
+                               "    %" PRIu32 " pages %" PRIu32 " kB each\n"
                                "    %s\n"
                                "%s"
                                "Userflash :\n"
-                               "    %d kB total\n"
-                               "    %d pages %d B each\n"
-                               "    %d bit cells\n"
+                               "    %" PRIu32 " kB total\n"
+                               "    %" PRIu32 " pages %" PRIu32 " B each\n"
+                               "    %" PRIu32 " bit cells\n"
                                "    not mapped to global address space\n"
                                "Info userflash :\n"
-                               "    %d B total\n"
-                               "    %d pages of %d B each\n"
-                               "    %d bit cells\n"
+                               "    %" PRIu32 " B total\n"
+                               "    %" PRIu32 " pages of %" PRIu32 " B each\n"
+                               "    %" PRIu32 " bit cells\n"
                                "    not mapped to global address space\n"
                                "RAM :\n"
                                "    192 kB total\n"
                                "    0x20000000 base address\n"
                                "External memory :\n"
                                "    8/16 bit address space\n"
-                               "    0x%08x base address\n"
+                               "    0x%08" PRIx32 " base address\n"
                                "\n"
                                "INFOWORD STATUS\n"
                                "Bootflash info region remap :\n"
@@ -1628,9 +1628,9 @@ static int niietcm4_probe_k1921vk01t(struct flash_bank *bank)
                                "External memory boot port :\n"
                                "    %s\n"
                                "External memory boot pin :\n"
-                               "    %d\n"
+                               "    %" PRIu32 "\n"
                                "External memory interface alternative function :\n"
-                               "    %d\n"
+                               "    %" PRIu32 "\n"
                                "Option boot from external memory :\n"
                                "    %s\n",
                                bflash_size/1024,
index c212cbc309d925e0b3e0d0bc2e7f38b73d979db5..7609fa81c0cbbc0f5841a1db46c694595b3ee21a 100644 (file)
@@ -1583,7 +1583,7 @@ static int numicro_write(struct flash_bank *bank, const uint8_t *buffer,
                /* program command */
                for (uint32_t i = 0; i < count; i += 4) {
 
-                       LOG_DEBUG("write longword @ %08X", offset + i);
+                       LOG_DEBUG("write longword @ %08" PRIX32, offset + i);
 
                        retval = target_write_u32(target, NUMICRO_FLASH_ISPADR, bank->base + offset + i);
                        if (retval != ERROR_OK)
index ae5ebb93223a8ff2b81883f53e8794e0ce1f30ea..c42cfb2bbe9207c2bf153ce1629b7c07d2130e8d 100644 (file)
@@ -771,7 +771,7 @@ static int pic32mx_probe(struct flash_bank *bank)
                }
        }
 
-       LOG_INFO("flash size = %" PRId32 "kbytes", num_pages / 1024);
+       LOG_INFO("flash size = %" PRIu32 "kbytes", num_pages / 1024);
 
        free(bank->sectors);
 
@@ -916,7 +916,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
                mchip_cmd = MCHP_STATUS;
                mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
                if (timeout-- == 0) {
-                       LOG_DEBUG("timeout waiting for unlock: 0x%" PRIx32 "", mchip_cmd);
+                       LOG_DEBUG("timeout waiting for unlock: 0x%" PRIx8 "", mchip_cmd);
                        break;
                }
                alive_sleep(1);
index 25a0ee02599abb22a487df463641035ee8a0cafd..c651dea7a66241373761d5edbba80ceb9edf9bba 100644 (file)
@@ -919,7 +919,7 @@ static int psoc5lp_eeprom_write(struct flash_bank *bank,
                memset(buf + byte_count, bank->default_padded_value,
                                EEPROM_ROW_SIZE - byte_count);
 
-               LOG_DEBUG("Padding %d bytes", EEPROM_ROW_SIZE - byte_count);
+               LOG_DEBUG("Padding %" PRIu32 " bytes", EEPROM_ROW_SIZE - byte_count);
                retval = psoc5lp_spc_load_row(target, SPC_ARRAY_EEPROM,
                                buf, EEPROM_ROW_SIZE);
                if (retval != ERROR_OK)
index 09a1bed563a8898caa27269643f2e812a3323d62..df151c1b5eac63f14c040f8187ef5d38d32081fe 100644 (file)
@@ -378,7 +378,7 @@ static int call_sromapi(struct target *target,
 
        bool is_success = (*data_out & SROMAPI_STATUS_MSK) == SROMAPI_STAT_SUCCESS;
        if (!is_success) {
-               LOG_ERROR("SROM API execution failed. Status: 0x%08X", (uint32_t)*data_out);
+               LOG_ERROR("SROM API execution failed. Status: 0x%08" PRIX32, *data_out);
                return ERROR_TARGET_FAILURE;
        }
 
@@ -513,9 +513,9 @@ static int psoc6_get_info(struct flash_bank *bank, char *buf, int buf_size)
                return hr;
 
        snprintf(buf, buf_size,
-               "PSoC6 Silicon ID: 0x%08X\n"
+               "PSoC6 Silicon ID: 0x%08" PRIX32 "\n"
                "Protection: %s\n"
-               "Main Flash size: %d kB\n"
+               "Main Flash size: %" PRIu32 " kB\n"
                "Work Flash size: 32 kB\n",
                psoc6_info->silicon_id,
                protection_to_str(psoc6_info->protection),
@@ -660,7 +660,7 @@ static int psoc6_erase_sector(struct flash_bank *bank, struct working_area *wa,
 {
        struct target *target = bank->target;
 
-       LOG_DEBUG("Erasing SECTOR @%08X", addr);
+       LOG_DEBUG("Erasing SECTOR @%08" PRIX32, addr);
 
        int hr = target_write_u32(target, wa->address, SROMAPI_ERASESECTOR_REQ);
        if (hr != ERROR_OK)
@@ -673,7 +673,7 @@ static int psoc6_erase_sector(struct flash_bank *bank, struct working_area *wa,
        uint32_t data_out;
        hr = call_sromapi(target, SROMAPI_ERASESECTOR_REQ, wa->address, &data_out);
        if (hr != ERROR_OK)
-               LOG_ERROR("SECTOR @%08X not erased!", addr);
+               LOG_ERROR("SECTOR @%08" PRIX32 " not erased!", addr);
 
        return hr;
 }
@@ -689,7 +689,7 @@ static int psoc6_erase_row(struct flash_bank *bank, struct working_area *wa, uin
 {
        struct target *target = bank->target;
 
-       LOG_DEBUG("Erasing ROW @%08X", addr);
+       LOG_DEBUG("Erasing ROW @%08" PRIX32, addr);
 
        int hr = target_write_u32(target, wa->address, SROMAPI_ERASEROW_REQ);
        if (hr != ERROR_OK)
@@ -702,7 +702,7 @@ static int psoc6_erase_row(struct flash_bank *bank, struct working_area *wa, uin
        uint32_t data_out;
        hr = call_sromapi(target, SROMAPI_ERASEROW_REQ, wa->address, &data_out);
        if (hr != ERROR_OK)
-               LOG_ERROR("ROW @%08X not erased!", addr);
+               LOG_ERROR("ROW @%08" PRIX32 " not erased!", addr);
 
        return hr;
 }
@@ -792,7 +792,7 @@ static int psoc6_program_row(struct flash_bank *bank,
        uint32_t data_out;
        int hr = ERROR_OK;
 
-       LOG_DEBUG("Programming ROW @%08X", addr);
+       LOG_DEBUG("Programming ROW @%08" PRIX32, addr);
 
        hr = target_alloc_working_area(target, psoc6_info->row_sz + 32, &wa);
        if (hr != ERROR_OK)
@@ -863,7 +863,7 @@ static int psoc6_program(struct flash_bank *bank,
 
                hr = psoc6_program_row(bank, aligned_addr, page_buf, is_sflash);
                if (hr != ERROR_OK) {
-                       LOG_ERROR("Failed to program Flash at address 0x%08X", aligned_addr);
+                       LOG_ERROR("Failed to program Flash at address 0x%08" PRIX32, aligned_addr);
                        goto exit;
                }
 
@@ -959,11 +959,11 @@ int handle_reset_halt(struct target *target)
         * Ignoring return value of mem_ap_write_atomic_u32 seems to be ok here */
        if (is_cm0) {
                /* Reset the CM0 by asserting SYSRESETREQ. This will also reset CM4 */
-               LOG_INFO("psoc6.cm0: bkpt @0x%08X, issuing SYSRESETREQ", reset_addr);
+               LOG_INFO("psoc6.cm0: bkpt @0x%08" PRIX32 ", issuing SYSRESETREQ", reset_addr);
                mem_ap_write_atomic_u32(cm->debug_ap, NVIC_AIRCR,
                        AIRCR_VECTKEY | AIRCR_SYSRESETREQ);
        } else {
-               LOG_INFO("psoc6.cm4: bkpt @0x%08X, issuing VECTRESET", reset_addr);
+               LOG_INFO("psoc6.cm4: bkpt @0x%08" PRIX32 ", issuing VECTRESET", reset_addr);
                mem_ap_write_atomic_u32(cm->debug_ap, NVIC_AIRCR,
                        AIRCR_VECTKEY | AIRCR_VECTRESET);
        }
index 933b6e5205d13c3fe915a0d76292e26ce8689647..f99749f3ddc25f7b67ecb05a66e81b3b82ba6c2e 100644 (file)
@@ -451,8 +451,8 @@ static int rpchf_spansion_write_words(struct flash_bank *bank, const uint8_t *wo
 
        /* Check for valid size */
        if (wordcount > bufferwsize) {
-               LOG_ERROR("Number of data words %" PRId32 " exceeds available buffersize %"
-                       PRId32, wordcount, buffersize);
+               LOG_ERROR("Number of data words %" PRIu32 " exceeds available buffersize %"
+                       PRIu32, wordcount, buffersize);
                return ERROR_FLASH_OPERATION_FAILED;
        }
 
@@ -583,7 +583,7 @@ static int rpchf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
 
        /* handle unaligned tail bytes */
        if (count > 0) {
-               LOG_INFO("Fixup %" PRId32 " unaligned tail bytes", count);
+               LOG_INFO("Fixup %" PRIu32 " unaligned tail bytes", count);
 
                /* read a complete word from flash */
                retval = cfi_target_read_memory(bank, write_p, 1, current_word);
@@ -612,7 +612,7 @@ static int rpchf_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset,
        struct cfi_flash_bank *cfi_info = bank->driver_priv;
        struct target *target = bank->target;
 
-       LOG_DEBUG("reading buffer of %" PRIi32 " byte at 0x%8.8" PRIx32,
+       LOG_DEBUG("reading buffer of %" PRIu32 " byte at 0x%8.8" PRIx32,
                  count, offset);
 
        if (bank->target->state != TARGET_HALTED) {
index 1ba9753392e691772e09e1bbdcadeacf57c0b9bb..4ec7ebe6584a51a94d75213dfc2a2dfe56cb2b05 100644 (file)
@@ -508,7 +508,7 @@ static int sh_qspi_write(struct flash_bank *bank, const uint8_t *buffer,
        }
 
        if (offset & 0xff) {
-               LOG_ERROR("sh_qspi_write_page: unaligned write address: %08x",
+               LOG_ERROR("sh_qspi_write_page: unaligned write address: %08" PRIx32,
                          offset);
                return ERROR_FAIL;
        }
index 0b5e1b04b48e6032d904f8b5c81ed6db4ab24991..379f1b4b38691b4ac189186cf710c2ca56b3eb4a 100644 (file)
@@ -1015,7 +1015,7 @@ static int stm32l4_probe(struct flash_bank *bank)
        const int gap_size_kb = stm32l4_info->hole_sectors * page_size_kb;
 
        if (gap_size_kb != 0) {
-               LOG_INFO("gap detected from 0x%08" PRIx32 " to 0x%08" PRIx32,
+               LOG_INFO("gap detected from 0x%08x to 0x%08x",
                        STM32_FLASH_BANK_BASE + stm32l4_info->bank1_sectors
                                * page_size_kb * 1024,
                        STM32_FLASH_BANK_BASE + (stm32l4_info->bank1_sectors
index 34c7408b012fd53bbe279d56ed092b55ee760154..3cb1a499824a23bd0473754b7368559b7743e167 100644 (file)
@@ -446,7 +446,7 @@ static int stm32lx_write_half_pages(struct flash_bank *bank, const uint8_t *buff
 
        /* Make sure we're performing a half-page aligned write. */
        if (count % hp_nb) {
-               LOG_ERROR("The byte count must be %" PRIu32 "B-aligned but count is %" PRIi32 "B)", hp_nb, count);
+               LOG_ERROR("The byte count must be %" PRIu32 "B-aligned but count is %" PRIu32 "B)", hp_nb, count);
                return ERROR_FAIL;
        }
 
index 3bdaf0b59dcded972ebdca45f32206cd67c038e2..e935b3b4af2280e89183664f880bec89f1690930 100644 (file)
@@ -141,7 +141,7 @@ COMMAND_HANDLER(handle_flash_info_command)
                                protect_state = "protection state unknown";
 
                        command_print(CMD,
-                               "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
+                               "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIu32 "kB) %s",
                                j,
                                block_array[j].offset,
                                block_array[j].size,
@@ -222,7 +222,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
 
                blank = false;
                command_print(CMD,
-                       "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
+                       "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIu32 "kB) %s",
                        j,
                        p->sectors[j].offset,
                        p->sectors[j].size,
@@ -288,8 +288,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)
                retval = flash_erase_address_range(target, do_pad, address, length);
 
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
-               command_print(CMD, "erased address " TARGET_ADDR_FMT " (length %"
-                               PRIi32 ")"
+               command_print(CMD, "erased address " TARGET_ADDR_FMT " (length %" PRIu32 ")"
                        " in %fs (%0.3f KiB/s)", address, length,
                        duration_elapsed(&bench), duration_kbps(&bench, length));
        }
@@ -326,7 +325,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
 
        if (!(last <= (p->num_sectors - 1))) {
                command_print(CMD, "ERROR: "
-                       "last sector must be <= %" PRIu32,
+                       "last sector must be <= %u",
                        p->num_sectors - 1);
                return ERROR_FAIL;
        }
@@ -384,7 +383,7 @@ COMMAND_HANDLER(handle_flash_protect_command)
 
        if (!(last <= (uint32_t)(num_blocks - 1))) {
                command_print(CMD, "ERROR: "
-                       "last %s must be <= %" PRIu32,
+                       "last %s must be <= %d",
                        (p->num_prot_blocks) ? "block" : "sector",
                        num_blocks - 1);
                return ERROR_FAIL;
@@ -541,7 +540,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
                LOG_WARNING("Start address " TARGET_ADDR_FMT
                        " breaks the required alignment of flash bank %s",
                        address, bank->name);
-               LOG_WARNING("Padding %" PRId32 " bytes from " TARGET_ADDR_FMT,
+               LOG_WARNING("Padding %" PRIu32 " bytes from " TARGET_ADDR_FMT,
                    padding_at_start, aligned_start);
        }
 
@@ -571,7 +570,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
 
        if (padding_at_end) {
                memset(ptr, bank->default_padded_value, padding_at_end);
-               LOG_INFO("Padding at " TARGET_ADDR_FMT " with %" PRId32
+               LOG_INFO("Padding at " TARGET_ADDR_FMT " with %" PRIu32
                        " bytes (bank write end alignment)",
                        end_addr + 1, padding_at_end);
        }
@@ -759,7 +758,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
                LOG_WARNING("Start offset 0x%08" PRIx32
                        " breaks the required alignment of flash bank %s",
                        offset, bank->name);
-               LOG_WARNING("Padding %" PRId32 " bytes from " TARGET_ADDR_FMT,
+               LOG_WARNING("Padding %" PRIu32 " bytes from " TARGET_ADDR_FMT,
                    padding_at_start, aligned_start);
        }
 
@@ -781,7 +780,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
 
        if (padding_at_end) {
                memset(ptr, bank->default_padded_value, padding_at_end);
-               LOG_INFO("Padding at " TARGET_ADDR_FMT " with %" PRId32
+               LOG_INFO("Padding at " TARGET_ADDR_FMT " with %" PRIu32
                        " bytes (bank write end alignment)",
                        end_addr + 1, padding_at_end);
        }
@@ -988,7 +987,7 @@ COMMAND_HANDLER(handle_flash_verify_bank_command)
                for (t = 0; t < length; t++) {
                        if (buffer_flash[t] == buffer_file[t])
                                continue;
-                       command_print(CMD, "diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
+                       command_print(CMD, "diff %d address 0x%08" PRIx32 ". Was 0x%02x instead of 0x%02x",
                                        diffs, t + offset, buffer_flash[t], buffer_file[t]);
                        if (diffs++ >= 127) {
                                command_print(CMD, "More than 128 errors, the rest are not printed.");
index 611688c6ae4a11dfcb4fdcfaa953291889a15b7e..3004682b8ed4c8b9a973f922880fd3f41b1dc66d 100644 (file)
@@ -901,7 +901,7 @@ static int tms470_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
 
        tms470_read_part_info(bank);
 
-       LOG_INFO("Writing %" PRId32 " bytes starting at " TARGET_ADDR_FMT,
+       LOG_INFO("Writing %" PRIu32 " bytes starting at " TARGET_ADDR_FMT,
                        count, bank->base + offset);
 
        /* set GLBCTRL.4  */
index 043959326923c7baf185f5f67f4bf9800fae9bde..2506f2b550efdb99a6cbcbfc6a5149bb8bd5ef5d 100644 (file)
@@ -240,13 +240,13 @@ static int w600_write(struct flash_bank *bank, const uint8_t *buffer,
        }
 
        if ((offset % W600_FLASH_PAGESIZE) != 0) {
-               LOG_WARNING("offset 0x%" PRIx32 " breaks required %" PRIu32 "-byte alignment",
+               LOG_WARNING("offset 0x%" PRIx32 " breaks required %d-byte alignment",
                        offset, W600_FLASH_PAGESIZE);
                return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
        }
 
        if ((count % W600_FLASH_PAGESIZE) != 0) {
-               LOG_WARNING("count 0x%" PRIx32 " breaks required %" PRIu32 "-byte alignment",
+               LOG_WARNING("count 0x%" PRIx32 " breaks required %d-byte alignment",
                        offset, W600_FLASH_PAGESIZE);
                return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
        }
@@ -323,7 +323,7 @@ static int w600_probe(struct flash_bank *bank)
                flash_size = 1 << flash_size;
        }
 
-       LOG_INFO("flash size = %dkbytes", flash_size / 1024);
+       LOG_INFO("flash size = %" PRIu32 "kbytes", flash_size / 1024);
 
        /* calculate numbers of pages */
        size_t num_pages = flash_size / W600_FLASH_SECSIZE;
index ded5e5e34429d6552f66115cd3d9b77375915599..29eef2dc3371790fd25857d13f77b17ff67f6858 100644 (file)
@@ -624,7 +624,7 @@ static int xcf_probe(struct flash_bank *bank)
                        bank->num_sectors = 4;
                        break;
                default:
-                       LOG_ERROR("Unknown flash device ID 0x%X", id);
+                       LOG_ERROR("Unknown flash device ID 0x%" PRIX32, id);
                        return ERROR_FAIL;
        }
 
@@ -640,7 +640,7 @@ static int xcf_probe(struct flash_bank *bank)
        bank->driver_priv = priv;
 
        LOG_INFO("product name: %s", product_name(bank));
-       LOG_INFO("device id = 0x%X ", bank->target->tap->idcode);
+       LOG_INFO("device id = 0x%" PRIX32, bank->target->tap->idcode);
        LOG_INFO("flash size = %d configuration bits",
                bank->num_sectors * XCF_DATA_SECTOR_SIZE * 8);
        LOG_INFO("number of sectors = %u", bank->num_sectors);
index eda1823f9834fa9ea855373ecc7379c80817593e..757dd952f5910d863a0d716cf09c3e4072c86e60 100644 (file)
@@ -253,7 +253,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
 #include "../../../contrib/loaders/flash/xmc1xxx/write.inc"
        };
 
-       LOG_DEBUG("Infineon XMC1000 write at 0x%08" PRIx32 " (%" PRId32 " bytes)",
+       LOG_DEBUG("Infineon XMC1000 write at 0x%08" PRIx32 " (%" PRIu32 " bytes)",
                offset, byte_count);
 
        if (offset & (NVM_BLOCK_SIZE - 1)) {
@@ -262,7 +262,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
        }
        if (byte_count & (NVM_BLOCK_SIZE - 1)) {
-               LOG_WARNING("length %" PRId32 " is not block aligned, rounding up",
+               LOG_WARNING("length %" PRIu32 " is not block aligned, rounding up",
                        byte_count);
        }
 
@@ -306,7 +306,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                uint32_t blocks = MIN(block_count, data_workarea->size / NVM_BLOCK_SIZE);
                uint32_t addr = bank->base + offset;
 
-               LOG_DEBUG("copying %" PRId32 " bytes to SRAM " TARGET_ADDR_FMT,
+               LOG_DEBUG("copying %" PRIu32 " bytes to SRAM " TARGET_ADDR_FMT,
                        MIN(blocks * NVM_BLOCK_SIZE, byte_count),
                        data_workarea->address);
 
@@ -329,7 +329,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
                        }
                }
 
-               LOG_DEBUG("writing 0x%08" PRIx32 "-0x%08" PRIx32 " (%" PRId32 "x)",
+               LOG_DEBUG("writing 0x%08" PRIx32 "-0x%08" PRIx32 " (%" PRIu32 "x)",
                        addr, addr + blocks * NVM_BLOCK_SIZE - 1, blocks);
 
                retval = xmc1xxx_nvm_check_idle(target);
@@ -429,7 +429,7 @@ static int xmc1xxx_get_info_command(struct flash_bank *bank, char *buf, int buf_
        }
        LOG_DEBUG("ID[7] = %08" PRIX32, chipid[7]);
 
-       snprintf(buf, buf_size, "XMC%" PRIx32 "00 %X flash %uKB ROM %uKB SRAM %uKB",
+       snprintf(buf, buf_size, "XMC%" PRIx32 "00 %" PRIX32 " flash %" PRIu32 "KB ROM %" PRIu32 "KB SRAM %" PRIu32 "KB",
                        (chipid[0] >> 12) & 0xff,
                        0xAA + (chipid[7] >> 28) - 1,
                        (((chipid[6] >> 12) & 0x3f) - 1) * 4,

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)