-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #526 from Josverl:flash-stm32-ancient-dragon
Add support for flashing STM32 devices using STM32CubeProgrammer CLI on Linux
- Loading branch information
Showing
27 changed files
with
3,588 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from .vendored import pydfu as pydfu | ||
from argparse import Namespace | ||
from pathlib import Path | ||
|
||
|
||
def main(): | ||
print("Hello, DFU!") | ||
dfu_file = Path("/home/jos/projects/micropython/ports/stm32/build-PYBV11/firmware.dfu") | ||
|
||
print("List ANY DFU devices...") | ||
try: | ||
pydfu.list_dfu_devices() | ||
except ValueError as e: | ||
print(f"Insuffient permissions to access usb DFU devices: {e}") | ||
exit(1) | ||
|
||
kwargs = {"idVendor": 0x0483, "idProduct": 0xDF11} | ||
print("List SPECIFIED DFU devices...") | ||
pydfu.list_dfu_devices(**kwargs) | ||
|
||
# Needs to be a list of serial ports | ||
print("Inititialize pydfu...") | ||
pydfu.init(**kwargs) | ||
|
||
# print("Mass erase...") | ||
# pydfu.mass_erase() | ||
|
||
print("Read DFU file...") | ||
elements = pydfu.read_dfu_file(dfu_file) | ||
if not elements: | ||
print("No data in dfu file") | ||
return | ||
print("Writing memory...") | ||
pydfu.write_elements(elements, False, progress=pydfu.cli_progress) | ||
|
||
print("Exiting DFU...") | ||
pydfu.exit_dfu() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
"""centralized configuration for mpflash""" | ||
|
||
import platformdirs | ||
|
||
from typing import List | ||
from pathlib import Path | ||
|
||
|
||
class MPtoolConfig: | ||
"""Centralized configuration for mpflash""" | ||
|
||
quiet: bool = False | ||
ignore_ports: List[str] = [] | ||
firmware_folder: Path = platformdirs.user_downloads_path() / "firmware" | ||
|
||
|
||
config = MPtoolConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.