OpenD8x8 in progress

Open-source replacement firmware for my handheld digital radio, an AnyTone AT‑D878UV II Plus. Firmware is the software that runs on the radio’s chip, and the manufacturer’s is closed. Working from the shipped firmware, I’ve mapped its memory, its update format, how the chip’s pins are wired, and how it talks to its radio and storage chips. My own first firmware builds, with a USB connection; it hasn’t run on the radio yet. The manufacturer’s start-up code (the bootloader) stays, so a bad update can always be undone.

Its memory, mapped

The chip has 1 MiB of program memory. The manufacturer’s firmware fills most of it; mine needs a fraction so far. Everything is drawn to scale, with zoomed views for the small parts.

The chip's program memory · 1 MiB GD32F303VGT6

Manufacturer's firmwareManufacturer
My firmwareMine
Manufacturer's firmwareManufacturer
My firmwareMine
Manufacturer's firmwareManufacturer
My firmwareMine

Working memory (RAM) · 96 KiB

Manufacturer's firmwareManufacturer
Manufacturer's firmwareManufacturer
Manufacturer's firmwareManufacturer

Settings storage (codeplug) · 256 MiB 2 Gbit SPI NAND · addresses as the programming software uses them

CodeplugCodeplug
CodeplugCodeplug
  • Manufacturer's code (closed)
  • My code (open)
  • User data
  • Free
  • Dashed: inferred, not seen directly
  • Faded: end not known
  • Bracket: shown zoomed in (×N)

The chip's program memory · Manufacturer's firmware

Bootloader (start-up code, kept) derived

Runs first on power-up and installs updates. Not redistributed; my firmware sits after it.

Update receiver and installer. Updates never touch it.

Range
0x08000000–0x08003FFF
Size
16 KiB · 16 384 B
Status
closed, not redistributed
Source
docs/02-memory-map.md § MCU address space · GOALS.md § What “fully open” means here · docs/03-flash-and-update.md § The good news

The chip's program memory · Manufacturer's firmware

Manufacturer's firmware observed

The radio's own software, as shipped in update 3.08N. My firmware is built to replace it.

Raw image: no header, no encryption, no signature.

Range
0x08004000–0x080E94E7
Size
917.2 KiB · 939 240 B
Status
closed, to be replaced
Source
docs/02-memory-map.md § MCU address space · docs/00-findings.md § 1 Target confirmed, § 4 Flash budget

The chip's program memory · Manufacturer's firmware

Vector table (start-up addresses) observed

The list of addresses the chip jumps to on start-up and on each interrupt.

76 entries. Code starts at 0x08004130.

Range
0x08004000–0x0800412F
Size
304 B
Status
closed, part of the vendor image
Source
docs/00-findings.md § 2 Processor and memory · docs/02-memory-map.md § Vector table (application)

The chip's program memory · Manufacturer's firmware

Free computed

Program memory the manufacturer's firmware leaves unused.

Unused by the 3.08N image.

Range
0x080E94E8–0x080FFFFF
Size
90.8 KiB · 92 952 B
Status
free
Source
docs/02-memory-map.md § MCU address space · docs/00-findings.md § 4 Flash budget

The chip's program memory · My firmware

Bootloader (start-up code, kept) derived

Runs first on power-up and installs updates. Not redistributed; my firmware sits after it.

Update receiver and installer. Updates never touch it.

Range
0x08000000–0x08003FFF
Size
16 KiB · 16 384 B
Status
closed, not redistributed
Source
docs/02-memory-map.md § MCU address space · GOALS.md § What “fully open” means here · docs/03-flash-and-update.md § The good news

The chip's program memory · My firmware

My firmware observed

My own firmware, built from source. It starts where the manufacturer's did.

USB CDC build. Without USB: 1 592 B.

Range
0x08004000–0x08005892
Size
6.1 KiB · 6 291 B
Status
open source (GPLv2), reproducible build
Source
README.md § Status · GOALS.md § M2 · docs/02-memory-map.md § Linker script consequences

The chip's program memory · My firmware

Free computed

Room left for my firmware to grow.

Left in the 1008 KiB application region.

Range
0x08005893–0x080FFFFF
Size
1 001.9 KiB · 1 025 901 B
Status
free
Source
docs/02-memory-map.md § Linker script consequences · README.md § Status

Working memory (RAM) · Manufacturer's firmware

Preset variables (.data) observed

Variables that start with set values, copied from program memory at power-up.

Initialised variables, copied from flash at boot.

