Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
434 commits
Select commit Hold shift + click to select a range
27a4297
-f option fix for F4 devices
byq77 Jul 14, 2019
476dcd7
Merge remote-tracking branch 'byq77/byq77-fixes'
florisla Aug 12, 2019
c13b027
docs: Move comment on Python2 setters to within the class
florisla Aug 12, 2019
637d98c
refactor: Split up read_device_details into _id and _uid
florisla Aug 12, 2019
73c44c5
docs: add more context to docstring about F4 oddity
florisla Aug 12, 2019
c67fa38
docs: Mention byq77 as a contributor
florisla Aug 12, 2019
9c73e8b
style(docs): Line length
florisla Aug 12, 2019
ade9748
Merge branch 'cleanup'
florisla Aug 12, 2019
68db5ee
refactor: Simplify detection of reset/boot0 capability
florisla May 13, 2019
a6b166c
fix(docs): Typo
florisla May 13, 2019
634e05f
Merge branch 'simplify-reset-boot0'
florisla Aug 12, 2019
feb0b0d
support for STM32L4 added
Aug 19, 2019
ce08cc1
Added some MCU ids.
stawiski Sep 26, 2019
2a24b6e
Add support for STM32F3
float32 Oct 20, 2019
380bd88
Add STM32G0 to ID
AlexKlimaj Dec 21, 2019
24ecbd9
Attempt to activate bootloader twice
hiviah Dec 21, 2019
5150d4d
clean(style): Blacken using latest black
florisla Dec 31, 2019
a912c76
docs: Add references to STM32L4 manual
florisla Dec 31, 2019
6fc4cf6
Merge branch 'rdaforno/stm32l4'
florisla Dec 31, 2019
4322196
docs: Add reference to RM0091
florisla Dec 31, 2019
3981e69
Merge branch 'new-stm32f0-ids'
florisla Dec 31, 2019
3710b6d
clean: Re-shuffle the STM32F3 IDs a bit
florisla Dec 31, 2019
b6e412b
Merge branch 'float32/stm32f3'
florisla Dec 31, 2019
8863210
Merge remote-tracking branch 'AlexKlimaj/STM32G0'
florisla Dec 31, 2019
0baa51e
clean(style): Reshuffle a bit
florisla Dec 31, 2019
67323f8
Merge branch 'bootloader_retry'
florisla Dec 31, 2019
dc2e552
Release: bump version number from v0.5.0 to v0.5.1-dev
florisla Dec 31, 2019
948d2e0
feat: Include version number in help text
florisla Dec 31, 2019
f9d652b
feat: Add --version argument
florisla Dec 31, 2019
4815c33
Merge branch '24-version'
florisla Dec 31, 2019
116ddb5
docs: Show how to download firmware to file
florisla Dec 31, 2019
1f5d8f8
Merge branch '20-read-example'
florisla Dec 31, 2019
da17ba1
feat: Support Python 3.8
florisla Dec 31, 2019
c8ca2f7
clean(lint)
florisla Dec 31, 2019
81b87a6
Merge branch '35-python-38'
florisla Dec 31, 2019
3abca05
docs: Update release notes
florisla Dec 31, 2019
8c5aad8
Release: bump version number from v0.5.1-dev to v0.5.1
florisla Dec 31, 2019
3f910b9
Release: bump version number from v0.5.1 to v0.5.2-dev
florisla Dec 31, 2019
e1347a2
docs: Mention --version argument in README
florisla Jan 2, 2020
4e020f7
docs: Change stm32loader from Python file to executable
florisla Jan 2, 2020
4f4c784
clean: Stop announcing and testing Python 2
florisla Jan 2, 2020
c9c0ba7
clean: Remove Python-2-isms
florisla Jan 2, 2020
84290e4
Merge branch '37-drop-python-2'
florisla Jan 2, 2020
a1ba069
docs: Describe basic contributor workflow
florisla Jan 2, 2020
64e9366
fix: Also install bump2version as development tool
florisla Jan 2, 2020
497e1f7
Merge branch '36-document-workflow'
florisla Jan 2, 2020
794e8ac
Port argument parsing to argparse
emilazy Jan 16, 2020
126ae5b
Add lookup information for H7 devices; protocol should remain the same
denniszollo Jan 20, 2021
6306d74
Merge pull request #40 from emilazy/use-argparse
florisla Feb 25, 2022
88279c0
feat: Add some unit tests on argument parsing
florisla Feb 25, 2022
3122583
clean(lint)
florisla Feb 25, 2022
2cab218
release: Drop Python 3.4, 3.5 and add 3.9 and 3.10
florisla Feb 27, 2022
802b043
Merge branch 'dzollo/H7_support'
florisla Feb 27, 2022
7501e16
feat: Flush input buffer after MCU reset
florisla Feb 28, 2022
85bc03e
docs: Improve code comments
florisla Feb 28, 2022
c018d70
Merge branch 'feature/flush-after-reset'
florisla Feb 28, 2022
40fb059
fix: Don't limit page count to 256 in extended_erase_memory
florisla Feb 28, 2022
21756b3
docs: Refer to alternative (/similar) tools
florisla Feb 28, 2022
1a496c0
feat: Add metadata for L0 family
florisla Feb 28, 2022
71d93b8
feat: Pass in device_family to the constructor
florisla Feb 28, 2022
18d038c
feat: Derive data_transfer_size and flash_page_size from device_family
florisla Feb 28, 2022
1a9e327
feat: Enable get_flash_size_and_uid also for L0 family
florisla Feb 28, 2022
34fe027
feat: Erase pages individually for L0 family
florisla Feb 28, 2022
db014b2
Merge branch 'feature/discern-l0-f4'
florisla Feb 28, 2022
611d871
docs: Describe GigaDevice tools
florisla Feb 28, 2022
749aca1
docs: Describe how to extend stm32loader
florisla Feb 28, 2022
5247d3d
docs: Show how to install from github
florisla Feb 28, 2022
ad8957a
docs: Describe the various ways to start stm32loader
florisla Feb 28, 2022
b9bc1d4
docs: Drop To Do items which are done
florisla Feb 28, 2022
4b3a86c
docs: Update Python versions
florisla Feb 28, 2022
f71daa2
docs(cosmetic)
florisla Feb 28, 2022
b97e2aa
Merge branch 'feature/more-docs'
florisla Feb 28, 2022
d047a36
docs: Improve comments
florisla Feb 28, 2022
53bc0ee
feat: Raise proper for L0 erase of page >= 256
florisla Feb 28, 2022
2a1f954
feat: Add unit tests for tricky erase and flash_size
florisla Feb 28, 2022
6776c29
feat: Use Tox and Github Actions for CI
florisla Mar 2, 2022
6c2fab7
Merge branch 'feature/github-actions'
florisla Mar 2, 2022
fa7d36e
Release: bump version number from v0.5.2-dev to v0.6.0-dev
florisla Mar 3, 2022
30f6141
Release: bump version number from v0.6.0-dev to v0.6.0
florisla Mar 3, 2022
8e22a86
feat: Add GitHub actions file to run lint
florisla Mar 8, 2022
bc0f46d
Merge branch 'feature/ci-lint'
florisla Mar 8, 2022
9e126b6
clean: Always use 'stm32loader' as the program name
florisla Mar 8, 2022
730db6b
docs: Auto-update the help text in README using cog
florisla Mar 8, 2022
0363f2e
docs: Describe recent changes in README and CHANGELOG
florisla Mar 8, 2022
c766e63
clean: Ignore .tox folder
florisla Mar 8, 2022
647e606
clean: Rename job 'tox' to 'pytest'
florisla Mar 8, 2022
6844fa7
docs(cosmetic): Capitalize help text
florisla Jun 21, 2022
1e1a650
stm32l0 fix
tosmaz Jan 3, 2023
9f508d6
doc: Add comment about special-case L0 mass erase
florisla Oct 9, 2023
1b701d2
Merge branch 'fix/65-stm32l0-erase'
florisla Oct 9, 2023
7a57203
Int fix, and family pass fix to Stm32Bootloader
florisla Oct 9, 2023
b890db2
doc: Add comment
florisla Oct 9, 2023
2a69700
Merge branch 'fix/64-65-parse-hex-int'
florisla Oct 9, 2023
0af1090
fix: Pass device family to Stm32Bootloader
tosmaz Jan 3, 2023
f389326
Merge branch 'fix/pass-device-family'
florisla Oct 9, 2023
43d0a00
feat: Add support for STM32WL
florisla Oct 9, 2023
402c8ca
clean(lint)
florisla Oct 9, 2023
fb4b6ed
dev: Support Python versions 3.9/3.10/3.11
florisla Oct 9, 2023
7fc0d22
doc: Update supported Python versions
florisla Oct 9, 2023
5bf8cbb
doc: Add new contributors
florisla Oct 9, 2023
13068c5
feat: Support BlueNRG-1 and BlueNRG-2
florisla Oct 9, 2023
7c21b4d
feat: Port to flit
florisla Oct 9, 2023
2e9e341
clean(lint)
florisla Oct 9, 2023
2ae257d
release: Bump version to 0.7.0
florisla Oct 9, 2023
261edec
fix: Add description
florisla Oct 9, 2023
f99d628
dev: Update list of supported Python versions
florisla Oct 9, 2023
600aa07
feat: Support uploading hex file
florisla Oct 10, 2023
22799eb
clean: Move argument parsing to separate file
florisla Oct 10, 2023
16a6f04
fix: Install intelhex for testing
florisla Oct 10, 2023
72287a9
feat: Allow to erase a specific region of the flash memory
florisla Oct 10, 2023
3d54467
fix(typo)
florisla Oct 10, 2023
ef01b69
doc: Use long-length arguments in examples
florisla Oct 10, 2023
f99cefa
doc: Describe how to erase a section of memory
florisla Oct 10, 2023
77bfa99
feat: Allow to un-protect flash from readout
florisla Oct 10, 2023
09e8ecc
clean: Avoid duplicates command keys and values
florisla Oct 10, 2023
148efdf
clean(lint)
florisla Oct 10, 2023
a26158d
dev: Port to bump-my-version
florisla Oct 11, 2023
b0aed64
release: Bump version number from v0.6.0 to v0.7.0-dev
florisla Oct 11, 2023
39cd5d4
fix: Configure H7 flash page size and data transfer size
florisla Oct 11, 2023
f2f9a5b
dev: Add 'releasenumber' part to bump config
florisla Oct 11, 2023
99c5f6a
fix: Don't erase when only address or length is known
florisla Oct 11, 2023
71eb788
fix: Use proper double quotes in __version_info__
florisla Oct 11, 2023
a709438
clean: Drop older Python releases from black
florisla Oct 11, 2023
32fef7c
release: Bump version number from v0.7.0-dev0 to v0.7.0-dev1
florisla Oct 11, 2023
8f3b830
fix: Don't rely on address every being None
florisla Oct 12, 2023
1ec7d92
doc: Recommend to use --length with --erase
florisla Oct 12, 2023
df4f1cf
release: Bump version number from v0.7.0-dev1 to v0.7.0-dev2
florisla Oct 12, 2023
03ca1fb
fix: Use correct device IDs for H7 series
florisla Oct 12, 2023
255e571
doc: Use more long-form arguments
florisla Oct 12, 2023
a93005f
dev: Use IntEnum for Reply
florisla Oct 12, 2023
eabb058
doc: Drop since-implemented things from 'Not supported'
florisla Oct 12, 2023
7880348
doc: Update release notes
florisla Oct 12, 2023
97f570c
fix(typo)
florisla Oct 12, 2023
7b34dba
clean(lint)
florisla Oct 12, 2023
252a8aa
release: Bump version number from v0.7.0-dev2 to v0.7.0
florisla Oct 12, 2023
d7addd5
doc: Describe the big bugfix of v0.7.0
florisla Oct 12, 2023
f98f476
fix: Use integer division
florisla Oct 13, 2023
f36b583
release: Bump version number from v0.7.0 to v0.7.1-dev0
florisla Oct 13, 2023
96290b7
clean: Extract method for 'range to pages' calculation
florisla Oct 18, 2023
afd83d0
fix: Print everything to stderr
florisla Oct 18, 2023
c56da3d
clean: Use long-form arguments
florisla Oct 18, 2023
96f59b2
fix: Use correct assert with mock object
ghpzin Aug 10, 2024
b560be9
Add support for STM32G4
XelaRellum Oct 24, 2025
bb8c25a
Add .venv to .gitignore
ademuri Feb 18, 2026
246d9bf
Merge pull request #83 from ademuri/ignore-venv
florisla Feb 18, 2026
8353112
Merge pull request #79 from ghpzin/fix-python3.12-build
florisla Feb 18, 2026
fb1bcaa
Merge pull request #81 from XelaRellum/support_stm32g4
florisla Feb 18, 2026
b2261c6
chore: replace flake8, black and isort with ruff
roli-lpci Feb 25, 2026
9b9c4ef
Merge pull request #86 from roli-lpci/chore/migrate-to-ruff
florisla Feb 27, 2026
539c60e
dev: Port to uv
florisla Feb 27, 2026
1e4811d
doc: Mention uv as alternative to pip
florisla Feb 27, 2026
a3b4468
dev: Use nox-uv too
florisla Feb 27, 2026
4067128
Merge branch 'feat/uv'
florisla Feb 27, 2026
a071bb5
dev: Officially support Python 3.12/3.13/3.14
florisla Feb 27, 2026
88d43de
doc: Add placeholders to changelog
florisla Feb 27, 2026
a6dd222
fix(ci): Make pylint and Tox work again in CI
florisla Feb 27, 2026
1732178
Merge branch 'feat/python-314'
florisla Feb 27, 2026
5fb7bfc
doc: Promote the STM32G4 family as supported
florisla Feb 27, 2026
100223d
doc: Mention stm32isp.py as an alternative tool
florisla Feb 27, 2026
9794dc9
doc: Mention how to update --help info in the README
florisla Feb 27, 2026
a179e7d
dev: Test against PyPy up to 3.11
florisla Feb 27, 2026
6a10cc9
Merge branch 'feat/pypy-311'
florisla Feb 27, 2026
c8fa407
doc: Describe release v0.7.1
florisla Oct 18, 2023
5a0d2aa
Ensure that intelhex is installed before running tests.
ademuri Feb 27, 2026
e1557d5
Apply ruff fixes.
ademuri Feb 27, 2026
59f7715
Fix the paths for ruff and pylint in DEVELOP.md.
ademuri Feb 27, 2026
88be0b4
refactor(bootloader): unify flash size and UID retrieval logic
ademuri Feb 19, 2026
f75668a
Merge pull request #92 from ademuri/hex
florisla Mar 2, 2026
a376237
Merge pull request #94 from ademuri/ruff-format
florisla Mar 2, 2026
69b02b6
Merge pull request #95 from ademuri/ruff-doc
florisla Mar 2, 2026
6b5b0ed
Merge branch 'master' into flash-size
florisla Mar 2, 2026
222c241
Merge pull request #93 from ademuri/flash-size
florisla Mar 2, 2026
b255c72
clean: Drop deprecated FIXMEs
florisla Feb 27, 2026
bedc95c
dev: Print details about erased pages
florisla Mar 2, 2026
8d458e1
doc: Expand changelog for v0.8.0
florisla Mar 2, 2026
92b2f4d
clean: Drop empty file
florisla Feb 27, 2026
9ce7765
dev: Better communicate required page size
florisla Mar 2, 2026
f8d07b0
dev: List tox as dev dependency
florisla Mar 2, 2026
56df080
dev: Add device table based on AN2606
florisla Oct 18, 2023
7e0fcd6
dev: Improve device table based on STM32flash's table
florisla Oct 20, 2023
afccee8
dev: Add BlueNRG and non-STM devices
florisla Oct 19, 2023
5d5247e
dev: Track some device details through their family
florisla Oct 20, 2023
4b70e26
fix: Typo in stm32flash device table
florisla Oct 20, 2023
e2b41e6
dev: Bring device names more in line with STM32flash
florisla Oct 20, 2023
36ae57f
fix: Typo in stm32flash device table
florisla Oct 23, 2023
83a633c
dev: Add flash information
florisla Oct 23, 2023
4037a6f
dev: Extend tests of device table
florisla Oct 23, 2023
730bc7d
dev: Add emulation test
florisla Oct 18, 2023
9189925
dev: Improve emulation
florisla Oct 24, 2023
6edaae0
clean(cosmetic)
florisla Oct 24, 2023
da4f626
dev: Use device table
florisla Oct 24, 2023
052ed97
dev: Add dummy data to bin file
florisla Oct 24, 2023
c8f52a6
clean: Drop unused import
florisla Jan 16, 2024
b005252
dev: Import devices, deviceflag
florisla Jan 17, 2024
bf05cb6
dev: Add devicedetectionerror
florisla Jan 17, 2024
28ddbdf
doc: Add more comments
florisla Jan 17, 2024
798d535
dev: Add errno for flash_size_unknown
florisla Jan 17, 2024
8cce94c
pass in device
florisla Jan 17, 2024
2fc7613
dev: Don't print to stderr
florisla Jan 17, 2024
57053ff
dev: Remember supported_commands for later use
florisla Jan 17, 2024
738e610
dev: Get flash_size, UID also on long-UID devices
florisla Jan 17, 2024
4534003
dev: Add logic to detect device ID
florisla Jan 17, 2024
5b696a7
dev: Be less verbose
florisla Jan 17, 2024
a7fc82c
dev: Add DeviceFlag
florisla Jan 17, 2024
dac555d
dev: Add device family name
florisla Jan 17, 2024
71f3de1
clean: Rename k to kB
florisla Jan 17, 2024
2c717ab
dev: Add device family, bootloader ID address
florisla Jan 17, 2024
31b8b45
dev: Add __repr__
florisla Jan 17, 2024
34a872b
dev: Add BootloaderSerialPeripheral
florisla Jan 17, 2024
0567d0e
dev: Extend device information
florisla Jan 17, 2024
ad90df6
dev: Make devices tests pass
florisla Jan 17, 2024
5cb6fcd
clean(cosmetic)
florisla Jan 17, 2024
e21e661
dev: Add fake to assist testing other code
florisla Jan 17, 2024
95102ad
feat: BlueNRG-LP/LPS support
dbeinder Jan 17, 2024
0d6e2ce
fix(test): Ignore BlueNRG devices
florisla Feb 27, 2026
8d83304
fix(test): Expect 12 bytes to be read for uid
florisla Feb 27, 2026
f804c0c
dev: Expand STM32G4 details
florisla Feb 27, 2026
4425f40
fix: Move to new location
florisla Feb 27, 2026
70f5773
clean(lint)
florisla Feb 27, 2026
13fe1fa
dev: Temporarily disable some tests which need porting to device table
florisla Mar 2, 2026
cb85ccc
Merge branch 'feat/device-table'
florisla Mar 2, 2026
7ff5833
doc: Expand changelog for vnext
florisla Mar 2, 2026
918a167
doc: Move docs into `docs` folder
florisla Mar 2, 2026
4f86ede
fix: Use device table in get_flash_size
florisla Mar 2, 2026
53cec49
clean(lint)
florisla Mar 2, 2026
588c351
dev: Disable some tests which need porting
florisla Mar 2, 2026
42395f9
dev: Add some more device info
florisla Mar 2, 2026
51c6cce
clean(lint)
florisla Mar 3, 2026
aebf74b
dev: Properly update version numbers in __init__.py
florisla Mar 3, 2026
e4cf24e
release: Bump version number from v1.0.0-dev0 to v1.0.0-dev1
florisla Mar 3, 2026
2d94847
fix(doc): Replace lint/test badges
florisla Mar 4, 2026
8e4daff
Add support for write unprotection.
ademuri Mar 4, 2026
2409475
Merge pull request #96 from ademuri/write-protect
florisla Mar 5, 2026
5296698
dev: Use f-string instead of .format()
florisla Mar 5, 2026
57d864b
clean(doc): Drop 'future work' section
florisla Mar 5, 2026
3aff4fd
Add support for write protection.
ademuri Mar 4, 2026
4055c98
fix/expand BlueNRG lineage devices
dbeinder Mar 8, 2026
b8590f2
Merge pull request #97 from ademuri/write-protect-2
florisla Mar 17, 2026
3762ae9
clean: Use __future__ annotations
florisla Mar 17, 2026
c72dc3a
clean(cosmetic)
florisla Mar 17, 2026
22b6396
Merge pull request #98 from dbeinder/nrg_fixes
florisla Mar 17, 2026
b8bb68c
feat(bootloader): update transfer info after detect device
kaidegit Mar 18, 2026
d43a7b0
Merge pull request #101 from kaidegit/pr-fix
florisla Mar 19, 2026
0079cad
clean(cosmetic)
florisla Mar 19, 2026
c859f4f
fix(test): Take page size 2KiB into account for STM32F358xx
florisla Mar 19, 2026
9917ebc
clean(lint)
florisla Mar 19, 2026
bb1c9b7
feat: support gd32vw55x
kaidegit Mar 19, 2026
b63baad
Merge pull request #102 from kaidegit/pr-gd32vw553
florisla Mar 20, 2026
410fc81
fix(test): Ignore GigaDevice parts when comparing devices
florisla Mar 19, 2026
b736df5
clean(lint)
florisla Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lint

on:
- push
- pull_request

defaults:
run:
shell: bash

jobs:
ruff:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.14"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install ruff
run: pip install ruff
- name: Run ruff format check
run: ruff format --check src/stm32loader
- name: Run ruff lint check
run: ruff check src/stm32loader
pylint:
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
python-version:
- "3.14"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install lint dependencies
run: pip install pylint pyserial intelhex
- name: Run pylint
run: pylint src/stm32loader
38 changes: 38 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
- push
- pull_request

defaults:
run:
shell: bash

jobs:
pytest:
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- windows-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "pypy-3.9"
- "pypy-3.10"
- "pypy-3.11"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: pip install tox tox-gh-actions pyserial pytest intelhex
- name: Run setup and tests as defined in tox.ini
run: tox
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build/
dist/
*.egg-info/
.tox/
.venv

__pycache__/
*.py[cod]
.nox/
uv.lock
16 changes: 16 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[FORMAT]
max-line-length=98

[MESSAGES CONTROL]
disable=
fixme, # TO DOs are not errors.
consider-using-f-string, # We're not on Python >= 3.6 yet.

[REPORT]
score=no

[BASIC]
good-names=
i,
e,
namespace,
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: python

matrix:
include:
# Lint using nox on native Python 3.6
- python: "3.6"
env: NOXSESSION="lint"

