From e6823f39def5111ac3b6f8f75c25c5461410f4c5 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sun, 8 Nov 2020 21:24:28 +0100 Subject: [PATCH] Hosted: Print version with "-h" and "-t" option. --- src/platforms/hosted/bmp_remote.c | 7 +++---- src/platforms/hosted/bmp_remote.h | 2 +- src/platforms/hosted/platform.c | 7 +++++-- src/platforms/hosted/stlinkv2.c | 3 ++- src/platforms/pc/cl_utils.c | 6 +++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/platforms/hosted/bmp_remote.c b/src/platforms/hosted/bmp_remote.c index 1238715..b6d97f1 100644 --- a/src/platforms/hosted/bmp_remote.c +++ b/src/platforms/hosted/bmp_remote.c @@ -37,7 +37,7 @@ #include "adiv5.h" -int remote_init(bool verbose) +int remote_init(void) { char construct[REMOTE_MAX_MSG_SIZE]; int c = snprintf(construct, REMOTE_MAX_MSG_SIZE, "%s", REMOTE_START_STR); @@ -49,9 +49,8 @@ int remote_init(bool verbose) c ? (char *)&(construct[1]) : "unknown"); return -1; } - if (verbose) - DEBUG_WARN("Remote is %s\n", &construct[1]); - return 0; + DEBUG_PROBE("Remote is %s\n", &construct[1]); + return 0; } bool remote_target_get_power(void) diff --git a/src/platforms/hosted/bmp_remote.h b/src/platforms/hosted/bmp_remote.h index f7c7dc8..5d135a3 100644 --- a/src/platforms/hosted/bmp_remote.h +++ b/src/platforms/hosted/bmp_remote.h @@ -29,7 +29,7 @@ int platform_buffer_write(const uint8_t *data, int size); int platform_buffer_read(uint8_t *data, int size); -int remote_init(bool verbose); +int remote_init(void); int remote_swdptap_init(swd_proc_t *swd_proc); int remote_jtagtap_init(jtag_proc_t *jtag_proc); bool remote_target_get_power(void); diff --git a/src/platforms/hosted/platform.c b/src/platforms/hosted/platform.c index a0fe774..63313b5 100644 --- a/src/platforms/hosted/platform.c +++ b/src/platforms/hosted/platform.c @@ -36,6 +36,7 @@ #include "ftdi_bmp.h" #include "jlink.h" #include "cmsis_dap.h" +#include "version.h" #define VENDOR_ID_STLINK 0x0483 #define PRODUCT_ID_STLINK_MASK 0xffe0 @@ -302,14 +303,16 @@ void platform_init(int argc, char **argv) } else if (find_debuggers(&cl_opts, &info)) { exit(-1); } - DEBUG_WARN("Using %04x:%04x %s %s %s\n", info.vid, info.pid, info.serial, + DEBUG_INFO("BMP hosted %s\n for ST-Link V2/3, CMSIS_DAP, JLINK and " + "LIBFTDI/MPSSE\n", FIRMWARE_VERSION); + DEBUG_INFO("Using %04x:%04x %s %s\n %s\n", info.vid, info.pid, info.serial, info.manufacturer, info.product); switch (info.bmp_type) { case BMP_TYPE_BMP: if (serial_open(&cl_opts, info.serial)) exit(-1); - remote_init(true); + remote_init(); break; case BMP_TYPE_STLINKV2: if (stlink_init( &info)) diff --git a/src/platforms/hosted/stlinkv2.c b/src/platforms/hosted/stlinkv2.c index 4f18026..1ca7c15 100644 --- a/src/platforms/hosted/stlinkv2.c +++ b/src/platforms/hosted/stlinkv2.c @@ -436,7 +436,8 @@ static void stlink_version(bmp_info_t *info) Stlink.ver_swim = (version >> 0) & 0x3f; } } - DEBUG_INFO("V%dJ%d",Stlink.ver_stlink, Stlink.ver_jtag); + DEBUG_INFO("STLink firmware version: V%dJ%d",Stlink.ver_stlink, + Stlink.ver_jtag); if (Stlink.ver_hw == 30) { DEBUG_INFO("M%dB%dS%d", Stlink.ver_mass, Stlink.ver_bridge, Stlink.ver_swim); } else if (Stlink.ver_hw == 20) { diff --git a/src/platforms/pc/cl_utils.c b/src/platforms/pc/cl_utils.c index b147175..2d6ad36 100644 --- a/src/platforms/pc/cl_utils.c +++ b/src/platforms/pc/cl_utils.c @@ -28,7 +28,7 @@ #include #include #include - +#include "version.h" #include "target.h" #include "target_internal.h" @@ -116,8 +116,8 @@ static void bmp_munmap(struct mmap_data *map) static void cl_help(char **argv, BMP_CL_OPTIONS_t *opt) { DEBUG_WARN("%s for: \n", opt->opt_idstring); - DEBUG_WARN("\tBMP Firmware, ST-Link V2/3, CMSIS_DAP, JLINK and " - "LIBFTDI/MPSSE\n\n"); + DEBUG_WARN("\tBMP hosted %s\n\t\tfor ST-Link V2/3, CMSIS_DAP, JLINK and " + "LIBFTDI/MPSSE\n\n", FIRMWARE_VERSION); DEBUG_WARN("Usage: %s [options]\n", argv[0]); DEBUG_WARN("\t-h\t\t: This help.\n"); DEBUG_WARN("\t-v[bitmask]\t: Increasing verbosity. Bitmask:\n");