Range
0x20000000–0x2000198B
Size
6.4 KiB · 6 540 B
Status
vendor layout
Source
docs/02-memory-map.md § RAM layout (scatter-load entry 0)

Working memory (RAM) · Manufacturer's firmware

Zeroed variables (.bss) derived

Variables that start at zero; cleared at power-up.

Zeroed at boot, in one block with the stack.

Range
0x2000198C–0x20017007
Size
85.6 KiB · 87 676 B
Status
vendor layout
Source
docs/02-memory-map.md § RAM layout (scatter-load entry 1, stack-limit literal)

Working memory (RAM) · Manufacturer's firmware

Stack derived

Scratch space for start-up and interrupts; grows downward. Tasks keep their own stacks.

Grows down from the initial SP, 0x20017808.

Range
0x20017008–0x20017807
Size
2 KiB · 2 048 B
Status
vendor layout
Source
docs/02-memory-map.md § RAM layout · docs/00-findings.md § 2 Processor and memory

Working memory (RAM) · Manufacturer's firmware

Unknown use unresolved

The docs don't settle what uses these last 2 KiB.

Above the initial SP. The docs leave its use open.

Range
0x20017808–0x20017FFF
Size
2.0 KiB · 2 040 B
Status
unresolved
Source
docs/02-memory-map.md § RAM layout

Settings storage (codeplug) · Codeplug

Channels upstream

Saved channels.

8 KiB islands, one every 256 KiB.

Range
0x00800000–?
Size
extent unknown · drawn to the next known start, 0x01000000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

Zones upstream

Groups of channels.

Extent documented upstream, not here.

Range
0x01000000–?
Size
extent unknown · drawn to the next known start, 0x01040000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

Roaming upstream

Settings for switching between repeaters.

Extent documented upstream, not here.

Range
0x01040000–?
Size
extent unknown · drawn to the next known start, 0x01080000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

Scan lists upstream

Lists of channels the radio scans.

Extent documented upstream, not here.

Range
0x01080000–?
Size
extent unknown · drawn to the next known start, 0x01640000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

SMS upstream

Text messages.

First of two SMS areas.

Range
0x01640000–?
Size
extent unknown · drawn to the next known start, 0x02140000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

SMS upstream

Text messages, second area.

Second of two SMS areas.

Range
0x02140000–?
Size
extent unknown · drawn to the next known start, 0x02480000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

FM upstream

FM settings.

Extent documented upstream, not here.

Range
0x02480000–?
Size
extent unknown · drawn to the next known start, 0x024C0000
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)

Settings storage (codeplug) · Codeplug

5-tone upstream

Settings for 5-tone calling.

Extent documented upstream, not here.

