tinyocd 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tinyocd-1.0.0/LICENSE +21 -0
- tinyocd-1.0.0/PKG-INFO +118 -0
- tinyocd-1.0.0/README.md +71 -0
- tinyocd-1.0.0/pyproject.toml +38 -0
- tinyocd-1.0.0/setup.cfg +4 -0
- tinyocd-1.0.0/tinyocd/tinyocd.py +2467 -0
- tinyocd-1.0.0/tinyocd.egg-info/PKG-INFO +118 -0
- tinyocd-1.0.0/tinyocd.egg-info/SOURCES.txt +10 -0
- tinyocd-1.0.0/tinyocd.egg-info/dependency_links.txt +1 -0
- tinyocd-1.0.0/tinyocd.egg-info/entry_points.txt +2 -0
- tinyocd-1.0.0/tinyocd.egg-info/requires.txt +7 -0
- tinyocd-1.0.0/tinyocd.egg-info/top_level.txt +1 -0
tinyocd-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stefan Wagner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tinyocd-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tinyocd
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Programming Tool for STM32, PY32 and SAMD Microcontrollers via CMSIS-DAP, ST-Link or J-Link
|
|
5
|
+
Author-email: Stefan Wagner <wagiminator@web.de>
|
|
6
|
+
Maintainer-email: Stefan Wagner <wagiminator@web.de>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2026 Stefan Wagner
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://wagiminator.github.io/
|
|
30
|
+
Project-URL: Repository, https://github.com/wagiminator/MCU-Flash-Tools
|
|
31
|
+
Project-URL: Issues, https://github.com/wagiminator/MCU-Flash-Tools/issues
|
|
32
|
+
Keywords: SWD,ARM,Cortex-M,STM32,PY32,PUYA,SAMD,ATSAMD21,CMSIS-DAP,DAPLink,ST-Link,J-Link,microcontroller
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Intended Audience :: Developers
|
|
38
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
39
|
+
Requires-Python: >=3.8
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Requires-Dist: pyusb
|
|
43
|
+
Requires-Dist: libusb-package; platform_system == "Windows"
|
|
44
|
+
Provides-Extra: hid
|
|
45
|
+
Requires-Dist: hidapi; extra == "hid"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# Programming Tool for STM32, PY32 and SAMD Microcontrollers via CMSIS-DAP, ST-Link or J-Link
|
|
49
|
+
## Description
|
|
50
|
+
tinyOCD is a simple programming tool for ARM Cortex-M microcontrollers using the SWD interface. It works with CMSIS-DAP v1 (HID) and v2 (bulk) programmers (e.g. DAPLink, Raspberry Pi Debug Probe), ST-Link V2, V2-1 and V3 as well as SEGGER J-Link. Programmer and chip are detected automatically. The flash memory is programmed by a small generic flash loader that runs in the RAM of the target.
|
|
51
|
+
|
|
52
|
+
Supported microcontrollers:
|
|
53
|
+
- STM32: C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L4+, L5, U0, U3, U5, WB, WBA, WL
|
|
54
|
+
- PUYA: PY32F002A, PY32F003, PY32F030, PY32F002B, PY32F071, PY32F072 (and compatible, e.g. AIR001)
|
|
55
|
+
- Microchip/ATMEL: ATSAMD09, ATSAMD10, ATSAMD11, ATSAMD20, ATSAMD21, ATSAMDA1, ATSAML21, ATSAML22, ATSAMC20, ATSAMC21, ATSAMD51, ATSAME51, ATSAME53, ATSAME54
|
|
56
|
+
|
|
57
|
+
Functions:
|
|
58
|
+
- write BIN file to flash and verify (with chip erase)
|
|
59
|
+
- chip erase
|
|
60
|
+
- remove/set read protection (unlock/lock)
|
|
61
|
+
- make BOOT0 pin usable for the embedded bootloader (STM32C0/F0/F3/G0/G4/L4/L5/U0/U5/WB/WL, PY32F0xx/F07x)
|
|
62
|
+
- configure NRST pin as GPIO or reset pin (STM32C0/G0/G4/U0, PY32)
|
|
63
|
+
|
|
64
|
+
## Preparations
|
|
65
|
+
Linux users need permission to access the programmer. Run:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", MODE="666"' | sudo tee /etc/udev/rules.d/99-tinyocd.rules
|
|
69
|
+
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1366", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-tinyocd.rules
|
|
70
|
+
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-tinyocd.rules
|
|
71
|
+
echo 'KERNEL=="hidraw*", ATTRS{idVendor}=="0d28", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-tinyocd.rules
|
|
72
|
+
sudo udevadm control --reload-rules
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Add further lines for the vendor IDs of other CMSIS-DAP programmers (e.g. 2e8a, c251, 1a86).
|
|
76
|
+
|
|
77
|
+
On Windows, ST-Link (with ST driver) and CMSIS-DAP v2 (WinUSB) normally work out of the box. A J-Link must use the WinUSB driver (J-Link Configurator: "Use WinUSB") or a libusb driver installed with [Zadig](https://zadig.akeo.ie/). For CMSIS-DAP v1 (HID) programmers on Windows and macOS, install hidapi: `pip install tinyocd[hid]`.
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
Ensure that the [prerequisites](https://packaging.python.org/en/latest/tutorials/installing-packages/) for installing Python packages are met. Then execute the following command in the command line:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
pip install tinyocd
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
Connect the programmer to your PC and to the SWD interface of the MCU (SWDIO, SWCLK, GND, optionally NRST and VCC).
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Usage: tinyocd [-h] [-p {auto,cmsis-dap,stlink,jlink}] [-s SPEED] [-u] [-l] [-e] [-B] [-G] [-R] [-f FLASH] [-t]
|
|
91
|
+
|
|
92
|
+
Optional arguments:
|
|
93
|
+
-h, --help show help message and exit
|
|
94
|
+
-p, --probe select programmer type (default: auto)
|
|
95
|
+
-s SPEED, --speed SPEED SWD clock in kHz (default: 1000)
|
|
96
|
+
-u, --unlock unlock chip (remove read protection, erases chip)
|
|
97
|
+
-l, --lock lock chip (set read protection)
|
|
98
|
+
-e, --erase perform a whole chip erase (implied with -f)
|
|
99
|
+
-B, --bootpin make BOOT0 pin usable for embedded bootloader
|
|
100
|
+
-G, --pingpio make NRST pin a GPIO pin
|
|
101
|
+
-R, --pinreset make NRST pin a reset pin
|
|
102
|
+
-f FLASH, --flash FLASH write BIN file to flash and verify
|
|
103
|
+
-t, --list list supported chips
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
tinyocd -f firmware.bin
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Notes:
|
|
110
|
+
- The BIN file is written to the start of the flash memory (0x08000000 for STM32/PY32, 0x00000000 for SAMD).
|
|
111
|
+
- If the chip cannot be halted (e.g. SWD pins disabled by the firmware), tinyOCD connects under reset. For this, NRST must be connected to the programmer.
|
|
112
|
+
- On SAMD chips, a bootloader protected by the BOOTPROT fuse cannot be overwritten. A chip erase (-e) does not clear the BOOTPROT fuse.
|
|
113
|
+
- With -B the BOOT0 pin is enabled via option bytes. On STM32C0/G0 the BOOT0 pin is shared with SWCLK (PA14).
|
|
114
|
+
|
|
115
|
+
## Links
|
|
116
|
+
- [MCU Flash Tools](https://github.com/wagiminator/MCU-Flash-Tools)
|
|
117
|
+
- [MCU Templates](https://github.com/wagiminator/MCU-Templates)
|
|
118
|
+
- [MCU Development Boards](https://github.com/wagiminator/Development-Boards)
|
tinyocd-1.0.0/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Programming Tool for STM32, PY32 and SAMD Microcontrollers via CMSIS-DAP, ST-Link or J-Link
|
|
2
|
+
## Description
|
|
3
|
+
tinyOCD is a simple programming tool for ARM Cortex-M microcontrollers using the SWD interface. It works with CMSIS-DAP v1 (HID) and v2 (bulk) programmers (e.g. DAPLink, Raspberry Pi Debug Probe), ST-Link V2, V2-1 and V3 as well as SEGGER J-Link. Programmer and chip are detected automatically. The flash memory is programmed by a small generic flash loader that runs in the RAM of the target.
|
|
4
|
+
|
|
5
|
+
Supported microcontrollers:
|
|
6
|
+
- STM32: C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L4+, L5, U0, U3, U5, WB, WBA, WL
|
|
7
|
+
- PUYA: PY32F002A, PY32F003, PY32F030, PY32F002B, PY32F071, PY32F072 (and compatible, e.g. AIR001)
|
|
8
|
+
- Microchip/ATMEL: ATSAMD09, ATSAMD10, ATSAMD11, ATSAMD20, ATSAMD21, ATSAMDA1, ATSAML21, ATSAML22, ATSAMC20, ATSAMC21, ATSAMD51, ATSAME51, ATSAME53, ATSAME54
|
|
9
|
+
|
|
10
|
+
Functions:
|
|
11
|
+
- write BIN file to flash and verify (with chip erase)
|
|
12
|
+
- chip erase
|
|
13
|
+
- remove/set read protection (unlock/lock)
|
|
14
|
+
- make BOOT0 pin usable for the embedded bootloader (STM32C0/F0/F3/G0/G4/L4/L5/U0/U5/WB/WL, PY32F0xx/F07x)
|
|
15
|
+
- configure NRST pin as GPIO or reset pin (STM32C0/G0/G4/U0, PY32)
|
|
16
|
+
|
|
17
|
+
## Preparations
|
|
18
|
+
Linux users need permission to access the programmer. Run:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", MODE="666"' | sudo tee /etc/udev/rules.d/99-tinyocd.rules
|
|
22
|
+
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1366", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-tinyocd.rules
|
|
23
|
+
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-tinyocd.rules
|
|
24
|
+
echo 'KERNEL=="hidraw*", ATTRS{idVendor}=="0d28", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-tinyocd.rules
|
|
25
|
+
sudo udevadm control --reload-rules
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Add further lines for the vendor IDs of other CMSIS-DAP programmers (e.g. 2e8a, c251, 1a86).
|
|
29
|
+
|
|
30
|
+
On Windows, ST-Link (with ST driver) and CMSIS-DAP v2 (WinUSB) normally work out of the box. A J-Link must use the WinUSB driver (J-Link Configurator: "Use WinUSB") or a libusb driver installed with [Zadig](https://zadig.akeo.ie/). For CMSIS-DAP v1 (HID) programmers on Windows and macOS, install hidapi: `pip install tinyocd[hid]`.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
Ensure that the [prerequisites](https://packaging.python.org/en/latest/tutorials/installing-packages/) for installing Python packages are met. Then execute the following command in the command line:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install tinyocd
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
Connect the programmer to your PC and to the SWD interface of the MCU (SWDIO, SWCLK, GND, optionally NRST and VCC).
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Usage: tinyocd [-h] [-p {auto,cmsis-dap,stlink,jlink}] [-s SPEED] [-u] [-l] [-e] [-B] [-G] [-R] [-f FLASH] [-t]
|
|
44
|
+
|
|
45
|
+
Optional arguments:
|
|
46
|
+
-h, --help show help message and exit
|
|
47
|
+
-p, --probe select programmer type (default: auto)
|
|
48
|
+
-s SPEED, --speed SPEED SWD clock in kHz (default: 1000)
|
|
49
|
+
-u, --unlock unlock chip (remove read protection, erases chip)
|
|
50
|
+
-l, --lock lock chip (set read protection)
|
|
51
|
+
-e, --erase perform a whole chip erase (implied with -f)
|
|
52
|
+
-B, --bootpin make BOOT0 pin usable for embedded bootloader
|
|
53
|
+
-G, --pingpio make NRST pin a GPIO pin
|
|
54
|
+
-R, --pinreset make NRST pin a reset pin
|
|
55
|
+
-f FLASH, --flash FLASH write BIN file to flash and verify
|
|
56
|
+
-t, --list list supported chips
|
|
57
|
+
|
|
58
|
+
Example:
|
|
59
|
+
tinyocd -f firmware.bin
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Notes:
|
|
63
|
+
- The BIN file is written to the start of the flash memory (0x08000000 for STM32/PY32, 0x00000000 for SAMD).
|
|
64
|
+
- If the chip cannot be halted (e.g. SWD pins disabled by the firmware), tinyOCD connects under reset. For this, NRST must be connected to the programmer.
|
|
65
|
+
- On SAMD chips, a bootloader protected by the BOOTPROT fuse cannot be overwritten. A chip erase (-e) does not clear the BOOTPROT fuse.
|
|
66
|
+
- With -B the BOOT0 pin is enabled via option bytes. On STM32C0/G0 the BOOT0 pin is shared with SWCLK (PA14).
|
|
67
|
+
|
|
68
|
+
## Links
|
|
69
|
+
- [MCU Flash Tools](https://github.com/wagiminator/MCU-Flash-Tools)
|
|
70
|
+
- [MCU Templates](https://github.com/wagiminator/MCU-Templates)
|
|
71
|
+
- [MCU Development Boards](https://github.com/wagiminator/Development-Boards)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tinyocd"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Programming Tool for STM32, PY32 and SAMD Microcontrollers via CMSIS-DAP, ST-Link or J-Link"
|
|
9
|
+
keywords = ["SWD", "ARM", "Cortex-M", "STM32", "PY32", "PUYA", "SAMD", "ATSAMD21", "CMSIS-DAP", "DAPLink", "ST-Link", "J-Link", "microcontroller"]
|
|
10
|
+
dependencies = ["pyusb", "libusb-package; platform_system == 'Windows'"]
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name="Stefan Wagner", email="wagiminator@web.de" },
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name="Stefan Wagner", email="wagiminator@web.de" },
|
|
17
|
+
]
|
|
18
|
+
readme = "README.md"
|
|
19
|
+
license = {file = "LICENSE"}
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 4 - Beta",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Topic :: Software Development :: Embedded Systems",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
hid = ["hidapi"]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
tinyocd = "tinyocd.tinyocd:_main"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://wagiminator.github.io/"
|
|
37
|
+
Repository = "https://github.com/wagiminator/MCU-Flash-Tools"
|
|
38
|
+
Issues = "https://github.com/wagiminator/MCU-Flash-Tools/issues"
|
tinyocd-1.0.0/setup.cfg
ADDED