Skip to content
karstxPublic

About

A keyboard firmware for sinowealth-8051-based devices

Topics

Resources

Stars

148 stars

Watchers

9 watching

Forks

Repository files navigation

SMK

SMK - Small (device) Mechanical Keyboard Firmware

Build

This is a keyboard firmware targeting SinoWealth 8051-based devices.

The S (Small) in SMK comes from this firmware using SDCC to build itself.

⚠️ WARNING ⚠️

You can very easily end up with a bricked device if the written firmware can't jump back into ISP mode, so before testing or modifying it, it's best to have a full dump of your stock firmware and a programming tool that can write it back.

SMK ships its own ISP bootloader, which takes that failure mode away: holding S + M + K while plugging the board in gets you into ISP mode whatever the firmware above it does. It has to go in over the programming interface once, and from then on the device is recoverable without opening the case.

Supported Devices

Keyboard MCU Wireless Extra Details
NuPhy Air60 v1 SH68F90A / BYK916 2.4G, BT (BDR+BLE) Details
E-YOOSO Z11 SH68F90A / BYK901 N/A Details
Genesis Thor 300 SH68F881 / BYK801 N/A Details
CIY X77 SH68F89 / BYK816 N/A External 24Cxx EEPROM Details

Programming Tools

Tool Hardware Interface Notes
sinowisp None, just USB ISP Writes the application through the board's ISP bootloader (stock or SMK's). Cannot write to the bootloader region, so it can't recover a board whose bootloader is gone or unreachable.
sinodude + sinodude-serial Arduino Nano (ATmega328P/PB) ICP Open source. Reads and writes the whole flash, including the bootloader. Used by the *_full_flash targets by default.
sinodude + SinoLink SinoWealth SinoLink dongle ICP Same as above, through the vendor's dongle. Select it with -Dicp_programmer=sinolink.
ProWriter + SinoLink SinoWealth SinoLink dongle ICP SinoWealth's own Windows tool. Write <board>_<layout>_full.hex with it.

Also: ISP bootloader. Platform notes: SH68F90 / SH68F90A, SH68F881, SH68F89.

Developing

Prerequisites

Nix

Currently, this project is primarily developed with the help of Nix and Nix flakes. Please consider using Nix and the provided flake to automatically set up a reproducible development environment.

With Nix installed and flakes enabled, use nix develop or direnv to enter a shell with all prerequisites installed.

Building & Flashing

Once all prerequisites are set up, you can build and flash firmware for a specific combination of keyboard and layout using the following commands:

meson setup build # configure meson build dir
meson compile -C build nuphy-air60_default_smk.hex # build firmware for nuphy-air60 with the default layout
meson compile -C build nuphy-air60_default_flash # write firmware to the device via sinowisp

The same build produces nuphy-air60_boot.hex (SMK's ISP bootloader) and nuphy-air60_default_full.hex (bootloader plus firmware), and nuphy-air60_default_full_flash writes that over ICP with sinodude. See docs/bootloader.md.

Debug Console

Debug builds ship their log output as HID reports. smk-console (tools/smk-console) prints them, and runs on Linux, macOS and Windows:

cargo run --release --manifest-path tools/smk-console/Cargo.toml               # defaults to 05ac:024f (nuphy-air60)
cargo run --release --manifest-path tools/smk-console/Cargo.toml -- 258a:002a  # eyooso-z11
cargo run --release --manifest-path tools/smk-console/Cargo.toml -- 258a:001f  # genesis-thor-300
cargo run --release --manifest-path tools/smk-console/Cargo.toml -- 258a:0016  # ciy-x77

It picks devices up and drops them as they are plugged and unplugged, so it can be left running across a reflash. On Linux the /dev/hidraw* node needs a udev rule, or sudo.

About

A keyboard firmware for sinowealth-8051-based devices

Topics

Resources

Stars

148 stars

Watchers

9 watching

Forks

Releases

Used by

Contributors

Languages