stm32f7/h7: Use the DPv2 provided idcode for MCU identification.

This commit is contained in:
Uwe Bonnes 2018-09-10 21:53:39 +02:00 committed by Gareth McMullin
parent 525b90d4e5
commit 8575d3e7a6
2 changed files with 8 additions and 2 deletions

View File

@ -185,7 +185,12 @@ char *stm32f4_get_chip_name(uint32_t idcode)
bool stm32f4_probe(target *t)
{
uint32_t idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xFFF;
ADIv5_AP_t *ap = cortexm_ap(t);
uint32_t idcode;
idcode = (ap->dp->targetid >> 16) & 0xfff;
if (!idcode)
idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xFFF;
if (idcode == ID_STM32F20X) {
/* F405 revision A have a wrong IDCODE, use ARM_CPUID to make the

View File

@ -174,7 +174,8 @@ static void stm32h7_add_flash(target *t,
bool stm32h7_probe(target *t)
{
uint32_t idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xFFF;
ADIv5_AP_t *ap = cortexm_ap(t);
uint32_t idcode = (ap->dp->targetid >> 16) & 0xfff;
if (idcode == ID_STM32H74x) {
/* RM0433 Rev 4 is not really clear, what bits are needed.
* Set all possible relevant bits for now. */