kopia lustrzana https://github.com/stlink-org/stlink
Merge branch 'develop' of https://github.com/texane/stlink into develop
commit
5b65b80e1f
|
@ -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 <USB_BUS>:<USB_ADDR>.
|
||||
|
||||
# COMMANDS
|
||||
|
||||
write *FILE* *ADDR*
|
||||
|
|
|
@ -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 <USB_BUS>:<USB_ADDR>.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
|
|
|
@ -17,10 +17,8 @@ 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 STLinkV2 device to use can be specified in the environment
|
||||
variable STLINK_DEVICE on the format <USB_BUS>:<USB_ADDR>.
|
||||
The STLink device to use can be specified using the --serial parameter, or via
|
||||
the environment variable STLINK_DEVICE on the format <USB_BUS>:<USB_ADDR>.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
|
@ -36,12 +34,6 @@ variable STLINK_DEVICE on the format <USB_BUS>:<USB_ADDR>.
|
|||
-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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -285,8 +272,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 `<USB_BUS>:<USB_ADDR>`.
|
||||
The STLink device to use can be specified using the --serial parameter, or via
|
||||
the environment variable STLINK_DEVICE on the format <USB_BUS>:<USB_ADDR>.
|
||||
|
||||
Then, in your project directory, someting like this...
|
||||
(remember, you need to run an _ARM_ gdb, not an x86 gdb)
|
||||
|
|
|
@ -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:
|
||||
stlink_t *sl = NULL;
|
||||
if (serial_specified) {
|
||||
ret = stlink_open_usb(st->logging_level, st->reset, serialnumber);
|
||||
sl = stlink_open_usb(st->logging_level, st->reset, serialnumber);
|
||||
} else {
|
||||
sl = stlink_open_usb(st->logging_level, st->reset, NULL);
|
||||
}
|
||||
else {
|
||||
ret = stlink_open_usb(st->logging_level, st->reset, NULL);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
ret = stlink_v1_open(st->logging_level, st->reset);
|
||||
break;
|
||||
}
|
||||
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 <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 <USB_BUS>:<USB_ADDR>.\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) {
|
||||
|
|
Ładowanie…
Reference in New Issue