一键导入
s19-firmware-re
Reverse engineer Lutron S19/LDF firmware files — HCS08 MCU, CC1101 radio, CCA protocol extraction using Ghidra and Binary Ninja MCP tools
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Reverse engineer Lutron S19/LDF firmware files — HCS08 MCU, CC1101 radio, CCA protocol extraction using Ghidra and Binary Ninja MCP tools
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | s19-firmware-re |
| description | Reverse engineer Lutron S19/LDF firmware files — HCS08 MCU, CC1101 radio, CCA protocol extraction using Ghidra and Binary Ninja MCP tools |
| metadata | {"author":"alex","version":"1.0"} |
| user_invocable | false |
Analyze Motorola S-record (.s19) and Lutron Device Firmware (.ldf) files from Lutron's HCS08-based CCA devices (dimmers, switches, keypads, sensors, picos, VCRX, QSM).
S19 files (~160 files): re/designer/QuantumResi/BinDirectory/Firmware/qs_firmware_and_tools/
LDF files (~34 files): Same tree, .ldf extension (Lutron proprietary container)
QSM firmware: QSM_8.015_434MHz.s19 — the most-analyzed firmware, a Smart Bridge/processor
PPAGE * 0x4000 (e.g., page 0x0A → linear 0x28000)CALL addr16, page_byte (opcode 0xAC) / RTC (opcode 0x8D) for returnAND #imm on sequence bytes → TDMA slot mask extraction (AND #3, #7, #15, #31, #63)CALL target, page → cross-page subroutine (must track page context)JSR → same-page subroutineLDHX → load index register pair (16-bit pointer)STA/LDA offset,X → indexed memory access (common for packet field extraction)Ghidra's stock HCS08 lacks CALL (0xAC) and RTC (0x8D) opcodes. Patched in:
/Users/alex/Downloads/ghidra_12.0.4_PUBLIC/Ghidra/Processors/HCS08/data/languages/HCS_HC.sinc
If the .sinc is modified, delete .sla files to force recompilation.
/Volumes/Secondary/lutron-tools/re/designer/ghidra_project3/qsm_final
Contains 6 programs (QSM firmware split by page):
qsm_64k.bin — unpaged code (0x0000-0xFFFF) — C startup, vectors, trampoline APIpage_0A.bin — CCA radio protocol, 8N1 codec, packet construction, pairing enginepage_12.bin — 316 functionspage_16.bin — 503 functions (largest page)page_1A.bin — 376 functionspage_1E.bin — 65 functions (smallest)mcp__ghidra__list_functions — enumerate all functions in current program
mcp__ghidra__decompile_function — decompile by name
mcp__ghidra__decompile_function_by_address — decompile by hex address
mcp__ghidra__get_function_xrefs — find callers/callees
mcp__ghidra__list_strings — find string constants
mcp__ghidra__search_functions_by_name — search by partial name
mcp__ghidra__set_decompiler_comment — annotate findings
mcp__ghidra__rename_function — rename from FUN_xxxx to meaningful name
mcp__ghidra__set_function_prototype — fix signatures for better decompilation
For firmware not loaded in Ghidra, or for cross-referencing, use Binary Ninja MCP:
mcp__binary_ninja_mcp__list_binaries — see loaded files
mcp__binary_ninja_mcp__select_binary — switch active binary
mcp__binary_ninja_mcp__decompile_function — decompile
mcp__binary_ninja_mcp__search_functions_by_name
mcp__binary_ninja_mcp__list_strings
mcp__binary_ninja_mcp__hexdump_address — raw memory inspection
mcp__binary_ninja_mcp__get_xrefs_to — find references
Motorola S-record format:
S0 — header record (file info)S1 LL AAAA DD...DD CC — 16-bit address data record (len, addr, data, checksum)S2 LL AAAAAA DD...DD CC — 24-bit address data recordS9 — end record (16-bit start address)# Quick extraction with srec_cat (brew install srecord)
srec_cat input.s19 -o output.bin -binary
# For banked HCS08: extract specific address ranges
srec_cat input.s19 -crop 0x8000 0xC000 -offset -0x8000 -o page.bin -binary
# Python one-liner to dump S1 records
python3 -c "
import sys
for line in open(sys.argv[1]):
if line.startswith('S1'):
n = int(line[2:4], 16) - 3
addr = int(line[4:8], 16)
data = bytes.fromhex(line[8:8+n*2])
print(f'{addr:04X}: {data.hex()}')
" input.s19 | head -20
Lutron Device Firmware files — proprietary container wrapping S19 data with metadata (device class, version, checksums). The S19 payload can usually be found by searching for S0 or S1 ASCII within the file:
strings firmware.ldf | grep "^S[012]" | head -5
Search for SPI write sequences — the CC1101 config is written as register-address + value pairs:
STA 0x3F,X or calls to the SPI write trampoline (0x04A9 in QSM)CMP #imm / BEQ chains or LDHX → JSR through jump tablesfunc_0x0283(format_code, buffer)AND #7 / AND #15 / AND #31 on sequence bytes → slot maskLSL / ROR / AND #mask) across byte boundaries160 S19 files cover all Lutron CCA device families. Useful for:
docs/devices/qsm.md — QSM (Smart Bridge) complete analysis: trampoline table, TDMA timing, 8N1 codec, CRC, CC1101 config, packet dispatch, frequency hoppingdocs/devices/esn.md — ESN (Energi Savr Node) analysisdocs/protocols/cca/index.md — CCA protocol reference built from RE findingsdocs/tooling/firmware-updates.md — How firmware update delivery workssrec_cat to extract the binary, noting address rangesdocs/qsm-firmware-re.md or create device-specific docs, update protocol definitions in protocol/cca.protocol.tsInvestigate and patch Lutron Designer feature flags. Use when you need to find out what a named flag controls, locate where it is checked in the .NET DLLs, trace a gated UI element back through ViewModel/ModelView/Domain layers, determine whether a flag is consumed at all, or plan a new DLL patch to force-enable a flag. For the build/deploy cycle of patched DLLs, hand off to anthropic-skills:designer-deploy.
Decompile and analyze Lutron Designer .NET DLLs. Use when investigating how Designer implements a feature (account gating, channel entitlements, device model rules, toolbox platform filtering, protocol handlers), tracing an enum/attribute through the assembly stack, or cross-referencing SQLMODELINFO against in-DLL metadata. Complements designer-feature-flags (flag-specific tracing) and designer-project (project-file/DB queries).
CCA protocol reference — packet types, TDMA timing, 8N1 framing, QS Link fields. Points to authoritative sources, no duplication.
Open and query Lutron Designer project files (.hw/.ra3) — CCA address maps, zone assignments, device inventory, link topology. Use when analyzing project structure, planning device additions, or mapping CCA zone bytes.
Gather preset/scene zone assignments from a Designer project file (.hw/.ra3) and generate data/preset-zones.json for the CCX-WiZ bridge. Use when scenes change or bridge needs updated preset data.
nRF52840 USB dongle: flash sniffer or OpenThread RCP firmware, capture and analyze Thread/802.15.4 traffic. Use when asked to switch modes, capture packets, or reflash the dongle.