Browse Source

adiv5.c: Read all CIDR data in one call.

E.g on STM32WXXX AP1 with C2BOOT not set, the AP base registers have valid
values but reading them fails and turns the AP unusable. BMDA reading CIDR
with multiple calls will will loop and finally hang up BMD. Other target
devices may show similar behaviour.
Reading CIDR with a single call allows recovery from in that case and
additional spares target transactions.
pull/1069/head
Uwe Bonnes 2 years ago
committed by Rachel Mant
parent
commit
471ba19a77
  1. 5
      src/target/adiv5.c

5
src/target/adiv5.c

@ -294,9 +294,10 @@ static uint32_t adiv5_mem_read32(ADIv5_AP_t *ap, uint32_t addr)
static uint32_t adiv5_ap_read_id(ADIv5_AP_t *ap, uint32_t addr)
{
uint32_t res = 0;
uint8_t data[16];
adiv5_mem_read(ap, data, addr, sizeof(data));
for (int i = 0; i < 4; i++) {
uint32_t x = adiv5_mem_read32(ap, addr + 4 * i);
res |= (x & 0xff) << (i * 8);
res |= (data[4 * i] << (i * 8));
}
return res;
}

Loading…
Cancel
Save