# Test using nox on native Python 3.5/3.6/3.7/3.8
- python: "3.5"
env: NOXSESSION="tests-3.5"
- python: "3.6"
env: NOXSESSION="tests-3.6"
- python: "3.7"
env: NOXSESSION="tests-3.7"
dist: xenial # necessary for Python 3.7
sudo: required # necessary for Python 3.7
- python: "3.8"
env: NOXSESSION="tests-3.8"
dist: xenial # necessary for Python 3.8
sudo: required # necessary for Python 3.8?

# Test using nox on non-native Python version 3.6
# (nox does not natively run on 3.4)
- python: "3.6"
env: NOXSESSION="tests-3.4"

install:
- pip install --upgrade pip setuptools nox pyserial progress
- pip install .

script: nox --session "$NOXSESSION"
File renamed without changes.
29 changes: 0 additions & 29 deletions README

This file was deleted.

192 changes: 192 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# STM32Loader

[![PyPI package](https://badge.fury.io/py/stm32loader.svg)](https://badge.fury.io/py/stm32loader)
[![Test](https://github.com/florisla/stm32loader/actions/workflows/test.yaml/badge.svg)](https://github.com/florisla/stm32loader/actions/workflows/test.yaml)
[![Lint](https://github.com/florisla/stm32loader/actions/workflows/lint.yaml/badge.svg)](https://github.com/florisla/stm32loader/actions/workflows/lint.yaml)
[![License](https://img.shields.io/pypi/l/stm32loader.svg)](https://pypi.org/project/stm32loader/)
[![Downloads](https://pepy.tech/badge/stm32loader)](https://pepy.tech/project/stm32loader)

Python module to upload or download firmware to / from
ST Microelectronics STM32 microcontrollers over UART.

Also supports ST BlueNRG devices, and the SweetPeas bootloader
for Wiznet W7500.

Compatible with Python version 3.9-3.14 and PyPy 3.10-3.11.


## Run using `uvx`

uvx stm32loader


## Installation with pip

pip install stm32loader

To install the latest development version:

pip install git+https://github.com/florisla/stm32loader.git


## Usage

<!-- [[[cog
import sys
from io import StringIO
import cog
from stm32loader.main import main

sys.stdout = StringIO()

main("--help", avoid_system_exit=True)

cog.out(f"```\n{sys.stdout.getvalue()}```")

sys.stdout.close()
sys.stdout = sys.__stdout__
]]] -->
```
usage: stm32loader [-h] [-e] [-u] [-x] [-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]

Flash firmware to STM32 microcontrollers.

positional arguments:
FILE.BIN File to read from or store to flash.

options:
-h, --help show this help message and exit
-e, --erase Erase the full flash memory or a specific region (support --address and --length). Note: this is required on previously written memory.
-u, --unprotect Unprotect flash from readout.
-x, --protect Protect flash against readout.
-w, --write Write file content to flash.
-v, --verify Verify flash content versus local file (recommended).
-r, --read Read from flash and store in local file.
-l, --length LENGTH Length of read or erase.
-p, --port PORT Serial port (default: $STM32LOADER_SERIAL_PORT).
-b, --baud BAUD Baudrate. (default: 115200)
-a, --address ADDRESS
Target address for read or write. For erase, this is used when you supply --length. (default: 134217728)
-g, --go-address ADDRESS
Start executing from address (0x08000000, usually).
-f, --family FAMILY Device family to read out device UID and flash size; e.g F1 for STM32F1xx. Possible values: F0, F1, F3, F4, F7, H7, L4, L0, G0, G4, NRG. (default: $STM32LOADER_FAMILY).
-V, --verbose Verbose mode.
-q, --quiet Quiet mode.
-s, --swap-rts-dtr Swap RTS and DTR: use RTS for reset and DTR for boot0.
-R, --reset-active-high
Make RESET active high.
-B, --boot0-active-low
Make BOOT0 active low.
-n, --no-progress Don't show progress bar.
-P, --parity {even,none}
Parity: "even" for STM32, "none" for BlueNRG. (default: even)
--version show program's version number and exit

examples:
stm32loader --port COM7 --family F1
stm32loader --erase --write --verify example/main.bin
```
<!-- [[[end]]] -->

## Command-line example

```
stm32loader --port /dev/tty.usbserial-ftCYPMYJ --erase --write --verify somefile.bin
```

This will pre-erase flash, write `somefile.bin` to the flash on the device, and then
perform a verification after writing is finished.

You can skip the `--port` option by configuring environment variable
`STM32LOADER_SERIAL_PORT`.
Similarly, `--family` may be supplied through `STM32LOADER_FAMILY`.

To read out firmware and store it in a file:

```
stm32loader --read --port /dev/cu.usbserial-A5XK3RJT --family F1 --length 0x10000 --address 0x08000000 dump.bin
```


To erase the full device:

```
stm32loader --erase --port /dev/cu.usbserial-A5XK3RJT
```

Or erase only a specific region of the flash:

```
stm32loader --erase --address 0x08000000 --length 0x2000 --port /dev/cu.usbserial-A5XK3RJT
```



## Reference documents

* ST `AN2606`: STM32 microcontroller system memory boot mode
* ST `AN3155`: USART protocol used in the STM32 bootloader
* ST `AN4872`: BlueNRG-1 and BlueNRG-2 UART bootloader protocol


## Acknowledgement

Original Version by Ivan A-R (tuxotronic.org).
Contributions by Domen Puncer, James Snyder, Floris Lambrechts,
Atokulus, sam-bristow, NINI1988, Omer Kilic, Szymon Szantula, rdaforno,
Mikolaj Stawiski, Tyler Coy, Alex Klimaj, Ondrej Mikle, denniszollo,
emilzay, michsens, blueskull, Mattia Maldini, etrommer, jadeaffenjaeger,
tosmaz.

Inspiration for features from:

* Configurable RTS/DTR and polarity, extended erase with pages:
https://github.com/pazzarpj/stm32loader

* Memory unprotect
https://github.com/3drobotics/stm32loader

* Correct checksum calculation for paged erase:
https://github.com/jsnyder/stm32loader/pull/4

* ST BlueNRG chip support
https://github.com/lchish/stm32loader

* Wiznet W7500 chip / SweetPeas custom bootloader support
https://github.com/Sweet-Peas/WiznetLoader


## Alternatives

If you don't need the flexibility of a Python tool, you can take
a look at other similar tools in `ALTERNATIVES.md`.


## Electrically

The below assumes you are connecting an STM32F10x.
For other chips, the serial pins and/or the BOOT0 / BOOT1 values
may differ.

Make the following connections:

- Serial adapter `GND` to MCU `GND`.
- Serial adapter power to MCU power or vice versa (either 3.3 or 5 Volt).
- Note if you're using 5 Volt signaling or 3V3 on the serial adapter.
- Serial `TX` to MCU `RX` (`PA10`).
- Serial `RX` to MCU `TX` (`PA9`).
- Serial `DTR` to MCU `RESET`.
- Serial `RTS` to MCU `BOOT0` (or `BOOT0` to 3.3V).
- MCU `BOOT1` to `GND`.

If either `RTS` or `DTR` are not available on your serial adapter, you'll have to
manually push buttons or work with jumpers.
When given a choice, set `BOOT0` manually high and drive `RESET` through the serial
adapter (it needs to toggle, whereas `BOOT0` does not).


## Not currently supported

* Command-line argument for write protection for some devices (e.g. those with dual-bank flash).
* STM8 devices (ST `UM0560`).
* Other bootloader protocols (e.g. I2C, HEX -> implemented in `stm32flash`).
Loading