retval = bank->driver->write(bank, buffer, offset, count);
if (retval != ERROR_OK) {
LOG_ERROR(
- "error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32,
+ "error writing to flash at address " TARGET_ADDR_FMT
+ " at offset 0x%8.8" PRIx32,
bank->base,
offset);
}
retval = bank->driver->read(bank, buffer, offset, count);
if (retval != ERROR_OK) {
LOG_ERROR(
- "error reading to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32,
+ "error reading to flash at address " TARGET_ADDR_FMT
+ " at offset 0x%8.8" PRIx32,
bank->base,
offset);
}
/* lookup flash bank by address, bank not found is success, but
* result_bank is set to NULL. */
int get_flash_bank_by_addr(struct target *target,
- uint32_t addr,
+ target_addr_t addr,
bool check,
struct flash_bank **result_bank)
{
}
*result_bank = NULL;
if (check) {
- LOG_ERROR("No flash at address 0x%08" PRIx32, addr);
+ LOG_ERROR("No flash at address " TARGET_ADDR_FMT, addr);
return ERROR_FAIL;
}
return ERROR_OK;
* warning about those additions.
*/
static int flash_iterate_address_range_inner(struct target *target,
- char *pad_reason, uint32_t addr, uint32_t length,
+ char *pad_reason, target_addr_t addr, uint32_t length,
bool iterate_protect_blocks,
int (*callback)(struct flash_bank *bank, int first, int last))
{
struct flash_bank *c;
struct flash_sector *block_array;
- uint32_t last_addr = addr + length; /* first address AFTER end */
+ target_addr_t last_addr = addr + length; /* first address AFTER end */
int first = -1;
int last = -1;
int i;
else if (addr < end && pad_reason) {
/* FIXME say how many bytes (e.g. 80 KB) */
LOG_WARNING("Adding extra %s range, "
- "%#8.8x to %#8.8x",
+ "%#8.8x to " TARGET_ADDR_FMT,
pad_reason,
(unsigned) f->offset,
- (unsigned) addr - 1);
+ addr - 1);
first = i;
} else
continue;
/* invalid start or end address? */
if (first == -1 || last == -1) {
- LOG_ERROR("address range 0x%8.8x .. 0x%8.8x "
- "is not sector-aligned",
- (unsigned) (c->base + addr),
- (unsigned) (c->base + last_addr - 1));
+ LOG_ERROR("address range " TARGET_ADDR_FMT " .. " TARGET_ADDR_FMT
+ " is not sector-aligned",
+ c->base + addr,
+ c->base + last_addr - 1);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
* multiple chips.
*/
static int flash_iterate_address_range(struct target *target,
- char *pad_reason, uint32_t addr, uint32_t length,
+ char *pad_reason, target_addr_t addr, uint32_t length,
bool iterate_protect_blocks,
int (*callback)(struct flash_bank *bank, int first, int last))
{
}
int flash_erase_address_range(struct target *target,
- bool pad, uint32_t addr, uint32_t length)
+ bool pad, target_addr_t addr, uint32_t length)
{
return flash_iterate_address_range(target, pad ? "erase" : NULL,
addr, length, false, &flash_driver_erase);
return flash_driver_protect(bank, 0, first, last);
}
-int flash_unlock_address_range(struct target *target, uint32_t addr, uint32_t length)
+int flash_unlock_address_range(struct target *target, target_addr_t addr,
+ uint32_t length)
{
/* By default, pad to sector boundaries ... the real issue here
* is that our (only) caller *permanently* removes protection,