hosted/stlinkv2.c: Use V2 API to read coreid.

This commit is contained in:
Uwe Bonnes 2020-07-24 15:14:13 +02:00 committed by UweBonnes
parent 696daa8352
commit a392480631
1 changed files with 4 additions and 5 deletions

View File

@ -686,11 +686,10 @@ static int stlink_enter_debug_jtag(bmp_info_t *info)
static uint32_t stlink_read_coreid(void)
{
uint8_t cmd[16] = {STLINK_DEBUG_COMMAND,
STLINK_DEBUG_READCOREID};
uint8_t data[4];
send_recv(info.usb_link, cmd, 16, data, 4);
uint32_t id = data[0] | data[1] << 8 | data[2] << 16 | data[3] << 24;
uint8_t cmd[16] = {STLINK_DEBUG_COMMAND, STLINK_DEBUG_APIV2_READ_IDCODES};
uint8_t data[12];
send_recv(info.usb_link, cmd, 16, data, 12);
uint32_t id = data[4] | data[5] << 8 | data[6] << 16 | data[6] << 24;
DEBUG_INFO("Read Core ID: 0x%08" PRIx32 "\n", id);
return id;
}