Status: Experimental scaffold. This repo is a starting point for a true Klipper port targeting the Snapmaker 2.0 controller (GD32F105 series). It does not contain vendor code and is intentionally minimal so you can develop the port cleanly.
firmware/mcu: A new MCU target scaffold for Klipper-like firmware bring‑up on GD32F105.firmware/mcu/boards/snapmaker2: Board definition stubs and pinmaps.host/printer_cfg: Starterprinter.cfgfragments for host side Klipper.docs: Bring‑up notes, CAN reverse‑engineering log, and milestones.tools/scripts: Helper scripts for flashing, logging, and probing.- CI: A tiny build check workflow.
- MCU bring‑up: clocks, systick, GPIO, basic timers, UART/USB CDC.
- Motion core: step/dir/timer ISR; endstop sampling; soft PWM.
- Thermals: ADC readout for thermistors; PID for hotend/bed; safety.
- Storage/EEPROM (optional): emulate if needed.
- Fieldbus: CAN driver + Snapmaker toolhead protocol shim (print head first).
- Homing: endstops; axis map; kinematics validation.
- Host link: serial/USB framing compatible with Klipper host.
- Regression: print-path validation; resonance; input shaper integration.
- This repo contains original stubs and notes only; no Snapmaker, Marlin, or Klipper code is copied.
- You must ensure compatibility with GPL/AGPL obligations of projects you integrate later.
# 1) Setup toolchain (arm-none-eabi-gcc, python3)
# 2) Configure target (generates build/.config)
python3 scripts/menuconfig.py
# 3) Build
make -C firmware/mcu
# 4) Flash (example with ST-Link)
scripts/flash_stlink.sh build/gd32f105/snap2-klipper.elfIf you would rather not flash the Snapmaker controller yet, build the firmware with the emulation flag and run it under the xPack QEMU Arm stm32vldiscovery machine. The helper script will launch the emulator and stream UART output to your terminal:
make -C firmware/mcu clean
make -C firmware/mcu EMULATOR=stm32vl
scripts/run_qemu.shSee docs/EMULATION.md for full installation and troubleshooting notes.
- MCU: GD32F105 series (Cortex‑M3). We assume a 72 MHz system clock initially.
- LED pin: provisionally PC13 (common on F1/F105 boards). If your board differs, update
platform_led_set()and CRH setup inclock.c. - UART debug: assumed USART1 on PA9/PA10 at 115200. If you see no logs, try USART2 (PA2/PA3) or confirm with probing.
openocd -f openocd/a350t.cfg -c "program build/gd32f105/snap2-klipper.elf verify reset exit"
# Connect USB‑TTL to PA9 (TX out) and GND; 115200 8N1; expect boot logs and dots.