Skip to content

Commit

Permalink
platforms/hosted/jlink: add jlink version to bmp_info_s for version c…
Browse files Browse the repository at this point in the history
…ommand

J-Link version string was being shown on BMDA startup with verbosity, but not when calling the version command, this addresses that
  • Loading branch information
perigoso committed Jul 19, 2023
1 parent dfa9063 commit af8d5d0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/platforms/hosted/jlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ bool jlink_transfer_swd(
return jlink_transfer(clock_cycles, dir, data_in, data_out);
}

static bool jlink_print_version(void)
static bool jlink_get_version(char *const dest, const size_t dest_size)
{
uint8_t len_str[2];
if (jlink_simple_query(JLINK_CMD_GET_VERSION, len_str, sizeof(len_str)) < 0)
return false;
uint8_t version[0x70];
bmda_usb_transfer(info.usb_link, NULL, 0, version, sizeof(version));
version[0x6f] = '\0';
DEBUG_INFO("%s\n", version);
strncpy(dest, (char *)version, dest_size);
return true;
}

Expand Down Expand Up @@ -226,11 +226,6 @@ static bool jlink_print_interfaces(void)
return true;
}

static bool jlink_info(void)
{
return jlink_print_version() && jlink_query_caps() && jlink_query_speed() && jlink_print_interfaces();
}

/*
* Try to claim the debugging interface of a J-Link adaptor.
* On success this copies the endpoint addresses identified into the
Expand Down Expand Up @@ -303,7 +298,15 @@ bool jlink_init(void)
libusb_close(info.usb_link->device_handle);
return false;
}
jlink_info();

jlink_get_version(info.version, sizeof(info.version));

DEBUG_INFO("%s\n", info.version);

jlink_query_caps();
jlink_query_speed();
jlink_print_interfaces();

return true;
}

Expand Down

0 comments on commit af8d5d0

Please sign in to comment.