# weactstudio/weactstudio.ch552coreboard architecture

> Architecture diagram of the GitHub repository weactstudio/weactstudio.ch552coreboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/weactstudio/weactstudio.ch552coreboard
- Repository: https://github.com/weactstudio/weactstudio.ch552coreboard

## Overview

#### Purpose
This is a hardware enablement and firmware-development package for the WeAct CH552 core board, based on WCH CH552/CH554 8-bit microcontrollers. It combines board documentation, vendor datasheets, sample firmware for multiple toolchains, and USB bootloader programming tools.

#### Hardware and Reference Boundary
Board-specific design artifacts define the physical target; MCU behavior is supplied by WCH documentation. Engineers should use:
- `HDK/WeAct-CH55xCoreBoard-V10 SchDoc.pdf`
- `HDK/WeAct-CH55xCoreBoard-V10 Board Shape.pdf`
- `Datasheet/CH552DS1_en.PDF`

These files are the boundary between firmware assumptions (pins, clocks, USB) and the actual core-board hardware.

#### Firmware Entry Points
The repository provides independent example projects rather than one deployable application:
- Keil blink: `SDK/01-KeilExample/01-Blink/App/main.c`
- Keil RTX Tiny2 example: `SDK/01-KeilExample/02-RtxTiny2/App/main.c`
- Arduino sketches: `SDK/02-ArduinoExample/01-Blink/01-Blink.ino`, `SDK/02-ArduinoExample/02-PWMFading/02-PWMFading.ino`
- SDCC blink: `SDK/03-SDCCExample/01-Blink/App/main.c`

An engineer selects one toolchain/project family, modifies its application entry point, builds firmware, then flashes the resulting image to the board.

#### Keil Firmware Stack
Keil projects package application code with CH5xx device support and optional RTOS configuration:
- `SDK/01-KeilExample/01-Blink/Blink.uvproj`
- `SDK/01-KeilExample/01-Blink/CH5xx/ch552.h`
- `SDK/01-KeilExample/02-RtxTiny2/RtxTiny2/CONF_TNY.A51`

The application layer accesses MCU registers and platform services through `ch552.h`; debug and in-application programming support are included alongside each project. RTX Tiny2 adds a scheduler/runtime configuration layer above the hardware support package.

#### SDCC Firmware Stack
The SDCC example is a Makefile-based C firmware layout, suitable for command-line builds:
- `SDK/03-SDCCExample/01-Blink/Makefile`
- `SDK/03-SDCCExample/01-Blink/App/main.c`
- `SDK/03-SDCCExample/01-Blink/include/ch552.h`

Its shared include layer exposes MCU definitions plus peripheral modules for ADC, I2C, SPI, PWM, touch keys, USB, debugging, and bootloader interactions. Application code and timing logic are separated in `App/main.c` and `App/time.c`.

#### Build Artifacts and Flashing Flow
Build outputs are pre-generated firmware images, demonstrating expected deployment formats:
- `SDK/01-KeilExample/01-Blink/Objects/Blink.hex`
- `SDK/03-SDCCExample/01-Blink/01-Blink.hex`
- `SDK/03-SDCCExample/01-Blink/01-Blink.bin`

Flashing targets the MCU’s USB bootloader. Windows users can use `Tools/WCHISPTool_Setup.exe` with the bundled WCH bootloader driver under `Tools/WCH_Bootloader_Driver/`. A browser-oriented alternative is `Tools/bootloaderWebtool/index.html`, driven by `Tools/bootloaderWebtool/ch55xbl.js`; its USB access depends on compatible browser/host USB support and potentially Zadig-installed drivers.

#### External and Vendor Dependencies
The repository depends on WCH’s CH552/CH554 silicon, USB bootloader protocol, device drivers, and vendor example bundles:
- `SDK/04-WCH_EVT/CH552EVT.ZIP`
- `SDK/04-WCH_EVT/CH554EVT.ZIP`
- `Tools/bootloaderWebtool/ch55xbl.js`

Supported development runtimes are Keil C51, Arduino-compatible CH552 tooling, and SDCC. No backend service, network API, or persistent application data layer is present.

