rtkprog
Tool for flashing Realtek RTL87xxx Bluetooth SoCs via UART
Installation / Dependencies
Using uv
$ uv sync
Using pip
$ pip install -r requirements.txt
Essential System Images
Before being able to write and run Zephyr application images, some essential system images (such as Bootloader patches, System patches, and Configuration files) must be programmed in advance, which can be downloaded from Zephyr's hal_realtek repository.
Hardware Setup & Auto-Reset
This tool supports auto-reset via serial RTS / DTR lines. This allows switching between bootloader mode and normal application mode in software without physical interaction with the board (e.g. via buttons / switches / jumpers). For this, the following wiring is required:
| USB-UART Pin | RTL87x2x Pin | Pin Name | Description |
|---|---|---|---|
| RTS | RESET | RESET | Active-low chip-reset input |
| DTR | P0_3 | LOG/BOOT | Boot mode select (low = download mode) |
Usage
./rtkprog.py --help
usage: rtkprog [-h] [-p PORT] [-b BAUD] [-v | -q] COMMAND ...
Tool for programming Realtek RTL87xxx BT SoCs
positional arguments:
COMMAND
write Write binary file(s) to flash (auto-erases required sectors)
read Read flash to file(s)
erase Erase flash sections or entire chip (default)
mac Read or write the MAC address in flash
reset Reset the chip
terminal Reset the chip and open bidirectional connection to serial port
efuse Read eFuse CRC16 status
options:
-h, --help show this help message and exit
-p, --port PORT Serial port (default: /dev/ttyUSB0)
-b, --baud BAUD Baud rate for binary transfer and terminal (default: 921600).
-v Increase verbosity (-v = INFO, -vv = DEBUG)
-q, --quiet Suppress all output below ERROR
Flash Write
One or multiple binaries can be written to different flash locations using the format: -w <ADDRESS,SEEK,FILE>
Optionally, a MAC address can be provided with --mac, which will be patched during flashing. Using --mac auto preserves the existing MAC address. Using this parameter can save a write cycle compared to using rtkprog mac --mac XX:XX:XX:XX:XX:XX when the configuration file is being flashed anyway.
The writing process automatically erases the required flash pages before performing the write operation.
./rtkprog.py -v \
--port /dev/ttyUSB0 \
--baud 921600 \
write \
--mac XX:XX:XX:XX:XX:XX \
-w 0x4001000,0x200,bin/rtl87x2g/configFile_x.x.x.x-hash.bin \
-w 0x4002000,0x200,bin/rtl87x2g/BANK0_boot_patch_MP_release_x.x.x.x_hash.bin \
-w 0x400a000,0x200,bin/rtl87x2g/BANK1_boot_patch_MP_release_x.x.x.x_hash.bin \
-w 0x4012000,0x200,bin/rtl87x2g/OTAHeader_Bank0_x.x.x.x-hash.bin \
-w 0x4013000,0x200,bin/rtl87x2g/BANK0_sys_patch_MP_release_x.x.x.x_hash.bin \
-w 0x401b000,0x200,bin/rtl87x2g/bt_stack_patch_MP_master_x.x.x.x_hash.bin \
-w 0x402d000,0x0,zephyr.bin
Note: For the system images an offset
0x200is used, because they contain a 512 bytes header.
Flash Read
The entire flash memory of the chip can be dumped to a file, or specific sections can be read using the following command, format: <ADDRESS,SIZE,FILE>
./rtkprog.py -v \
--port /dev/ttyUSB0 \
--baud 921600 \
read -r 0x4001000,0x1000,image.bin
Flash Erase
Erases one or multiple regions in flash, format: <ADDRESS,SIZE>
./rtkprog.py -v \
--port /dev/ttyUSB0 \
erase -r 0x4001000,0x1000
Read MAC Address
Read/write the MAC address.
./rtkprog.py -v \
--port /dev/ttyUSB0 \
mac --mac XX:XX:XX:XX:XX:XX
Read eFuse Status
This command can be used to determine if eFuses have been burned (CRC16 = 0xFFFF = not burned).
./rtkprog.py -v \
--port /dev/ttyUSB0 \
efuse
License
This software is released under the Apache-2.0 License.
Metadata
Release files for rtkprog 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rtkprog-0.2.1.tar.gz | 108.5 kB | With provenance | Details for rtkprog-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rtkprog-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for rtkprog-0.2.1-py3-none-any.whl |
Total release size: 223.2 kB
Release files / rtkprog-0.2.1.tar.gz
| Download URL | rtkprog-0.2.1.tar.gz |
|---|---|
| Size | 108.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be9762ff67d763d87158ecd6317a501ee4bf1a6e0a222eedad5ef47c08134d81
|
|
BLAKE2b-256 checksum How to use checksums |
060f946682544e7d6b12e05db8fbbae1524aeac731fbf42513ad806b9c46a841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logRelease files / rtkprog-0.2.1-py3-none-any.whl
| Download URL | rtkprog-0.2.1-py3-none-any.whl |
|---|---|
| Size | 114.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80299513c7f7d1558b1cf684a64c7da32d2031c35608696e8af49928bffc185c
|
|
BLAKE2b-256 checksum How to use checksums |
73459121c652c9ae8c977da0770320b930a94e0aa879e38f7d64d9eceb37debb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logSecurity for rtkprog 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rtkprog-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.