Detected while converting 'unsigned' to 'unsigned int'.
Use the correct conversion string for stdint values.
Change-Id: I99f3dff4c64dfd7acf2bddb130b56e9ebe1e6c60
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8477
Tested-by: jenkins
uint32_t bit = parity & 0x0F;
data[word] ^= (0x1) << bit;
- LOG_INFO("Data word %d, bit %d corrected.",
- (unsigned) word,
- (unsigned) bit);
+ LOG_INFO("Data word %" PRIu32 ", bit %" PRIu32 " corrected.",
+ word, bit);
}
}
if (mlc_isr & 0x8) {
if (mlc_isr & 0x40) {
- LOG_ERROR("uncorrectable error detected: 0x%2.2x",
- (unsigned)mlc_isr);
+ LOG_ERROR("uncorrectable error detected: 0x%2.2" PRIx32, mlc_isr);
free(page_buffer);
free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED;
if (mlc_isr & 0x8) {
if (mlc_isr & 0x40) {
- LOG_ERROR("uncorrectable error detected: "
- "0x%2.2x", (unsigned)mlc_isr);
+ LOG_ERROR("uncorrectable error detected: 0x%2.2" PRIx32, mlc_isr);
return ERROR_NAND_OPERATION_FAILED;
}
case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size);
if (argument >= n)
- LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n));
+ LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break;
case AT91C_EFC_FCMD_SFB:
r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Err: %d",
- reg->name, (unsigned)(reg->address), r);
+ LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Err: %d",
+ reg->name, reg->address, r);
}
return r;
}
r = sam3_read_this_reg(chip,
sam3_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Error: %d",
- reg->name, ((unsigned)(reg->address)), r);
+ LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Error: %d",
+ reg->name, reg->address, r);
return r;
}
reg++;
case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size);
if (argument >= n)
- LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n));
+ LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break;
case AT91C_EFC_FCMD_SFB:
r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Err: %d",
- reg->name, (unsigned)(reg->address), r);
+ LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Err: %d",
+ reg->name, reg->address, r);
}
return r;
}
r = sam4_read_this_reg(chip,
sam4_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Error: %d",
- reg->name, ((unsigned)(reg->address)), r);
+ LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Error: %d",
+ reg->name, reg->address, r);
return r;
}
reg++;
uint8_t current_word[CFI_MAX_BUS_WIDTH];
int retval;
- LOG_DEBUG("reading buffer of %i byte at 0x%8.8x",
- (int)count, (unsigned)offset);
+ LOG_DEBUG("reading buffer of %" PRIi32 " byte at 0x%8.8" PRIx32, count, offset);
if (bank->target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
- LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)",
- target_name(target), (unsigned) buffer_size);
+ LOG_DEBUG("retry target_alloc_working_area(%s, size=%" PRIu32 ")",
+ target_name(target), buffer_size);
}
target_write_buffer(target, write_algorithm->address, sizeof(write_code),
target_free_working_area(target, write_algorithm);
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
- LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)",
- target_name(target), (unsigned) buffer_size);
+ LOG_DEBUG("retry target_alloc_working_area(%s, size=%" PRIu32 ")",
+ target_name(target), buffer_size);
}
target_write_buffer(target, write_algorithm->address,
break;
default:
- LOG_WARNING("Could not identify part 0x%02x as a member of the TMS470 family.",
- (unsigned)part_number);
+ LOG_WARNING("Could not identify part 0x%02" PRIx32 " as a member of the TMS470 family.",
+ part_number);
return ERROR_FLASH_OPERATION_FAILED;
}
jtag_tap_add(tap);
LOG_DEBUG("Created Tap: %s @ abs position %u, "
- "irlen %u, capture: 0x%x mask: 0x%x", tap->dotted_name,
+ "irlen %u, capture: 0x%" PRIx32 " mask: 0x%" PRIx32, tap->dotted_name,
tap->abs_chain_position, tap->ir_length,
- (unsigned) tap->ir_capture_value,
- (unsigned) tap->ir_capture_mask);
+ tap->ir_capture_value, tap->ir_capture_mask);
}
void jtag_tap_free(struct jtag_tap *tap)
while (tap) {
uint32_t expected, expected_mask, ii;
- snprintf(expected_id, sizeof(expected_id), "0x%08x",
- (unsigned)((tap->expected_ids_cnt > 0)
- ? tap->expected_ids[0]
- : 0));
+ snprintf(expected_id, sizeof(expected_id), "0x%08" PRIx32,
+ (tap->expected_ids_cnt > 0) ? tap->expected_ids[0] : 0);
if (tap->ignore_version)
expected_id[2] = '*';
(unsigned int)(expected_mask));
for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
- snprintf(expected_id, sizeof(expected_id), "0x%08x",
- (unsigned) tap->expected_ids[ii]);
+ snprintf(expected_id, sizeof(expected_id), "0x%08" PRIx32, tap->expected_ids[ii]);
if (tap->ignore_version)
expected_id[2] = '*';
CHECK_RETVAL(arm11_read_dscr(arm11));
if (!(arm11->dscr & DSCR_HALT_DBG_MODE)) {
- LOG_DEBUG("DSCR %08x", (unsigned) arm11->dscr);
+ LOG_DEBUG("DSCR %08" PRIx32, arm11->dscr);
LOG_DEBUG("Bringing target into debug mode");
arm11->dscr |= DSCR_HALT_DBG_MODE;
registers hold data that was written by one side (CPU or JTAG) and not
read out by the other side.
*/
- LOG_ERROR("wDTR/rDTR inconsistent (DSCR %08x)",
- (unsigned) arm11->dscr);
+ LOG_ERROR("wDTR/rDTR inconsistent (DSCR %08" PRIx32 ")", arm11->dscr);
return ERROR_FAIL;
}
}
while (1) {
CHECK_RETVAL(arm11_read_dscr(arm11));
- LOG_DEBUG("DSCR %08x", (unsigned) arm11->dscr);
+ LOG_DEBUG("DSCR %08" PRIx32, arm11->dscr);
if (arm11->dscr & DSCR_CORE_RESTARTED)
break;
| DSCR_CORE_HALTED;
CHECK_RETVAL(arm11_read_dscr(arm11));
- LOG_DEBUG("DSCR %08x e", (unsigned) arm11->dscr);
+ LOG_DEBUG("DSCR %08" PRIx32 " e", arm11->dscr);
if ((arm11->dscr & mask) == mask)
break;
return retval;
if (address + size * count != r0) {
- LOG_ERROR("Data transfer failed. Expected end "
- "address 0x%08x, got 0x%08x",
- (unsigned) (address + size * count),
- (unsigned) r0);
+ LOG_ERROR("Data transfer failed. Expected end address 0x%08" PRIx32 ", got 0x%08" PRIx32,
+ address + size * count, r0);
if (burst)
LOG_ERROR(
static void arm11_add_debug_inst(struct arm11_common *arm11,
uint32_t inst, uint8_t *flag, tap_state_t state)
{
- JTAG_DEBUG("INST <= 0x%08x", (unsigned) inst);
+ JTAG_DEBUG("INST <= 0x%08" PRIx32, inst);
struct scan_field itr[2];
CHECK_RETVAL(jtag_execute_queue());
if (arm11->dscr != dscr)
- JTAG_DEBUG("DSCR = %08x (OLD %08x)",
- (unsigned) dscr,
- (unsigned) arm11->dscr);
+ JTAG_DEBUG("DSCR = %08" PRIx32 " (OLD %08" PRIx32 ")", dscr, arm11->dscr);
arm11->dscr = dscr;
CHECK_RETVAL(jtag_execute_queue());
- JTAG_DEBUG("DSCR <= %08x (OLD %08x)",
- (unsigned) dscr,
- (unsigned) arm11->dscr);
+ JTAG_DEBUG("DSCR <= %08" PRIx32 " (OLD %08" PRIx32 ")", dscr, arm11->dscr);
arm11->dscr = dscr;
CHECK_RETVAL(jtag_execute_queue());
- JTAG_DEBUG("DTR _data %08x ready %d n_retry %d",
- (unsigned) _data, ready, n_retry);
+ JTAG_DEBUG("DTR _data %08" PRIx32 " ready %d n_retry %d",
+ _data, ready, n_retry);
int64_t then = 0;
CHECK_RETVAL(jtag_execute_queue());
- JTAG_DEBUG("DTR _data %08x ready %d n_retry %d",
- (unsigned) _data, ready, n_retry);
+ JTAG_DEBUG("DTR _data %08" PRIx32 " ready %d n_retry %d",
+ _data, ready, n_retry);
int64_t then = 0;
/* Timeout here so we don't get stuck. */
int i_n = 0;
while (1) {
- JTAG_DEBUG("SC7 <= c%-3d Data %08x %s",
- (unsigned) address_out,
- (unsigned) data_out,
+ JTAG_DEBUG("SC7 <= c%-3" PRIu8 " Data %08" PRIx32 " %s",
+ address_out, data_out,
n_rw ? "write" : "read");
arm11_add_dr_scan_vc(arm11->arm.target->tap, ARRAY_SIZE(chain7_fields),
}
if (!n_rw)
- JTAG_DEBUG("SC7 => Data %08x", (unsigned) data_in);
+ JTAG_DEBUG("SC7 => Data %08" PRIx32, data_in);
if (i > 0) {
if (actions[i - 1].address != address_in)
case 0x08400000:
snprintf(instruction->text, 128, "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
- "\tSRS%s\tSP%s, #%d",
+ "\tSRS%s\tSP%s, #%" PRIu32,
address, opcode,
mode, wback,
- (unsigned)(opcode & 0x1f));
+ opcode & 0x1f);
break;
case 0x08100000:
snprintf(instruction->text, 128, "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
- "\tRFE%s\tr%d%s",
+ "\tRFE%s\tr%" PRIu32 "%s",
address, opcode,
mode,
- (unsigned)((opcode >> 16) & 0xf), wback);
+ (opcode >> 16) & 0xf, wback);
break;
default:
return evaluate_unknown(opcode, address, instruction);
/* halfword pack */
if ((opcode & 0x01f00020) == 0x00800000) {
char *type, *shift;
- unsigned imm = (unsigned) (opcode >> 7) & 0x1f;
+ unsigned int imm = (opcode >> 7) & 0x1f;
if (opcode & (1 << 6)) {
type = "TB";
/* word saturate */
if ((opcode & 0x01a00020) == 0x00a00000) {
char *shift;
- unsigned imm = (unsigned) (opcode >> 7) & 0x1f;
+ unsigned int imm = (opcode >> 7) & 0x1f;
if (opcode & (1 << 6)) {
shift = "ASR";
return evaluate_cdp_mcr_mrc(opcode, address, instruction);
}
- LOG_ERROR("ARM: should never reach this point (opcode=%08x)",
- (unsigned) opcode);
+ LOG_ERROR("ARM: should never reach this point (opcode=%08" PRIx32 ")", opcode);
return -1;
}
buf_set_u32(r->value + 4, 0, 32, value_r1);
r->valid = true;
r->dirty = false;
- LOG_DEBUG("READ: %s, %8.8x, %8.8x", r->name,
- (unsigned) value_r0, (unsigned) value_r1);
+ LOG_DEBUG("READ: %s, %8.8" PRIx32 ", %8.8" PRIx32, r->name, value_r0, value_r1);
}
return retval;
buf_set_u32(r->value, 0, 32, value);
r->valid = true;
r->dirty = false;
- LOG_DEBUG("READ: %s, %8.8x", r->name, (unsigned) value);
+ LOG_DEBUG("READ: %s, %8.8" PRIx32, r->name, value);
}
return retval;
if (retval == ERROR_OK) {
r->dirty = false;
- LOG_DEBUG("WRITE: %s, %8.8x, %8.8x", r->name,
- (unsigned) value_r0, (unsigned) value_r1);
+ LOG_DEBUG("WRITE: %s, %8.8" PRIx32 ", %8.8" PRIx32, r->name, value_r0, value_r1);
}
return retval;
if (retval == ERROR_OK) {
r->dirty = false;
- LOG_DEBUG("WRITE: %s, %8.8x", r->name, (unsigned) value);
+ LOG_DEBUG("WRITE: %s, %8.8" PRIx32, r->name, value);
}
return retval;
}
arm->core_state = state;
- LOG_DEBUG("set CPSR %#8.8x: %s mode, %s state", (unsigned) cpsr,
+ LOG_DEBUG("set CPSR %#8.8" PRIx32 ": %s mode, %s state", cpsr,
arm_mode_name(mode),
arm_state_strings[arm->core_state]);
}
arm->core_state = state;
arm->core_mode = mode;
- LOG_DEBUG("set CPSR %#8.8x: %s mode, %s state", (unsigned) cpsr,
+ LOG_DEBUG("set CPSR %#8.8" PRIx32 ": %s mode, %s state", cpsr,
armv8_mode_name(arm->core_mode),
armv8_state_strings[arm->core_state]);
}
vr += 16 * index_t;
cr += 16 * index_t;
- LOG_DEBUG("A8: bpwp enable, vr %08x cr %08x",
- (unsigned) vr, (unsigned) cr);
+ LOG_DEBUG("A8: bpwp enable, vr %08" PRIx32 " cr %08" PRIx32, vr, cr);
retval = mem_ap_write_atomic_u32(armv8->debug_ap, vr, addr);
if (retval != ERROR_OK)
}
cr += 16 * index_t;
- LOG_DEBUG("A: bpwp disable, cr %08x", (unsigned) cr);
+ LOG_DEBUG("A: bpwp disable, cr %08" PRIx32, cr);
/* clear control register */
return mem_ap_write_atomic_u32(armv8->debug_ap, cr, 0);
vr += 4 * index_t;
cr += 4 * index_t;
- LOG_DEBUG("A: bpwp enable, vr %08x cr %08x",
- (unsigned) vr, (unsigned) cr);
+ LOG_DEBUG("A: bpwp enable, vr %08" PRIx32 " cr %08" PRIx32, vr, cr);
retval = mem_ap_write_atomic_u32(a->armv7a_common.debug_ap,
vr, addr);
}
cr += 4 * index_t;
- LOG_DEBUG("A: bpwp disable, cr %08x", (unsigned) cr);
+ LOG_DEBUG("A: bpwp disable, cr %08" PRIx32, cr);
/* clear control register */
return mem_ap_write_atomic_u32(a->armv7a_common.debug_ap, cr, 0);
target_write_u32(target, comparator->dwt_comparator_address + 8,
comparator->function);
- LOG_TARGET_DEBUG(target, "Watchpoint (ID %d) DWT%d 0x%08x 0x%x 0x%05x",
+ LOG_TARGET_DEBUG(target, "Watchpoint (ID %d) DWT%d 0x%08" PRIx32 " 0x%" PRIx32 " 0x%05" PRIx32,
watchpoint->unique_id, dwt_num,
- (unsigned) comparator->comp,
- (unsigned) comparator->mask,
- (unsigned) comparator->function);
+ comparator->comp, comparator->mask, comparator->function);
return ERROR_OK;
}
unsigned int dwt_num = watchpoint->number;
- LOG_TARGET_DEBUG(target, "Watchpoint (ID %d) DWT%u address: 0x%08x clear",
+ LOG_TARGET_DEBUG(target, "Watchpoint (ID %d) DWT%u address: " TARGET_ADDR_FMT " clear",
watchpoint->unique_id, dwt_num,
- (unsigned) watchpoint->address);
+ watchpoint->address);
if (dwt_num >= cortex_m->dwt_num_comp) {
LOG_TARGET_DEBUG(target, "Invalid DWT Comparator number in watchpoint");
current = 0;
}
- LOG_DEBUG("%s %08X %08X", __func__, current, (unsigned) address);
+ LOG_DEBUG("%s %08X %08" TARGET_PRIXADDR, __func__, current, address);
err = dsp563xx_restore_context(target);
if (err != ERROR_OK)
current = 0;
}
- LOG_DEBUG("%s %08X %08X", __func__, current, (unsigned) address);
+ LOG_DEBUG("%s %08X %08" PRIX32, __func__, current, address);
err = dsp563xx_jtag_debug_request(target);
if (err != ERROR_OK)
err = dsp563xx_once_reg_read(target->tap, 1, DSP563XX_ONCE_OPABFR, &dr_in);
if (err != ERROR_OK)
return err;
- LOG_DEBUG("fetch: %08X", (unsigned) dr_in&0x00ffffff);
+ LOG_DEBUG("fetch: %08" PRIX32, dr_in & 0x00ffffff);
err = dsp563xx_once_reg_read(target->tap, 1, DSP563XX_ONCE_OPABDR, &dr_in);
if (err != ERROR_OK)
return err;
- LOG_DEBUG("decode: %08X", (unsigned) dr_in&0x00ffffff);
+ LOG_DEBUG("decode: %08" PRIX32, dr_in & 0x00ffffff);
err = dsp563xx_once_reg_read(target->tap, 1, DSP563XX_ONCE_OPABEX, &dr_in);
if (err != ERROR_OK)
return err;
- LOG_DEBUG("execute: %08X", (unsigned) dr_in&0x00ffffff);
+ LOG_DEBUG("execute: %08" PRIX32, dr_in & 0x00ffffff);
/* reset trace mode */
err = dsp563xx_once_reg_write(target->tap, 1, DSP563XX_ONCE_OSCR, 0x000000);
etm_reg_add(0x20, jtag_info, reg_cache, arch_info,
etm_core + 1, 1);
etm_get_reg(reg_list + 1);
- etm_ctx->id = buf_get_u32(
- arch_info[1].value, 0, 32);
- LOG_DEBUG("ETM ID: %08x", (unsigned) etm_ctx->id);
+ etm_ctx->id = buf_get_u32(arch_info[1].value, 0, 32);
+ LOG_DEBUG("ETM ID: %08" PRIx32, etm_ctx->id);
bcd_vers = 0x10 + (((etm_ctx->id) >> 4) & 0xff);
} else {
etm_get_reg(etm_sys_config_reg);
config = buf_get_u32(etm_sys_config_reg->value, 0, 32);
- LOG_DEBUG("ETM SYS CONFIG %08x", (unsigned) config);
+ LOG_DEBUG("ETM SYS CONFIG %08" PRIx32, config);
max_port_size = config & 0x7;
if (etm->bcd_vers >= 0x30)
for (t = 0; t < buf_cnt; t++) {
if (data[t] != buffer[t]) {
command_print(CMD,
- "diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
- diffs,
- (unsigned)(t + image.sections[i].base_address),
- data[t],
- buffer[t]);
+ "diff %d address " TARGET_ADDR_FMT ". Was 0x%02" PRIx8 " instead of 0x%02" PRIx8,
+ diffs,
+ t + image.sections[i].base_address,
+ data[t],
+ buffer[t]);
if (diffs++ >= 127) {
command_print(CMD, "More than 128 errors, the rest are not printed.");
free(data);
if (i % line_modulo == 0) {
output_len += snprintf(output + output_len,
sizeof(output) - output_len,
- "0x%8.8x: ",
- (unsigned)(address + (i*size)));
+ "0x%8.8" PRIx32 ": ",
+ address + (i * size));
}
uint32_t value = 0;