florisla / stm32loader

Flash firmware to STM32 microcontrollers using Python.
GNU General Public License v3.0
109 stars 53 forks source link

Error when passing address in hex format #64

Closed etrommer closed 1 year ago

etrommer commented 2 years ago

When running the example from the Readme, an error is thrown:

> stm32loader -r -p /dev/ttyUSB1 -f WL -l 0x10000 -a 0x08000000 dump.bin
usage: stm32loader [-h] [-e] [-u] [-w] [-v] [-r] [-l LENGTH] -p PORT [-b BAUD] [-a ADDRESS] [-g ADDRESS] [-f FAMILY] [-V] [-q] [-s] [-R] [-B] [-n] [-P {even,none}] [--version] [FILE.BIN]
stm32loader: error: argument -l/--length: invalid int value: '0x10000'

this is because argparse expects integer arguments to be decimal, not hex.

Discussion and proposed fix: https://stackoverflow.com/questions/25513043/python-argparse-fails-to-parse-hex-formatting-to-int-type

florisla commented 1 year ago

Fixed in 0.6.0