[efm32] Use SW-DP IDCODE register for identification

Instead of the Device ID register which isn't constant for EFM32 parts
This commit is contained in:
Richard Meadows 2015-12-01 21:41:08 +00:00
parent fa7cccff23
commit 544e1080a3
1 changed files with 13 additions and 7 deletions

View File

@ -251,12 +251,18 @@ static void efm32_add_flash(target *t, uint32_t addr, size_t length,
char variant_string[40]; char variant_string[40];
bool efm32_probe(target *t) bool efm32_probe(target *t)
{ {
/* Read the extended unique identifier */ /* Read the IDCODE register from the SW-DP */
uint64_t eui = efm32_read_eui(t); ADIv5_AP_t *ap = adiv5_target_ap(t);
uint32_t ap_idcode = ap->dp->idcode;
/* /\* Check top 24 bits of eui are silabs *\/ */ /* Check the idcode is silabs. See AN0062 Section 2.2 */
if (((eui >> 40) & 0xFFFFFF) != EFM32_DI_EUI_SILABS) if (ap_idcode == 0x2BA01477) {
/* Cortex M3, Cortex M4 */
} else if (ap_idcode == 0x0BC11477) {
/* Cortex M0+ */
} else {
return false; return false;
}
/* Read the part number and family */ /* Read the part number and family */
uint16_t part_number = efm32_read_part_number(t); uint16_t part_number = efm32_read_part_number(t);
@ -422,10 +428,10 @@ static bool efm32_cmd_erase_all(target *t)
static bool efm32_cmd_serial(target *t) static bool efm32_cmd_serial(target *t)
{ {
/* Read the extended unique identifier */ /* Read the extended unique identifier */
uint64_t eui = efm32_read_eui(t) & 0xFFFFFFFFFF; uint64_t eui = efm32_read_eui(t);
/* Bottom 40 bits are unique number */ /* 64 bits of unique number */
gdb_outf("Unique Number: 0x%010llx\n", eui); gdb_outf("Unique Number: 0x%016llx\n", eui);
return true; return true;
} }