Main entry points: [`Datasheet/CH552DS1_en.PDF`](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Datasheet/CH552DS1_en.PDF) (CH552 datasheet), [`HDK/WeAct-CH55xCoreBoard-V10 SchDoc.pdf`](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/HEAD/HDK/WeAct-CH55xCoreBoard-V10%20SchDoc.pdf) (Core-board schematic), [`SDK/01-KeilExample/01-Blink/App/main.c`](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/App/main.c) (Keil Blink entry), [`SDK/03-SDCCExample/01-Blink/App/main.c`](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/App/main.c) (SDCC Blink entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hardware["Hardware & reference"]
  node_board_design["Core-board schematic<br/>hardware design"]
  node_board_shape["Board outline<br/>mechanical reference"]
  node_mcu_datasheet["CH552 datasheet<br/>vendor reference<br/>[CH552DS1_en.PDF]"]
end

subgraph group_keil["Keil firmware"]
  node_keil_blink_project["Keil Blink project<br/>Keil project<br/>[Blink.uvproj]"]
  node_keil_blink_app["Keil Blink entry<br/>C entry point<br/>[main.c]"]
  node_keil_device_support["CH5xx device support<br/>MCU header<br/>[ch552.h]"]
  node_rtx_app["RTX Tiny2 entry<br/>C entry point<br/>[main.c]"]
  node_rtx_config["RTX Tiny2 config<br/>RTOS configuration<br/>[CONF_TNY.A51]"]
end

subgraph group_sdcc["SDCC firmware"]
  node_sdcc_makefile["SDCC build<br/>Makefile"]
  node_sdcc_app["SDCC Blink entry<br/>C entry point<br/>[main.c]"]
  node_sdcc_support["SDCC peripheral support<br/>MCU include layer<br/>[ch552.h]"]
end

subgraph group_deployment["Build & flashing"]
  node_keil_hex["Keil firmware image<br/>Intel HEX<br/>[Blink.hex]"]
  node_sdcc_images["SDCC firmware images<br/>HEX and binary<br/>[01-Blink.hex]"]
  node_usb_bootloader{{"CH552 USB bootloader<br/>MCU bootloader"}}
  node_wchisp["WCHISP Tool<br/>Windows flasher"]
  node_bootloader_driver["WCH bootloader driver<br/>USB driver<br/>[SETUP.EXE]"]
  node_web_flasher["Browser flasher<br/>WebUSB tool<br/>[index.html]"]
  node_web_bootloader_lib["Web bootloader library<br/>JavaScript protocol client<br/>[ch55xbl.js]"]
end

node_arduino_blink["Arduino Blink sketch<br/>Arduino entry point<br/>[01-Blink.ino]"]
node_arduino_pwm["Arduino PWM sketch<br/>Arduino entry point<br/>[02-PWMFading.ino]"]
node_vendor_evt["WCH vendor examples<br/>vendor example bundles<br/>[CH552EVT.ZIP]"]

node_board_design -.->|"defines target for"| node_keil_blink_app
node_board_design -.->|"defines target for"| node_sdcc_app
node_board_shape -->|"documents form factor"| node_board_design
node_mcu_datasheet -.->|"specifies MCU"| node_board_design
node_mcu_datasheet -.->|"informs definitions"| node_keil_device_support
node_mcu_datasheet -.->|"informs definitions"| node_sdcc_support
node_keil_blink_project -->|"builds"| node_keil_blink_app
node_keil_blink_app -->|"uses"| node_keil_device_support
node_keil_blink_project -->|"produces"| node_keil_hex
node_rtx_app -->|"uses"| node_keil_device_support
node_rtx_app -->|"runs with"| node_rtx_config
node_arduino_blink -.->|"flashed to"| node_usb_bootloader
node_arduino_pwm -.->|"flashed to"| node_usb_bootloader
node_sdcc_makefile -->|"builds"| node_sdcc_app
node_sdcc_app -->|"uses"| node_sdcc_support
node_sdcc_makefile -->|"produces"| node_sdcc_images
node_keil_hex -->|"flashed through"| node_usb_bootloader
node_sdcc_images -->|"flashed through"| node_usb_bootloader
node_wchisp -->|"uses"| node_bootloader_driver
node_wchisp -->|"programs"| node_usb_bootloader
node_web_flasher -->|"uses"| node_web_bootloader_lib
node_web_flasher -->|"programs"| node_usb_bootloader
node_vendor_evt -.->|"targets"| node_mcu_datasheet

click node_board_design "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/HDK/WeAct-CH55xCoreBoard-V10 SchDoc.pdf"
click node_board_shape "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/HDK/WeAct-CH55xCoreBoard-V10 Board Shape.pdf"
click node_mcu_datasheet "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Datasheet/CH552DS1_en.PDF"
click node_keil_blink_project "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/Blink.uvproj"
click node_keil_blink_app "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/App/main.c"
click node_keil_device_support "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/CH5xx/ch552.h"
click node_rtx_app "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/02-RtxTiny2/App/main.c"
click node_rtx_config "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/02-RtxTiny2/RtxTiny2/CONF_TNY.A51"
click node_arduino_blink "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/02-ArduinoExample/01-Blink/01-Blink.ino"
click node_arduino_pwm "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/02-ArduinoExample/02-PWMFading/02-PWMFading.ino"
click node_sdcc_makefile "https://github.com/weactstudio/weactstudio.ch552coreboard/tree/master/SDK/03-SDCCExample/01-Blink/Makefile"
click node_sdcc_app "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/App/main.c"
click node_sdcc_support "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/include/ch552.h"
click node_keil_hex "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/Objects/Blink.hex"
click node_sdcc_images "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/01-Blink.hex"
click node_wchisp "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/WCHISPTool_Setup.exe"
click node_bootloader_driver "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/WCH_Bootloader_Driver/SETUP.EXE"
click node_web_flasher "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/bootloaderWebtool/index.html"
click node_web_bootloader_lib "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/bootloaderWebtool/ch55xbl.js"
click node_vendor_evt "https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/04-WCH_EVT/CH552EVT.ZIP"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_board_design,node_board_shape,node_mcu_datasheet toneBlue
class node_keil_blink_project,node_keil_blink_app,node_keil_device_support,node_rtx_app,node_rtx_config toneAmber
class node_sdcc_makefile,node_sdcc_app,node_sdcc_support toneMint
class node_keil_hex,node_sdcc_images,node_usb_bootloader,node_wchisp,node_bootloader_driver,node_web_flasher,node_web_bootloader_lib toneRose
class node_arduino_blink,node_arduino_pwm,node_vendor_evt toneNeutral
```

## Components

### Hardware & reference

Physical board and vendor MCU contract.

- [Core-board schematic](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/HEAD/HDK/WeAct-CH55xCoreBoard-V10%20SchDoc.pdf): hardware design · `HDK/WeAct-CH55xCoreBoard-V10 SchDoc.pdf`
- [Board outline](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/HEAD/HDK/WeAct-CH55xCoreBoard-V10%20Board%20Shape.pdf): mechanical reference · `HDK/WeAct-CH55xCoreBoard-V10 Board Shape.pdf`
- [CH552 datasheet](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Datasheet/CH552DS1_en.PDF): vendor reference · Defines MCU pins, clocks, peripherals, and USB behavior. · `Datasheet/CH552DS1_en.PDF`

### Keil firmware

Keil C51 example projects and device stack.

- [Keil Blink project](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/Blink.uvproj): Keil project · `SDK/01-KeilExample/01-Blink/Blink.uvproj`
- [Keil Blink entry](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/App/main.c): C entry point · `SDK/01-KeilExample/01-Blink/App/main.c`
- [CH5xx device support](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/CH5xx/ch552.h): MCU header · Register and platform definitions used by Keil applications. · `SDK/01-KeilExample/01-Blink/CH5xx/ch552.h`
- [RTX Tiny2 entry](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/02-RtxTiny2/App/main.c): C entry point · `SDK/01-KeilExample/02-RtxTiny2/App/main.c`
- [RTX Tiny2 config](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/02-RtxTiny2/RtxTiny2/CONF_TNY.A51): RTOS configuration · Adds scheduler/runtime configuration to the Keil example. · `SDK/01-KeilExample/02-RtxTiny2/RtxTiny2/CONF_TNY.A51`

### SDCC firmware

Command-line C firmware example.

- [SDCC build](https://github.com/weactstudio/weactstudio.ch552coreboard/tree/master/SDK/03-SDCCExample/01-Blink/Makefile): Makefile · `SDK/03-SDCCExample/01-Blink/Makefile`
- [SDCC Blink entry](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/App/main.c): C entry point · Application and timing logic are separated in this project. · `SDK/03-SDCCExample/01-Blink/App/main.c`
- [SDCC peripheral support](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/include/ch552.h): MCU include layer · Provides MCU definitions and peripheral modules, including USB and bootloader support. · `SDK/03-SDCCExample/01-Blink/include/ch552.h`

### Build & flashing

Firmware images and USB bootloader tools.

- [Keil firmware image](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/01-KeilExample/01-Blink/Objects/Blink.hex): Intel HEX · `SDK/01-KeilExample/01-Blink/Objects/Blink.hex`
- [SDCC firmware images](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/03-SDCCExample/01-Blink/01-Blink.hex): HEX and binary · Command-line build produces deployable HEX and BIN formats. · `SDK/03-SDCCExample/01-Blink/01-Blink.hex`
- **CH552 USB bootloader**: MCU bootloader · Receives firmware images over USB.
- [WCHISP Tool](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/WCHISPTool_Setup.exe): Windows flasher · `Tools/WCHISPTool_Setup.exe`
- [WCH bootloader driver](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/WCH_Bootloader_Driver/SETUP.EXE): USB driver · `Tools/WCH_Bootloader_Driver/SETUP.EXE`
- [Browser flasher](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/bootloaderWebtool/index.html): WebUSB tool · Browser USB access may require compatible host drivers. · `Tools/bootloaderWebtool/index.html`
- [Web bootloader library](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/Tools/bootloaderWebtool/ch55xbl.js): JavaScript protocol client · `Tools/bootloaderWebtool/ch55xbl.js`

### Other components

- [Arduino Blink sketch](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/02-ArduinoExample/01-Blink/01-Blink.ino): Arduino entry point · `SDK/02-ArduinoExample/01-Blink/01-Blink.ino`
- [Arduino PWM sketch](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/02-ArduinoExample/02-PWMFading/02-PWMFading.ino): Arduino entry point · `SDK/02-ArduinoExample/02-PWMFading/02-PWMFading.ino`
- [WCH vendor examples](https://github.com/weactstudio/weactstudio.ch552coreboard/blob/master/SDK/04-WCH_EVT/CH552EVT.ZIP): vendor example bundles · Reference bundles for CH552 and CH554 devices. · `SDK/04-WCH_EVT/CH552EVT.ZIP`

## Connections

- Core-board schematic → Keil Blink entry: defines target for
- Core-board schematic → SDCC Blink entry: defines target for
- Board outline → Core-board schematic: documents form factor
- CH552 datasheet → Core-board schematic: specifies MCU
- CH552 datasheet → CH5xx device support: informs definitions
- CH552 datasheet → SDCC peripheral support: informs definitions
- Keil Blink project → Keil Blink entry: builds
- Keil Blink entry → CH5xx device support: uses
- Keil Blink project → Keil firmware image: produces
- RTX Tiny2 entry → CH5xx device support: uses
- RTX Tiny2 entry → RTX Tiny2 config: runs with
- Arduino Blink sketch → CH552 USB bootloader: flashed to
- Arduino PWM sketch → CH552 USB bootloader: flashed to
- SDCC build → SDCC Blink entry: builds
- SDCC Blink entry → SDCC peripheral support: uses
- SDCC build → SDCC firmware images: produces
- Keil firmware image → CH552 USB bootloader: flashed through
- SDCC firmware images → CH552 USB bootloader: flashed through
- WCHISP Tool → WCH bootloader driver: uses
- WCHISP Tool → CH552 USB bootloader: programs
- Browser flasher → Web bootloader library: uses
- Browser flasher → CH552 USB bootloader: programs
- WCH vendor examples → CH552 datasheet: targets
