Skip to content

Commit 6306d74

Browse files
authored
Merge pull request florisla#40 from emilazy/use-argparse
Port argument parsing to argparse
2 parents 497e1f7 + 794e8ac commit 6306d74

File tree

2 files changed

+223
-176
lines changed

2 files changed

+223
-176
lines changed

README.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,49 @@ Usage
1919
-----
2020

2121
```
22-
./stm32loader [-hqVewvrsRB] [-l length] [-p port] [-b baud] [-P parity] [-a address] [-g address] [-f family] [file.bin]
23-
--version Show version number and exit
24-
-e Erase (note: this is required on previously written memory)
25-
-u Readout unprotect
26-
-w Write file content to flash
27-
-v Verify flash content versus local file (recommended)
28-
-r Read from flash and store in local file
29-
-l length Length of read
30-
-p port Serial port (default: /dev/tty.usbserial-ftCYPMYJ)
31-
-b baud Baud speed (default: 115200)
32-
-a address Target address (default: 0x08000000)
33-
-g address Start executing from address (0x08000000, usually)
34-
-f family Device family to read out device UID and flash size; e.g F1 for STM32F1xx
35-
36-
-h Print this help text
37-
-q Quiet mode
38-
-V Verbose mode
39-
40-
-s Swap RTS and DTR: use RTS for reset and DTR for boot0
41-
-R Make reset active high
42-
-B Make boot0 active low
43-
-u Readout unprotect
44-
-n No progress: don't show progress bar
45-
-P parity Parity: "even" for STM32 (default), "none" for BlueNRG
22+
usage: stm32loader [-h] [-e] [-u] [-w] [-v] [-r] [-l LENGTH] -p PORT [-b BAUD]
23+
[-a ADDRESS] [-g ADDRESS] [-f FAMILY] [-V] [-q] [-s] [-R]
24+
[-B] [-n] [-P {even,none}] [--version]
25+
[FILE.BIN]
26+
27+
positional arguments:
28+
FILE.BIN file to read from or store to flash
29+
30+
optional arguments:
31+
-h, --help show this help message and exit
32+
-e, --erase erase (note: this is required on previously written
33+
memory)
34+
-u, --unprotect unprotect in case erase fails
35+
-w, --write write file content to flash
36+
-v, --verify verify flash content versus local file (recommended)
37+
-r, --read read from flash and store in local file
38+
-l LENGTH, --length LENGTH
39+
length of read
40+
-p PORT, --port PORT serial port (default: $STM32LOADER_SERIAL_PORT)
41+
-b BAUD, --baud BAUD baudrate (default: 115200)
42+
-a ADDRESS, --address ADDRESS
43+
target address (default: 134217728)
44+
-g ADDRESS, --go-address ADDRESS
45+
start executing from address (0x08000000, usually)
46+
-f FAMILY, --family FAMILY
47+
device family to read out device UID and flash size;
48+
e.g F1 for STM32F1xx (default: $STM32LOADER_FAMILY)
49+
-V, --verbose verbose mode
50+
-q, --quiet quiet mode
51+
-s, --swap-rts-dtr swap RTS and DTR: use RTS for reset and DTR for boot0
52+
-R, --reset-active-high
53+
make reset active high
54+
-B, --boot0-active-low
55+
make boot0 active low
56+
-n, --no-progress don't show progress bar
57+
-P {even,none}, --parity {even,none}
58+
parity: "even" for STM32, "none" for BlueNRG (default:
59+
even)
60+
--version show program's version number and exit
61+
62+
examples:
63+
stm32loader -p COM7 -f F1
64+
stm32loader -e -w -v example/main.bin
4665
```
4766

4867

0 commit comments

Comments
 (0)