Range
0x024C0000–?
Size
extent unknown · last known start, drawn as a tick
Status
user data; vendor CPS, qdmr and anytone-flash-tools agree
Source
docs/02-memory-map.md § External SPI flash (codeplug)
AT-D878UV II Plus memory regions
RegionSpaceStartEnd SizeEvidenceAboutDetailStatusSource
Bootloader (start-up code, kept) The chip's program memory, Manufacturer's firmware 0x08000000 0x08003FFF 16 KiB · 16 384 B derived Runs first on power-up and installs updates. Not redistributed; my firmware sits after it. Update receiver and installer. Updates never touch it. closed, not redistributed docs/02-memory-map.md § MCU address space · GOALS.md § What “fully open” means here · docs/03-flash-and-update.md § The good news
Manufacturer's firmware The chip's program memory, Manufacturer's firmware 0x08004000 0x080E94E7 917.2 KiB · 939 240 B observed The radio's own software, as shipped in update 3.08N. My firmware is built to replace it. Raw image: no header, no encryption, no signature. closed, to be replaced docs/02-memory-map.md § MCU address space · docs/00-findings.md § 1 Target confirmed, § 4 Flash budget
Vector table (start-up addresses) (in Manufacturer's firmware) The chip's program memory, Manufacturer's firmware 0x08004000 0x0800412F 304 B observed The list of addresses the chip jumps to on start-up and on each interrupt. 76 entries. Code starts at 0x08004130. closed, part of the vendor image docs/00-findings.md § 2 Processor and memory · docs/02-memory-map.md § Vector table (application)
Free The chip's program memory, Manufacturer's firmware 0x080E94E8 0x080FFFFF 90.8 KiB · 92 952 B computed Program memory the manufacturer's firmware leaves unused. Unused by the 3.08N image. free docs/02-memory-map.md § MCU address space · docs/00-findings.md § 4 Flash budget
Bootloader (start-up code, kept) The chip's program memory, My firmware 0x08000000 0x08003FFF 16 KiB · 16 384 B derived Runs first on power-up and installs updates. Not redistributed; my firmware sits after it. Update receiver and installer. Updates never touch it. closed, not redistributed docs/02-memory-map.md § MCU address space · GOALS.md § What “fully open” means here · docs/03-flash-and-update.md § The good news
My firmware The chip's program memory, My firmware 0x08004000 0x08005892 6.1 KiB · 6 291 B observed My own firmware, built from source. It starts where the manufacturer's did. USB CDC build. Without USB: 1 592 B. open source (GPLv2), reproducible build README.md § Status · GOALS.md § M2 · docs/02-memory-map.md § Linker script consequences
Free The chip's program memory, My firmware 0x08005893 0x080FFFFF 1 001.9 KiB · 1 025 901 B computed Room left for my firmware to grow. Left in the 1008 KiB application region. free docs/02-memory-map.md § Linker script consequences · README.md § Status
Preset variables (.data) Working memory (RAM), Manufacturer's firmware 0x20000000 0x2000198B 6.4 KiB · 6 540 B observed Variables that start with set values, copied from program memory at power-up. Initialised variables, copied from flash at boot. vendor layout docs/02-memory-map.md § RAM layout (scatter-load entry 0)
Zeroed variables (.bss) Working memory (RAM), Manufacturer's firmware 0x2000198C 0x20017007 85.6 KiB · 87 676 B derived Variables that start at zero; cleared at power-up. Zeroed at boot, in one block with the stack. vendor layout docs/02-memory-map.md § RAM layout (scatter-load entry 1, stack-limit literal)
Stack Working memory (RAM), Manufacturer's firmware 0x20017008 0x20017807 2 KiB · 2 048 B derived Scratch space for start-up and interrupts; grows downward. Tasks keep their own stacks. Grows down from the initial SP, 0x20017808. vendor layout docs/02-memory-map.md § RAM layout · docs/00-findings.md § 2 Processor and memory
Unknown use Working memory (RAM), Manufacturer's firmware 0x20017808 0x20017FFF 2.0 KiB · 2 040 B unresolved The docs don't settle what uses these last 2 KiB. Above the initial SP. The docs leave its use open. unresolved docs/02-memory-map.md § RAM layout
Channels Settings storage (codeplug), Codeplug 0x00800000 unknown extent unknown · drawn to the next known start, 0x01000000 upstream Saved channels. 8 KiB islands, one every 256 KiB. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
Zones Settings storage (codeplug), Codeplug 0x01000000 unknown extent unknown · drawn to the next known start, 0x01040000 upstream Groups of channels. Extent documented upstream, not here. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
Roaming Settings storage (codeplug), Codeplug 0x01040000 unknown extent unknown · drawn to the next known start, 0x01080000 upstream Settings for switching between repeaters. Extent documented upstream, not here. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
Scan lists Settings storage (codeplug), Codeplug 0x01080000 unknown extent unknown · drawn to the next known start, 0x01640000 upstream Lists of channels the radio scans. Extent documented upstream, not here. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
SMS Settings storage (codeplug), Codeplug 0x01640000 unknown extent unknown · drawn to the next known start, 0x02140000 upstream Text messages. First of two SMS areas. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
SMS Settings storage (codeplug), Codeplug 0x02140000 unknown extent unknown · drawn to the next known start, 0x02480000 upstream Text messages, second area. Second of two SMS areas. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
FM Settings storage (codeplug), Codeplug 0x02480000 unknown extent unknown · drawn to the next known start, 0x024C0000 upstream FM settings. Extent documented upstream, not here. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)
5-tone Settings storage (codeplug), Codeplug 0x024C0000 unknown extent unknown · last known start, drawn as a tick upstream Settings for 5-tone calling. Extent documented upstream, not here. user data; vendor CPS, qdmr and anytone-flash-tools agree docs/02-memory-map.md § External SPI flash (codeplug)

What's known

  • Main chipGD32F303 (Arm Cortex-M4): 1 MiB of program memory, 96 KiB of RAM
  • Operating systemµC/OS-II, a small real-time OS
  • Radio chipSCT3258: runs the digital radio protocol (DMR) and voice encoding
  • UpdatesNot cryptographically signed, only a simple checksum. That is what makes open firmware possible.