dsh-embedded-kit: A Chip- and Toolchain-Agnostic Embedded Firmware Toolkit

Foreword

DeepSeek Harness (DSH) is a plugin-based framework designed to extend the capabilities of Large Language Models (LLMs) through plugins. In embedded development scenarios, models often lack specific engineering calculation capabilities and deep understanding of specific hardware/toolchains. dsh-embedded-kit is a local plugin tailored for embedded firmware development, aiming to fill this gap.

What is it

dsh-embedded-kit is a Host-side plugin maintained by the developer anneqaq. It provides a chip and toolchain-agnostic embedded firmware toolkit, containing 8 low-level tools and 21 engineering practice skills. The plugin supports various input formats such as ELF, GNU ld map, and Keil map, enabling developers to perform footprint analysis, building, protocol verification, timing calculation, image verification, and fault diagnosis.

Core Functions

The plugin’s core capabilities are divided into two parts: “Tools” and “Skills”. Tools are primarily responsible for specific numerical calculations and file processing, while Skills provide engineering review checklists and debugging methodology.

Tools (8)

Tools primarily run in the local Node.js environment and are used to process firmware files and calculate timing parameters.

  • fw_size (Footprint Analysis): Supports automatic identification of three input formats: ELF files, GNU ld .map, and Keil MDK .map. It outputs detailed ROM and RAM usage breakdowns, sorts the top space consumers at symbol-level granularity, and provides budget utilization analysis.
  • fw_build (Multi-toolchain Build): Supports seven build backends: keil, platformio, cmake, make, idf, iar, and custom. It can detect available toolchains via probe, or execute build and parse errors and warnings.
  • proto_frame (Protocol Frame Construction/Validation): Supports frame construction and review for the Modbus RTU protocol. It includes a parameterized CRC engine (supporting 12 presets and custom parameters) and is not limited to the Modbus protocol.
  • can_timing / canfd_timing (CAN/CAN-FD Bit Timing Back-calculation): Calculates register values such as BRP, TSEG1, TSEG2, and SJW. The CAN FD section specifically handles DLC non-linear mapping (padding 9~15 bytes to valid lengths) and TDC (Transmit Delay Compensation).
  • clock_tree (Clock Tree Solving): Performs combinatorial solving for PLLs, calculating fout = fsrc/inputDiv×mul/outputDiv. It verifies the divider chain node by node and provides fault-tolerant budgets for UART clocks.
  • fw_image (Image Verification): Performs line-by-line checksum verification and void detection for Intel HEX files. It also provides Cortex-M vector table verification, checking SP alignment, reset vector Thumb bit, target address, and VTOR alignment.
  • fault_decode (Cortex-M Exception Triage): Translates register values such as PC/LR into “Function Name + Offset”. Combined with interpretation of registers like CFSR/HFSR, it provides root cause inference.

Skills (21)

Skills are written into the context as text, providing review checklists and decision trees, loaded on demand.

Code & Architecture Review:
* embedded-code-review: Checklist for bare-metal and RTOS code review, covering architectural differences across ARM/AArch64/RISC-V/Xtensa/AVR/PIC/8051/MSP430.
* code-standards: Embedded C code standards (R1~R10).
* architecture-principles: Architectural principles such as dependency direction, module boundaries, and single-writer for state.
* scheduling-patterns: State machines, multi-timer time-slicing, and scheduling feasibility criteria.

Debugging & Diagnosis:
* debug-methodology: Debugging methodologies such as binary search localization, timing measurement without printf, and fault injection.
* fault-diagnosis: Decision tree for HardFault triage, stack overflow identification, and watchdog reset differentiation.
* low-power-and-leakage: Low power modes, leakage classification troubleshooting, and datasheet electrical parameter verification.

Protocols & Communication:
* protocol-review: Writing and reviewing serial communication protocols (CRC pitfalls, timeout retries).
* bus-timing: Timing and electrical parameters for I²C/SPI/I²S/RS-485/RS-232/LIN/1-Wire/QSPI.
* ble-throughput: BLE throughput and advertising duty cycle.
* pmbus-check: PMBus/SMBus command layer and clock stretching checks.
* link-budget: Wireless link budget and distance back-calculation.
* lora-airtime: LoRa airtime and EU868 duty cycle compliance.

Storage & Performance:
* nvm-storage: Flash physical constraints, power-loss safety strategies, and wear models.
* storage-and-display: NVM partition layout and LVGL buffer configuration.
* sdio-speed: Speed grades and effective throughput for SD/SDIO/eMMC.
* usb-bandwidth: USB 2.0 frame budget, periodic limits, and endpoint bandwidth.

Kernel & Power:
* mcu-core: NVIC priority grouping, interrupt latency upper bounds, and static upper bounds for stack depth.
* power-and-io: Power budgets, power trees, pin leakage, and ADC sampling loads.

Installation and Activation

This plugin is a Host-side plugin, dependent on the Node.js environment, and requires DeepSeek Harness version >= 0.1.6-alpha.1.

The npm installation method is recommended, as it automatically applies the configuration patches bundled with the plugin:

dsh plugin --profile <profile> add dsh-embedded-kit

After installation, you can verify if the configuration is effective via dsh --profile <profile> --dump-config.

Typical Usage

Skills invoke local tool scripts via the node command. The invocation format is:

node <plugin-root>/skills/_shared/run-tool.mjs <tool-name> key=value ...

Examples:
* Detect available toolchains:

    node <plugin-root>/skills/_shared/run-tool.mjs fw_build probe
  • Calculate PLL clock tree:
    node <plugin-root>/skills/_shared/run-tool.mjs clock_tree
  • Build Modbus RTU frame:
    node <plugin-root>/skills/_shared/run-tool.mjs proto_frame build
  • Cortex-M exception triage:
    node <plugin-root>/skills/_shared/run-tool.mjs fault_decode

Notes

  1. Data Integrity: All tools distinguish between design values and measured values. For data that cannot be obtained, the tool will mark it as pending rather than fabricating values.
  2. Skill Dependencies: Skill services rely on tools. If tools are unavailable (e.g., Node.js is not installed or the path is incorrect), skills cannot be invoked.
  3. Compatibility Check: The plugin checks peerDependencies (@deepseek-ai/dsh*) before loading the profile. If the host version does not satisfy the range, the plugin will be skipped with only a log entry recorded.
  4. Local Environment: As it is a Host-side plugin, all calculations and file parsing depend on the local environment. Ensure that the corresponding build tools or data files are available locally.

Conclusion

dsh-embedded-kit provides DSH with complete capabilities ranging from low-level timing calculations to high-level code review. Through explicit tool invocations and structured skill checklists, it assists developers in conducting more rigorous embedded system design and verification.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye