From 15f1c81b08a8109f314157c79416b9f3037220ac Mon Sep 17 00:00:00 2001 From: Guillaume Revaillot Date: Thu, 16 Apr 2020 16:37:19 +0200 Subject: [PATCH 1/3] st-util: remove v1/v2 stlink version stuff, useless --- src/gdbserver/gdb-server.c | 42 ++++++++------------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/gdbserver/gdb-server.c b/src/gdbserver/gdb-server.c index 1c45c25..fdea624 100644 --- a/src/gdbserver/gdb-server.c +++ b/src/gdbserver/gdb-server.c @@ -59,7 +59,6 @@ static const char* current_memory_map = NULL; typedef struct _st_state_t { // things from command line, bleh - int stlink_version; int logging_level; int listen_port; int persistent; @@ -86,21 +85,13 @@ static void cleanup(int signum) { static stlink_t* do_connect(st_state_t *st) { - stlink_t *ret = NULL; - switch (st->stlink_version) { - case 2: - if (serial_specified){ - ret = stlink_open_usb(st->logging_level, st->reset, serialnumber); - } - else { - ret = stlink_open_usb(st->logging_level, st->reset, NULL); - } - break; - case 1: - ret = stlink_v1_open(st->logging_level, st->reset); - break; + stlink_t *sl = NULL; + if (serial_specified) { + sl = stlink_open_usb(st->logging_level, st->reset, serialnumber); + } else { + sl = stlink_open_usb(st->logging_level, st->reset, NULL); } - return ret; + return sl; } @@ -108,8 +99,6 @@ int parse_options(int argc, char** argv, st_state_t *st) { static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"verbose", optional_argument, NULL, 'v'}, - {"stlink_version", required_argument, NULL, 's'}, - {"stlinkv1", no_argument, NULL, '1'}, {"listen_port", required_argument, NULL, 'p'}, {"multi", optional_argument, NULL, 'm'}, {"no-reset", optional_argument, NULL, 'n'}, @@ -123,7 +112,6 @@ int parse_options(int argc, char** argv, st_state_t *st) { " -V, --version\t\tPrint the version\n" " -vXX, --verbose=XX\tSpecify a specific verbosity level (0..99)\n" " -v, --verbose\t\tSpecify generally verbose logging\n" - " -s X, --stlink_version=X\n" "\t\t\tChoose what version of stlink to use, (defaults to 2)\n" " -1, --stlinkv1\tForce stlink version 1\n" " -p 4242, --listen_port=1234\n" @@ -139,7 +127,7 @@ int parse_options(int argc, char** argv, st_state_t *st) { " --serial \n" "\t\t\tUse a specific serial number.\n" "\n" - "The STLINKv2 device to use can be specified in the environment\n" + "The STLINK device to use can be specified in the environment\n" "variable STLINK_DEVICE on the format :.\n" "\n" ; @@ -148,7 +136,7 @@ int parse_options(int argc, char** argv, st_state_t *st) { int option_index = 0; int c; int q; - while ((c = getopt_long(argc, argv, "hv::s:1p:mn", long_options, &option_index)) != -1) { + while ((c = getopt_long(argc, argv, "hv::p:mn", long_options, &option_index)) != -1) { switch (c) { case 0: break; @@ -163,17 +151,6 @@ int parse_options(int argc, char** argv, st_state_t *st) { st->logging_level = DEBUG_LOGGING_LEVEL; } break; - case '1': - st->stlink_version = 1; - break; - case 's': - sscanf(optarg, "%i", &q); - if (q < 0 || q > 2) { - fprintf(stderr, "stlink version %d unknown!\n", q); - exit(EXIT_FAILURE); - } - st->stlink_version = q; - break; case 'p': sscanf(optarg, "%i", &q); if (q < 0) { @@ -225,13 +202,12 @@ int main(int argc, char** argv) { memset(&state, 0, sizeof(state)); // set defaults... - state.stlink_version = 2; state.logging_level = DEFAULT_LOGGING_LEVEL; state.listen_port = DEFAULT_GDB_LISTEN_PORT; state.reset = 1; /* By default, reset board */ parse_options(argc, argv, &state); - printf("st-util %s\n", STLINK_VERSION); + printf("st-util\n"); sl = do_connect(&state); if (sl == NULL) return 1; From ad0e52540e4003f05b7f6fa488e91c1d52c78df2 Mon Sep 17 00:00:00 2001 From: Guillaume Revaillot Date: Wed, 22 Apr 2020 10:57:45 +0200 Subject: [PATCH 2/3] doc: update doc to mention STLINK_DEVICE and --probe parameters if applicable in all man files --- doc/man/st-flash.md | 3 +++ doc/man/st-info.md | 3 +++ doc/man/st-util.md | 5 ++--- doc/tutorial.md | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/man/st-flash.md b/doc/man/st-flash.md index b787e8d..d5565e9 100644 --- a/doc/man/st-flash.md +++ b/doc/man/st-flash.md @@ -20,6 +20,9 @@ You can use this instead of st-util(1) if you prefer, but remember to use the Use hexadecimal format for the *ADDR* and *SIZE*. +The STLink device to use can be specified using the --serial parameter, or via +the environment variable STLINK_DEVICE on the format :. + # COMMANDS write *FILE* *ADDR* diff --git a/doc/man/st-info.md b/doc/man/st-info.md index ca25797..94a4300 100644 --- a/doc/man/st-info.md +++ b/doc/man/st-info.md @@ -11,9 +11,12 @@ st-info - Provides information about connected STLink and STM32 devices # DESCRIPTION + Provides information about connected STLink programmers and STM32 devices: Serial code, OpenOCD hla-serial, flash, page size, sram, chipid, description. +The STLink device to probe can be specified via the environment variable +STLINK_DEVICE on the format :. # OPTIONS diff --git a/doc/man/st-util.md b/doc/man/st-util.md index e622612..3582bc0 100644 --- a/doc/man/st-util.md +++ b/doc/man/st-util.md @@ -18,9 +18,8 @@ If a port number is not specified using the **--listen_port** option, the default **4242** port will be used. Stlink version 2 is used by default unless the option **--stlinkv1** is given. - -The STLinkV2 device to use can be specified in the environment -variable STLINK_DEVICE on the format :. +The STLink device to use can be specified using the --serial parameter, or via +the environment variable STLINK_DEVICE on the format :. # OPTIONS diff --git a/doc/tutorial.md b/doc/tutorial.md index 75e03f1..2ff0188 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -285,8 +285,8 @@ There are a few options: Do not reset board on connection. ``` -The STLINKv2 device to use can be specified in the environment -variable `STLINK_DEVICE` in the format `:`. +The STLink device to use can be specified using the --serial parameter, or via +the environment variable STLINK_DEVICE on the format :. Then, in your project directory, someting like this... (remember, you need to run an _ARM_ gdb, not an x86 gdb) From 5e0fd8b61c81f47f40592f9844b0f4507069137d Mon Sep 17 00:00:00 2001 From: Guillaume Revaillot Date: Wed, 22 Apr 2020 11:00:27 +0200 Subject: [PATCH 3/3] doc: remove stlink version parameter selectors doc and examples --- doc/man/st-util.md | 7 ------- doc/tutorial.md | 25 ++++++------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/doc/man/st-util.md b/doc/man/st-util.md index 3582bc0..9a54fb3 100644 --- a/doc/man/st-util.md +++ b/doc/man/st-util.md @@ -17,7 +17,6 @@ Run the main binary of the local package (src/main.rs). If a port number is not specified using the **--listen_port** option, the default **4242** port will be used. -Stlink version 2 is used by default unless the option **--stlinkv1** is given. The STLink device to use can be specified using the --serial parameter, or via the environment variable STLINK_DEVICE on the format :. @@ -35,12 +34,6 @@ the environment variable STLINK_DEVICE on the format :. -v, \--verbose : Specify generally verbose logging --s *X*, \--stlink_version=*X* -: Choose what version of stlink to use, (defaults to 2) - --1, \--stlinkv1 -: Force stlink version 1 - -p *4242*, \--listen_port=1234 : Set the gdb server listen port. (default port: 4242) diff --git a/doc/tutorial.md b/doc/tutorial.md index 2ff0188..929aa32 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -168,18 +168,14 @@ will help you verify that: - Your arm-none-eabi-gdb is functional - Your board is functional -A GDB server must be started to interact with the STM32. Depending on -the discovery kit you are using, you must run one of the 2 commands: +A GDB server must be started to interact with the STM32 by running +st-util tool : ``` -# STM32VL discovery kit (onboard ST-link) -$> ./st-util --stlinkv1 - -# STM32L or STM32F4 discovery kit (onboard ST-link/V2) -$> ./st-util +$> st-util # Full help for other options (listen port, version) -$> ./st-util --help +$> st-util --help ``` Then, GDB can be used to interact with the kit: @@ -226,16 +222,10 @@ memory, or read arbitary addresses of memory out to a binary file, use the st-flash tool, as shown below: ``` -# stlinkv1 command to read 4096 from flash into out.bin +# stlink command to read 4096 from flash into out.bin $> ./st-flash read out.bin 0x8000000 4096 -# stlinkv2 command -$> ./st-flash read out.bin 0x8000000 4096 - -# stlinkv1 command to write the file in.bin into flash -$> ./st-flash write in.bin 0x8000000 - -# stlinkv2 command +# stlinkv command to write the file in.bin into flash $> ./st-flash write in.bin 0x8000000 ``` @@ -273,9 +263,6 @@ There are a few options: -h, --help Print this help -vXX, --verbose=XX Specify a specific verbosity level (0..99) -v, --verbose Specify generally verbose logging - -s X, --stlink_version=X - Choose what version of stlink to use, (defaults to 2) - -1, --stlinkv1 Force stlink version 1 -p 4242, --listen_port=1234 Set the gdb server listen port. (default port: 4242) -m, --multi