Skip to content

Commit e4ffe18

Browse files
committed
Relax ID matching for the misc_dev
Detect STM32
1 parent 1f5d6cb commit e4ffe18

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/jtag.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ int Jtag::detectChain(int max_dev)
200200
* GateMate and Efinix Trion T4/T8 devices
201201
*/
202202
if (tmp != 0x20000001)
203-
found = search_and_insert_device_with_idcode(tmp & 0x0fffffff);
203+
found = search_and_insert_device_with_idcode(tmp);
204204
if (!found) /* if masked not found -> search for full */
205205
found = search_and_insert_device_with_idcode(tmp);
206206

@@ -231,7 +231,7 @@ bool Jtag::search_and_insert_device_with_idcode(uint32_t idcode)
231231
if (dev != fpga_list.end())
232232
irlength = dev->second.irlength;
233233
if (irlength == -1) {
234-
auto misc = misc_dev_list.find(idcode);
234+
auto misc = misc_dev_list.find(idcode & MISC_DEV_MASK);
235235
if (misc != misc_dev_list.end())
236236
irlength = misc->second.irlength;
237237
}

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,11 @@ int main(int argc, char **argv)
470470
fpga_list[t].family.c_str(),
471471
fpga_list[t].model.c_str());
472472
printf("\tirlength %d\n", fpga_list[t].irlength);
473-
} else if (misc_dev_list.find(t) != misc_dev_list.end()) {
473+
} else if (misc_dev_list.find(t & MISC_DEV_MASK) != misc_dev_list.end()) {
474474
printf("\tidcode 0x%x\n\ttype %s\n\tirlength %d\n",
475475
t,
476-
misc_dev_list[t].name.c_str(),
477-
misc_dev_list[t].irlength);
476+
misc_dev_list[t & MISC_DEV_MASK].name.c_str(),
477+
misc_dev_list[t & MISC_DEV_MASK].irlength);
478478
}
479479
}
480480
if (args.detect == true) {

src/part.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ typedef struct {
177177
int irlength;
178178
} misc_device;
179179

180+
#define MISC_DEV_MASK 0x0ff00fffU
180181
static std::map <uint32_t, misc_device> misc_dev_list = {
181-
{0x4ba00477, {"ARM cortex A9", 4}},
182-
{0x5ba00477, {"ARM cortex A53", 4}},
183-
{0xfffffffe, {"ZynqMP dummy device", 12}},
182+
{0x0ba00477, {"ADIv5 JTAG-DP port", 4}},
183+
{0x06400041, {"STM32 Device", 4}},
184+
{0x0ff00ffe, {"ZynqMP dummy device", 12}},
184185
};
185186

186187
/* list of JTAG manufacturer ID */

0 commit comments

Comments
 (0)