Skip to content

feat: replace the C++ SDK with the serial transport implementation - #7

Merged
X-F-R merged 3 commits into
mainfrom
feat/serial-sdk-on-main
Sep 28, 2026
Merged

X-F-R merged 3 commits into
mainfrom
feat/serial-sdk-on-main

Conversation

@X-F-R

@X-F-R X-F-R commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the protobuf-based C++ client SDK on main with a complete port of the litearm Python SDK over the raw serial framing protocol (SOF 0xA5, CRC16-CCITT-FALSE).

The two trees share no git history, so this lands as a whole-tree replacement rather than as a patch on the existing SDK. This branch is parented on main at ff66587 specifically to make the change reviewable as a PR; the diff below is the replacement, and it is large by nature.

Breaks consumers of the previous C++ SDK. include/litearm/arm.hpp, protocol.hpp and transport.hpp are rewritten in place, and codec.hpp, device.hpp, types.hpp and exceptions.hpp are removed along with proto/litearm.proto. Any caller of the current SDK stops compiling. Under this repository's version policy the commit carries no BREAKING CHANGE: marker, so it publishes as a minor.

AGENTS.md is the repository's rule file and this branch does not modify it — it is byte-for-byte main's. Neither does it change LICENSE, .github/workflows/ci.yml, .github/workflows/release.yml, .releaserc.json or .markdownlint.json.

Changes

  • Added the serial SDK: include/litearm/ (23 headers), src/ (18 translation units), examples/ (7 programs), tests/ (27 binaries), plus build.sh, env.sh, run_example.sh and the PowerShell equivalents.
  • Added cmake/litearmConfig.cmake.in, cmake/litearm.pc.in and cmake/toolchain-aarch64-linux-gnu.cmake for find_package, pkg-config and aarch64 cross builds.
  • Added TROUBLESHOOTING.md and UNVERIFIED_REGISTER.md, the latter listing 22 inherited gaps each with a file:line reference and machine-checked by tests/test_register.cpp.
  • Documentation is English, per the repository's documentation standard: README.md, docs/DEVELOPER_GUIDE.md, TROUBLESHOOTING.md, UNVERIFIED_REGISTER.md and examples/README.md. The Chinese developer guide is kept as docs/DEVELOPER_GUIDE.zh-CN.md, matching the existing README.zh-CN.md convention. Source comments stay Chinese, following the upstream Python reference.
  • Removed with the previous SDK: proto/litearm.proto, the codec, device, types and exceptions layers, tests/test_arm.cpp, test_arm_direct.cpp, test_codec.cpp, test_device.cpp, and docs/DEVELOPER_GUIDE.zh-CN.md (superseded by the port's own guide under that name).
  • Merged .gitignore is the union of both files, so neither side's build artifacts become trackable.
  • Corrected rotted README.md line references in the register, a table-of-contents entry that contradicted its own heading, and a load-sensitive 10 ms timeout in two test_precheck cases.

Testing

The suite was run on this branch after the commits and before the push:

$ ./build.sh                     100% tests passed, 0 tests failed out of 27
$ ./build.sh --clean --werror    100% tests passed, 0 tests failed out of 27
$ ./build.sh --clean --asan      100% tests passed, 0 tests failed out of 27
$ ./build.sh --clean --tsan      100% tests passed, 0 tests failed out of 27

All four print:
The following tests did not run:
	 21 - test_protocol_sync (Skipped)

test_protocol_sync is skipped, not passing. It cross-checks the protocol constants against the firmware sources, which sit behind Gitee enterprise permissions. The skip is pre-existing and unrelated to this change; it is recorded as item 15 in UNVERIFIED_REGISTER.md.

--werror is this repository's baseline: the library compiles under -Wall -Wextra with zero warnings.

One real failure was found and fixed while preparing this branch. Under the full TSan run, test_precheck failed with not arrived, timed out 0.0s; the cause was a 10 ms arrival window that only holds on an unloaded machine (the same binary passed 10 out of 10 standalone). The two cases now use the default timeout like every other call site. TSan also reports a large batch of data races and double-lock warnings here; those are documented in README.md as false positives backed by runtime lock-discipline assertions, and they are unchanged by this branch.

The hardware claims in the commit message come from a separate real-arm session on firmware Litearm1.8.0-7J, reported in full in the accompanying verification report. They are not reproducible from CI, because the probes used are not committed.

Issues

None. No issue is referenced and this PR closes nothing.

This branch is a complete port of the litearm Python SDK over the raw
serial framing protocol. It shares no git history with main, so it
lands as a whole-tree replacement rather than as a patch on the
existing SDK.

Removed with the previous SDK: proto/litearm.proto, the codec,
device, types and exceptions layers, tests/test_arm.cpp,
test_arm_direct.cpp, test_codec.cpp, test_device.cpp, and
docs/DEVELOPER_GUIDE.zh-CN.md.

Preserved unchanged: LICENSE, .github/workflows/ci.yml,
.github/workflows/release.yml, .releaserc.json, .markdownlint.json.
.gitignore is the union of both files.

Scope: 49 commands, 27 test binaries, 379 cases, verified against a
7-axis arm on firmware Litearm1.8.0-7J.

Known deviation: docs/DEVELOPER_GUIDE.md and TROUBLESHOOTING.md are
Chinese, where main keeps an English guide plus a .zh-CN variant.
README.md follows the repository convention and is English.
Two things were wrong with the imported tree; both are fixed here.

AGENTS.md had been replaced with a Chinese rewrite. It is the
repository's rule file, so it is restored byte for byte from main and
no longer differs from it at all.

The remaining documents were Chinese, which the repository's
documentation standard (AGENTS.md, section 4) does not allow. These
are now English: docs/DEVELOPER_GUIDE.md, TROUBLESHOOTING.md,
UNVERIFIED_REGISTER.md and examples/README.md. The Chinese developer
guide is kept as docs/DEVELOPER_GUIDE.zh-CN.md, which matches the
existing README.md / README.zh-CN.md convention. Source comments stay
Chinese, following the upstream Python reference.

Also corrected along the way: the register's rotted README.md line
references, its TROUBLESHOOTING.md reference after that file changed
length, a table-of-contents entry that contradicted its own heading
("three hooks" against a heading saying "two hooks"; the body counts
two), and the decorative emoji the documentation standard asks to
avoid.
precheck_home_is_exempt_so_the_recovery_path_stays_open and
precheck_does_not_reject_a_normal_motion_sequence called home(0.01),
a 10 ms arrival window.

The fake delivers nine status frames after CMD_HOME, so a 10 ms
window only holds on an unloaded machine. Running the full suite
under TSan made the first one fail with "not arrived, timed out
0.0s", while the same binary passed 10 out of 10 when run on its own.

Both now use the default timeout, which is what every other call site
in the suite uses. The assertions themselves are unchanged: the cases
still check the exemption, not the arrival window.
@X-F-R
X-F-R merged commit 2cdbbf0 into main Sep 28, 2026
1 check passed
@X-F-R
X-F-R deleted the feat/serial-sdk-on-main branch September 28, 2026 11:05
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released Shipped in a release label Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant