commit
fb8492a7e5
|
@ -321,6 +321,9 @@ uint64_t adiv5_ap_read_pidr(ADIv5_AP_t *ap, uint32_t addr)
|
|||
* - fails reading outside SYSROM when halted from WFI and
|
||||
* DBGMCU_CR not set.
|
||||
*
|
||||
* E.g. Stm32F0
|
||||
* - fails reading DBGMCU when under reset
|
||||
*
|
||||
* Keep a copy of DEMCR at startup to restore with exit, to
|
||||
* not interrupt tracing initiated by the CPU.
|
||||
*/
|
||||
|
@ -411,17 +414,8 @@ static void adiv5_component_probe(ADIv5_AP_t *ap, uint32_t addr, int recursion,
|
|||
if (addr == 0) /* No rom table on this AP */
|
||||
return;
|
||||
uint32_t cidr = adiv5_ap_read_id(ap, addr + CIDR0_OFFSET);
|
||||
if ((cidr & ~CID_CLASS_MASK) != CID_PREAMBLE) {
|
||||
/* Maybe caused by a not halted CortexM */
|
||||
if ((ap->idr & 0xf) == ARM_AP_TYPE_AHB) {
|
||||
if (!cortexm_prepare(ap))
|
||||
return; /* Halting failed! */
|
||||
/* CPU now halted, read cidr again. */
|
||||
cidr = adiv5_ap_read_id(ap, addr + CIDR0_OFFSET);
|
||||
if ((cidr & ~CID_CLASS_MASK) != CID_PREAMBLE)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#if defined(ENABLE_DEBUG)
|
||||
char indent[recursion + 1];
|
||||
|
||||
|
@ -755,6 +749,9 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
|
|||
extern void efm32_aap_probe(ADIv5_AP_t *);
|
||||
efm32_aap_probe(ap);
|
||||
|
||||
/* Halt the device and release from reset if reset is active!*/
|
||||
if (!ap->apsel && ((ap->idr & 0xf) == ARM_AP_TYPE_AHB))
|
||||
cortexm_prepare(ap);
|
||||
/* Should probe further here to make sure it's a valid target.
|
||||
* AP should be unref'd if not valid.
|
||||
*/
|
||||
|
|
|
@ -377,7 +377,7 @@ bool cortexm_probe(ADIv5_AP_t *ap)
|
|||
target_check_error(t);
|
||||
}
|
||||
#define PROBE(x) \
|
||||
do { if ((x)(t)) {target_halt_resume(t, 0); return true;} else target_check_error(t); } while (0)
|
||||
do { if ((x)(t)) {return true;} else target_check_error(t); } while (0)
|
||||
|
||||
switch (ap->ap_designer) {
|
||||
case AP_DESIGNER_FREESCALE:
|
||||
|
|
|
@ -155,6 +155,11 @@ bool gd32f1_probe(target *t)
|
|||
|
||||
bool stm32f1_probe(target *t)
|
||||
{
|
||||
uint16_t stored_idcode = t->idcode;
|
||||
if ((t->cpuid & CPUID_PARTNO_MASK) == CORTEX_M0)
|
||||
t->idcode = target_mem_read32(t, DBGMCU_IDCODE_F0) & 0xfff;
|
||||
else
|
||||
t->idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xfff;
|
||||
size_t flash_size;
|
||||
size_t block_size = 0x400;
|
||||
switch(t->idcode) {
|
||||
|
@ -227,6 +232,7 @@ bool stm32f1_probe(target *t)
|
|||
block_size = 0x800;
|
||||
break;
|
||||
default: /* NONE */
|
||||
t->idcode = stored_idcode;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue