Disable ADIv5 timeout while target is running.
This commit is contained in:
parent
d90e10cdba
commit
d8f737fc53
|
@ -92,10 +92,14 @@ static uint32_t adiv5_jtagdp_low_access(ADIv5_DP_t *dp, uint8_t APnDP, uint8_t R
|
|||
|
||||
jtag_dev_write_ir(dp->dev, APnDP?IR_APACC:IR_DPACC);
|
||||
|
||||
int tries = 1000;
|
||||
do {
|
||||
jtag_dev_shift_dr(dp->dev, (uint8_t*)&response, (uint8_t*)&request, 35);
|
||||
ack = response & 0x07;
|
||||
} while(ack == JTAGDP_ACK_WAIT);
|
||||
} while(--tries && (ack == JTAGDP_ACK_WAIT));
|
||||
|
||||
if (dp->allow_timeout && (ack == JTAGDP_ACK_WAIT))
|
||||
return 0;
|
||||
|
||||
if((ack != JTAGDP_ACK_OK)) {
|
||||
/* Fatal error if invalid ACK response */
|
||||
|
|
|
@ -135,8 +135,8 @@ static uint32_t adiv5_swdp_low_access(ADIv5_DP_t *dp, uint8_t APnDP, uint8_t RnW
|
|||
ack = swdptap_seq_in(3);
|
||||
} while(--tries && ack == SWDP_ACK_WAIT);
|
||||
|
||||
if(!tries)
|
||||
PLATFORM_FATAL_ERROR(1);
|
||||
if (dp->allow_timeout && (ack == SWDP_ACK_WAIT))
|
||||
return 0;
|
||||
|
||||
if(ack == SWDP_ACK_FAULT) {
|
||||
dp->fault = 1;
|
||||
|
|
|
@ -584,6 +584,7 @@ cortexm_halt_request(struct target_s *target)
|
|||
{
|
||||
ADIv5_AP_t *ap = adiv5_target_ap(target);
|
||||
|
||||
ap->dp->allow_timeout = false;
|
||||
adiv5_ap_mem_write(ap, CORTEXM_DHCSR,
|
||||
CORTEXM_DHCSR_DBGKEY | CORTEXM_DHCSR_C_HALT | CORTEXM_DHCSR_C_DEBUGEN);
|
||||
}
|
||||
|
@ -596,6 +597,8 @@ cortexm_halt_wait(struct target_s *target)
|
|||
if (!(adiv5_ap_mem_read(ap, CORTEXM_DHCSR) & CORTEXM_DHCSR_S_HALT))
|
||||
return 0;
|
||||
|
||||
ap->dp->allow_timeout = false;
|
||||
|
||||
/* We've halted. Let's find out why. */
|
||||
uint32_t dfsr = adiv5_ap_mem_read(ap, CORTEXM_DFSR);
|
||||
adiv5_ap_mem_write(ap, CORTEXM_DFSR, dfsr); /* write back to reset */
|
||||
|
@ -654,6 +657,7 @@ cortexm_halt_resume(struct target_s *target, bool step)
|
|||
}
|
||||
|
||||
adiv5_ap_mem_write(ap, CORTEXM_DHCSR, dhcsr);
|
||||
ap->dp->allow_timeout = true;
|
||||
}
|
||||
|
||||
static int cortexm_fault_unwind(struct target_s *target)
|
||||
|
|
|
@ -106,6 +106,8 @@ typedef struct ADIv5_DP_s {
|
|||
|
||||
uint32_t idcode;
|
||||
|
||||
bool allow_timeout;
|
||||
|
||||
void (*dp_write)(struct ADIv5_DP_s *dp, uint8_t addr, uint32_t value);
|
||||
uint32_t (*dp_read)(struct ADIv5_DP_s *dp, uint8_t addr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue