CH55x Unit SDK Docker#

Note

Portable SDK for CH552 firmware development using SDCC in Docker containers. Includes a cross-platform command-line tool (spkg) to simplify compilation on both Linux and Windows.

Project Structure#

ch552-docker-sdk/
├── spkg/                   # Standalone CLI build system
│   ├── spkg                # CLI launcher (bash script)
│   ├── Dockerfile          # SDCC-based build environment
│   └── docker-compose.yml  # Container configuration
├── template/               # CH552 example projects
│   └── Blink/              # Blink example (main.c, src/, tools/, Makefile)
└── README.md

Main Features#

  • Unified command-line tool: “spkg” available on Linux and Windows (using Git Bash).

  • No manual installation of SDCC or other toolchains required.

  • Uses Docker containers to provide a completely isolated build environment.

  • Based on a project system with a Makefile, compatible with CH552/CH55x microcontrollers.

  • Includes an example project located in the template/ directory.

Requirements#

Common (All Platforms)#

  • Git

  • Python 3

  • Bash shell

  • Superuser privileges required to run Docker

Note

Running spkg on Linux might require sudo if the user is not part of the docker group. You can add your user with: sudo usermod -aG docker $USER && newgrp docker

Installation#

Clone the repository:

git clone git@github.com:UNIT-Electronics-MX/unit_ch55x_docker_sdk.git
cd ch552-docker-sdk/spkg
chmod +x spkg

(Optional) Install it globally:

Building the Docker Image#

Build the Docker image:

spkg compose

Creating a New Project#

Note

This command will create a new directory with the specified name.

To create a new project, run:

spkg init template/project

Showing Help#

On Linux:

spkg --help

On Windows:

./spkg/spkg.bat --help

Compiling a Project#

On Linux:

spkg -p ./template/Blink

On Windows:

./spkg/spkg.bat -p ./template/Blink

Execute make clean, all, hex, etc.#

On Linux:

spkg -p ./template/Blink clean
spkg -p ./template/Blink all
spkg -p ./template/Blink hex

On Windows:

spkg.bat -p ./template/Blink clean
spkg.bat -p ./template/Blink all
spkg.bat -p ./template/Blink hex

Output#

The compiled binary will be generated at:

template/Blink/build/main.bin

You can flash it using: