Create Tcl Command
How to create a Tcl command in the firmware.
- License 许可
- MIT
- 最近更新
- 2026-09-07
- Stars
- ★ 7
- Forks
- 4
01 前言 Front Matter
- name
- Create Tcl Command
- description
- How to create a Tcl command in the firmware.
02 资源文件 11
- 参考文档forms.md9.2 KB
- 许可证LICENSE.txt1.4 KB
- 参考文档reference.md16.3 KB
- 脚本scripts/check_bounding_boxes_test.py8.6 KB
- 脚本scripts/check_bounding_boxes.py3.1 KB
- 脚本scripts/check_fillable_fields.py362 B
- 脚本scripts/convert_pdf_to_images.py1.1 KB
- 脚本scripts/create_validation_image.py1.6 KB
- 脚本scripts/extract_form_field_info.py6.0 KB
- 脚本scripts/fill_fillable_fields.py4.7 KB
- 脚本scripts/fill_pdf_form_with_annotations.py3.5 KB
03 SKILL.md 正文
When asked to create or add a new Tcl command or ensemble command to the firmware, follow these steps:
-
Locate the command definitions: Tcl commands are typically defined as C functions (e.g.,
centipede_cmd) inv1/firmware/tcl_commands.h. They follow the signature:int command_name(ClientData clientData, Tcl_Interp* interp, int argc, char* argv[]). The commands are registered at the bottom of the file inregister_tcl_commands(Tcl_Interp* interp)usingTcl_CreateCommand. -
Implement the logic:
- Parse
argcandargvto determine the subcommand and arguments. For ensemble commands, usestrcmp(argv[1], "subcommand")for routing. - Return errors by placing a message in the interpreter result using
Tcl_SetResult(interp, "message", TCL_STATIC/TCL_VOLATILE)orTcl_AppendResult(interp, ...)and returningTCL_ERROR. - On success, set the result (if any) and return
TCL_OK.
- Parse
-
Update the documentation: Always document the new command or subcommand in the Tcl scripting manual located at
v1/doc/centipede_scripting_manual.md. Place it in the appropriate section (Filesystem, Control, or Utilities). -
Recompile to verify: Verify that the C++ code compiles successfully by running the "Compile Firmware" skill (
cd v1/firmware && ./build.sh).
04 同仓库更多 Skills
Using git
Guidelines and constraints for using git in this repository.
Test Tether with Expect
How to run tests against the tether and firmware using Expect scripts
Execute Tcl Scenario
Execute some Tcl code on the Centipede firmware without a Coco connected to it.
Compile Tether
Compile the tether program.
Compile Firmware
Compile the Centipede firmware.