src/flash/nor/stm32h7x: fix format strings
authorChristopher Head <chead@zaber.com>
Fri, 17 Jul 2020 21:54:46 +0000 (14:54 -0700)
committerTomas Vanek <vanekt@fbl.cz>
Sun, 9 Aug 2020 14:29:45 +0000 (15:29 +0100)
* use proper type codes
* add 0x in front of hex values
* remove some concatenated empty strings

Change-Id: I06a8344d0ed62de7a0f3e2dd8fba69b17eeb3626
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5783
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/flash/nor/stm32h7x.c

index 72bfa5f5e861ef1b58260e64f456f17f0edf0ef1..9f456b29d703466d6b566a6ad40e5487a64520d3 100644 (file)
@@ -262,7 +262,7 @@ static int stm32x_wait_flash_op_queue(struct flash_bank *bank, int timeout)
                        break;
 
                if (timeout-- <= 0) {
-                       LOG_ERROR("wait_flash_op_queue, time out expired, status: 0x%" PRIx32 "", status);
+                       LOG_ERROR("wait_flash_op_queue, time out expired, status: 0x%" PRIx32, status);
                        return ERROR_FAIL;
                }
                alive_sleep(1);
@@ -311,7 +311,7 @@ static int stm32x_unlock_reg(struct flash_bank *bank)
                return retval;
 
        if (ctrl & FLASH_LOCK) {
-               LOG_ERROR("flash not unlocked STM32_FLASH_CRx: %" PRIx32, ctrl);
+               LOG_ERROR("flash not unlocked STM32_FLASH_CRx: 0x%" PRIx32, ctrl);
                return ERROR_TARGET_FAILURE;
        }
        return ERROR_OK;
@@ -342,7 +342,7 @@ static int stm32x_unlock_option_reg(struct flash_bank *bank)
                return retval;
 
        if (ctrl & OPT_LOCK) {
-               LOG_ERROR("options not unlocked STM32_FLASH_OPTCR: %" PRIx32, ctrl);
+               LOG_ERROR("options not unlocked STM32_FLASH_OPTCR: 0x%" PRIx32, ctrl);
                return ERROR_TARGET_FAILURE;
        }
 
@@ -396,7 +396,7 @@ static int stm32x_write_option(struct flash_bank *bank, uint32_t reg_offset, uin
                        break;
 
                if (timeout-- <= 0) {
-                       LOG_ERROR("waiting for OBL launch, time out expired, OPTSR: 0x%" PRIx32 "", status);
+                       LOG_ERROR("waiting for OBL launch, time out expired, OPTSR: 0x%" PRIx32, status);
                        retval = ERROR_FAIL;
                        goto flash_options_lock;
                }
@@ -626,7 +626,7 @@ static int stm32x_write_block(struct flash_bank *bank, const uint8_t *buffer,
                        LOG_ERROR("flash memory write protected");
 
                if ((flash_sr & FLASH_ERROR) != 0) {
-                       LOG_ERROR("flash write failed, FLASH_SR = %08" PRIx32, flash_sr);
+                       LOG_ERROR("flash write failed, FLASH_SR = 0x%08" PRIx32, flash_sr);
                        /* Clear error + EOP flags but report errors */
                        stm32x_write_flash_reg(bank, FLASH_CCR, flash_sr);
                        retval = ERROR_FAIL;
@@ -747,7 +747,7 @@ static int stm32x_probe(struct flash_bank *bank)
        if (retval != ERROR_OK)
                return retval;
 
-       LOG_DEBUG("device id = 0x%08" PRIx32 "", stm32x_info->idcode);
+       LOG_DEBUG("device id = 0x%08" PRIx32, stm32x_info->idcode);
 
        device_id = stm32x_info->idcode & 0xfff;
 
@@ -779,7 +779,7 @@ static int stm32x_probe(struct flash_bank *bank)
                /* read error when device has invalid value, set max flash size */
                flash_size_in_kb = stm32x_info->part_info->max_flash_size_kb;
        } else
-               LOG_INFO("flash size probed value %d", flash_size_in_kb);
+               LOG_INFO("flash size probed value %" PRIu16, flash_size_in_kb);
 
 
 
@@ -830,8 +830,8 @@ static int stm32x_probe(struct flash_bank *bank)
                }
        }
 
-       LOG_INFO("Bank (%u) size is %d kb, base address is 0x%" PRIx32,
-               bank->bank_number, flash_size_in_kb, (uint32_t) bank->base);
+       LOG_INFO("Bank (%u) size is %" PRIu16 " kb, base address is " TARGET_ADDR_FMT,
+               bank->bank_number, flash_size_in_kb, bank->base);
 
        /* if the user sets the size manually then ignore the probed value
         * this allows us to work around devices that have an invalid flash size register value */
@@ -923,7 +923,7 @@ static int stm32x_get_info(struct flash_bank *bank, char *buf, int buf_size)
                                stm32x_info->part_info->device_str, rev_str);
                } else {
                        snprintf(buf, buf_size,
-                                "%s - Rev: unknown (0x%04x)",
+                                "%s - Rev: unknown (0x%04" PRIx16 ")",
                                stm32x_info->part_info->device_str, rev_id);
                }
        } else {
@@ -1100,7 +1100,7 @@ COMMAND_HANDLER(stm32x_handle_option_read_command)
        if (ERROR_OK != retval)
                return retval;
 
-       command_print(CMD, "Option Register: <0x%" PRIx32 "> = 0x%" PRIx32 "",
+       command_print(CMD, "Option Register: <0x%" PRIx32 "> = 0x%" PRIx32,
                        stm32x_get_flash_reg(bank, reg_offset), value);
 
        return retval;