After installing stm32loader with pip
, it's available as a Python module.
You can execute this with python -m [modulename]
.
python3 -m stm32loader
You can also run stm32loader
without installing it. You do need pyserial
though.
Make sure you are in the root of the repository, or the repository is in PYTHONPATH
.
python3 -m pip install pyserial --user
python3 -m stm32loader
The file main.py
also runs the stm32loader
program when executed.
Make sure the module can be found; add the folder of the repository to PYTHONPATH
.
PYTHONPATH=. python3 stm32loader/main.py
You can use the classes of stm32loader
from a Python script.
Example:
from stm32loader.main import Stm32Loader
loader = Stm32Loader()
loader.configuration.port = "/dev/cu.usbserial-A5XK3RJT"
loader.connect()
loader.stm32.readout_unprotect()
loader.disconnect()