zerostack-mcp 0.9.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ # Copyright (c) 2026 SMLIGHT
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """ZeroStack MCP Server — AI-assisted wireless diagnostics and silicon decoder."""
5
+
6
+ from __future__ import annotations
7
+
8
+ from zerostack_mcp.catalog import load_diagnostics_catalog, load_remediation_meta
9
+ from zerostack_mcp.models import (
10
+ CANONICAL_DIAGNOSTIC_URLS,
11
+ MCP_SERVER_VERSION,
12
+ ZEROSTACK_FIRMWARE_VERSION,
13
+ ZEROSTACK_MARKETING_URL,
14
+ ZEROSTACK_RELEASE_NAME,
15
+ ZEROSTACK_REPO_URL,
16
+ ZEROSTACK_WEB_ANALYZER_URL,
17
+ __version__,
18
+ )
19
+ from zerostack_mcp.server import (
20
+ analyze_zigbee_thread_log,
21
+ check_coordinator_capacity,
22
+ decode_silicon_register,
23
+ diagnose_zigbee_log,
24
+ get_zerostack_benchmarks,
25
+ main,
26
+ mcp,
27
+ resource_benchmarks_summary,
28
+ resource_diagnostics_catalog,
29
+ resource_supported_models,
30
+ )
31
+
32
+ __all__ = [
33
+ "CANONICAL_DIAGNOSTIC_URLS",
34
+ "MCP_SERVER_VERSION",
35
+ "ZEROSTACK_FIRMWARE_VERSION",
36
+ "ZEROSTACK_FIRMWARE_VERSION",
37
+ "ZEROSTACK_MARKETING_URL",
38
+ "ZEROSTACK_RELEASE_NAME",
39
+ "ZEROSTACK_REPO_URL",
40
+ "ZEROSTACK_WEB_ANALYZER_URL",
41
+ "__version__",
42
+ "analyze_zigbee_thread_log",
43
+ "check_coordinator_capacity",
44
+ "decode_silicon_register",
45
+ "diagnose_zigbee_log",
46
+ "get_zerostack_benchmarks",
47
+ "load_diagnostics_catalog",
48
+ "load_remediation_meta",
49
+ "main",
50
+ "mcp",
51
+ "resource_benchmarks_summary",
52
+ "resource_diagnostics_catalog",
53
+ "resource_supported_models",
54
+ ]
@@ -0,0 +1,528 @@
1
+ # Copyright (c) 2026 SMLIGHT
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """Cycle-accurate Part 1 & Part 2 hardware benchmarks for SMLIGHT ZeroStack."""
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import Literal
9
+
10
+ from zerostack_mcp.models import (
11
+ ZEROSTACK_DIAGNOSTICS_BASE,
12
+ ZEROSTACK_FIRMWARE_VERSION,
13
+ ZEROSTACK_MARKETING_URL,
14
+ ZEROSTACK_RELEASE_NAME,
15
+ ZEROSTACK_REPO_URL,
16
+ ZEROSTACK_WEB_ANALYZER_URL,
17
+ AllPlatformsBenchmarkResult,
18
+ BenchmarkMetricValue,
19
+ BenchmarkResult,
20
+ PlatformBenchmarkSummary,
21
+ PlatformKeyLiteral,
22
+ SinglePlatformBenchmarkResult,
23
+ SupportedModelsManifest,
24
+ )
25
+
26
+ PART1_EXECUTION_BENCHMARKS: dict[str, dict[str, BenchmarkMetricValue]] = {
27
+ "tclk_lookup_miss_300_entries": {
28
+ "legacy_cycles": 1486228,
29
+ "legacy_latency_ms": 30.96,
30
+ "zerostack_cycles": 326,
31
+ "zerostack_latency_us": 6.8,
32
+ "speedup_x": 4559.0,
33
+ "zerostack_flash_reads": 0,
34
+ },
35
+ "tclk_lookup_oldest_hit_age383": {
36
+ "legacy_cycles": 620396,
37
+ "legacy_latency_ms": 12.92,
38
+ "zerostack_cycles": 324,
39
+ "zerostack_latency_us": 6.75,
40
+ "speedup_x": 1914.8,
41
+ "slot_0_legacy_cycles": 2961,
42
+ "slot_0_zerostack_cycles": 417,
43
+ "slot_0_speedup_x": 7.1,
44
+ "slot_299_legacy_cycles": 2962,
45
+ "slot_299_zerostack_cycles": 324,
46
+ "slot_299_speedup_x": 9.1,
47
+ },
48
+ "nwk_security_encrypt_d150": {
49
+ "legacy_cycles": 533156,
50
+ "legacy_latency_ms": 11.11,
51
+ "zerostack_cycles": 3968,
52
+ "zerostack_latency_us": 82.7,
53
+ "speedup_x": 134.4,
54
+ "d0_legacy_cycles": 8558,
55
+ "d0_legacy_latency_us": 178.3,
56
+ "d0_zerostack_cycles": 3980,
57
+ "d0_zerostack_latency_us": 82.9,
58
+ "d0_speedup_x": 2.15,
59
+ "zerostack_flash_reads": 0,
60
+ },
61
+ "nwk_security_decrypt_d150": {
62
+ "legacy_cycles": 532182,
63
+ "legacy_latency_ms": 11.09,
64
+ "zerostack_cycles": 3824,
65
+ "zerostack_latency_us": 79.7,
66
+ "speedup_x": 139.2,
67
+ "d0_legacy_cycles": 8091,
68
+ "d0_legacy_latency_us": 168.6,
69
+ "d0_zerostack_cycles": 3840,
70
+ "d0_zerostack_latency_us": 80.0,
71
+ "zerostack_flash_reads": 0,
72
+ },
73
+ "routed_hop_security_ceiling_d150": {
74
+ "legacy_cycles": 1065338,
75
+ "legacy_latency_ms": 22.19,
76
+ "legacy_max_routed_pkt_per_sec": 45,
77
+ "zerostack_cycles": 7792,
78
+ "zerostack_latency_us": 162.3,
79
+ "zerostack_max_routed_pkt_per_sec": 6100,
80
+ "speedup_x": 135.0,
81
+ },
82
+ "aps_tx_security_300_peers": {
83
+ "legacy_cycles_range": "52,909 - 409,301",
84
+ "legacy_max_latency_ms": 8.53,
85
+ "zerostack_cycles_range": "5,410 - 5,424",
86
+ "zerostack_latency_us": 113.0,
87
+ "max_speedup_x": 75.5,
88
+ },
89
+ "device_auth_check_slot299": {
90
+ "legacy_cycles_range": "1,656 - 42,243",
91
+ "legacy_max_latency_us": 880.0,
92
+ "zerostack_cycles_range": "181 - 179",
93
+ "zerostack_latency_us": 3.7,
94
+ "max_speedup_x": 236.0,
95
+ },
96
+ "nvm_stack_key_read_d150": {
97
+ "legacy_cycles_range": "2,347 - 64,817",
98
+ "legacy_max_latency_ms": 1.35,
99
+ "zerostack_cycles_range": "302 - 303",
100
+ "zerostack_latency_us": 6.3,
101
+ "d0_speedup_x": 7.8,
102
+ "max_speedup_x": 213.9,
103
+ "general_nvm_item_read_d0_256_zerostack_cycles": "1,696 - 1,724",
104
+ "general_nvm_item_read_d0_256_legacy_cycles": "581 - 14,303",
105
+ },
106
+ "idempotent_nvm_state_write_100b_x48": {
107
+ "legacy_cycles_2b_20b_100b": "19.1k / 35.3k / 100.7k",
108
+ "legacy_cycles": 100714,
109
+ "legacy_flash_writes": "48 / 48",
110
+ "zerostack_cycles_2b_20b_100b": "2.0k / 2.3k / 3.8k",
111
+ "zerostack_cycles": 3770,
112
+ "zerostack_flash_bytes_written": 0,
113
+ "speedup_x": 26.7,
114
+ "unnecessary_flash_wear_pct": 0.0,
115
+ },
116
+ "nvm_compaction_frequency": {
117
+ "legacy_first_compaction_write": 69,
118
+ "legacy_compaction_stall_ms": 163.9,
119
+ "zerostack_first_compaction_write": 1013,
120
+ "zerostack_compaction_stall_ms": 13.7,
121
+ "compaction_frequency_reduction_x": 14.7,
122
+ },
123
+ "dynamic_memory_malloc_64_holes": {
124
+ "legacy_malloc_free_k0_16_32_64": "310/84, 869/82, 1,430/82, 2,550/82",
125
+ "zerostack_malloc_free_k0_16_32_64": "225/200, 218/175, 220/175, 218/175",
126
+ "legacy_cycles": 2550,
127
+ "zerostack_cycles": 218,
128
+ "speedup_x": 11.7,
129
+ "complexity": "O(1)",
130
+ },
131
+ "timer_start_latency_39_timers": {
132
+ "legacy_cycles_64_holes_t0_39": "6,894 -> 10,034",
133
+ "legacy_cycles": 10034,
134
+ "legacy_latency_us": 209.0,
135
+ "zerostack_cycles_64_holes_t0_39": "930 -> 1,448",
136
+ "zerostack_cycles": 1448,
137
+ "zerostack_latency_us": 30.2,
138
+ "speedup_x": 6.93,
139
+ "clean_heap_legacy_cycles_t0_39": "2,652 -> 5,844",
140
+ "clean_heap_zerostack_cycles_t0_39": "912 -> 1,447",
141
+ "clean_heap_speedup_x": 4.04,
142
+ "timer_stop_legacy_cycles_t0_39": "515 -> 1,370",
143
+ "timer_stop_zerostack_cycles_t0_39": "450 -> 1,050",
144
+ "timer_stop_speedup_x": 1.30,
145
+ },
146
+ "inter_task_event_enqueue_64_queued": {
147
+ "msg_send_legacy_cycles_q0_64": "497 -> 935",
148
+ "legacy_cycles": 935,
149
+ "msg_send_zerostack_cycles_q0_64": "364 -> 322",
150
+ "zerostack_cycles": 322,
151
+ "speedup_x": 2.9,
152
+ "msg_receive_legacy_cycles_q0_64": "383 -> 628",
153
+ "msg_receive_zerostack_cycles_q0_64": "168 -> 333",
154
+ "msg_receive_speedup_q0_x": 2.28,
155
+ "msg_receive_speedup_q64_x": 1.89,
156
+ "complexity": "O(1)",
157
+ },
158
+ "host_serial_sys_ping_115200": {
159
+ "legacy_total_cycles": 9790,
160
+ "zerostack_total_cycles": 4618,
161
+ "total_cycle_reduction_pct": 53.0,
162
+ "legacy_reply_cycles": 4921,
163
+ "zerostack_reply_cycles": 816,
164
+ "reply_cycle_reduction_pct": 83.0,
165
+ "legacy_240b_cycles": 24404,
166
+ "zerostack_240b_cycles": 12784,
167
+ "frame_240b_reduction_pct": 48.0,
168
+ },
169
+ }
170
+
171
+ PART2_RESILIENCE_BENCHMARKS: dict[str, dict[str, BenchmarkMetricValue]] = {
172
+ "malformed_ota_secured_frames": {
173
+ "nwk_aps_fault_classes_tested": 12,
174
+ "mac_boundary_vectors_tested": 3255,
175
+ "legacy_behavior": (
176
+ "Deterministic remote CPU HardFault (Precise BusFault after 143,345 & 144,412 "
177
+ "cycles on Malformed Secured Frame Classes A & B) + accepts malformed routing "
178
+ "headers, mutates security state & delivers to app (144,127 cycles)"
179
+ ),
180
+ "zerostack_crashes": 0,
181
+ "zerostack_rejection_cycles_range": "320 - 6,631",
182
+ "zerostack_malformed_routing_cycles": 790,
183
+ "zerostack_malformed_routing_us": 16.0,
184
+ "zerostack_malformed_routing_speedup_x": 182.0,
185
+ "cpu_cost_reduction_range": "9.8x - 402x",
186
+ },
187
+ "cryptographic_replay_flood_1000_frames_d150": {
188
+ "legacy_cycles_per_replay": 143802,
189
+ "legacy_latency_per_replay_ms": 3.0,
190
+ "legacy_total_cpu_lockup_s": 2.99,
191
+ "zerostack_cycles_per_replay": 1550,
192
+ "zerostack_latency_per_replay_us": 32.0,
193
+ "zerostack_total_cpu_ms": 32.4,
194
+ "speedup_x": 92.8,
195
+ "authenticated_tamper_legacy_cycles": "143,058 - 143,065",
196
+ "authenticated_tamper_zerostack_cycles": "4,760 - 4,771",
197
+ "authenticated_tamper_zerostack_us": 99.0,
198
+ "authenticated_tamper_speedup_x": 30.0,
199
+ },
200
+ "nor_flash_brownout_power_loss_fuzzing": {
201
+ "total_hardware_cut_points": 22959,
202
+ "mid_compaction_cut_points": 22565,
203
+ "record_update_cut_points": 394,
204
+ "shadow_fuzz_operations": 2000000,
205
+ "zerostack_lost_or_corrupted_records": 0,
206
+ "zerostack_nor_write_verify_conflicts": 0,
207
+ "legacy_nor_write_verify_conflicts": 1,
208
+ "legacy_torn_record_reboot_bytes_written": 20232,
209
+ "legacy_torn_record_reboot_page_erases": 62,
210
+ "zerostack_torn_record_reboot_bytes_written": 27,
211
+ "zerostack_torn_record_reboot_page_erases": 0,
212
+ "post_brownout_flash_write_reduction_x": 749.3,
213
+ },
214
+ "hostile_uart_serial_framing_abuse_6_scenarios": {
215
+ "baud_rate_tested": 115200,
216
+ "scenarios_tested": 6,
217
+ "legacy_300x_sof_blackout_s": 8.84,
218
+ "legacy_consecutive_lost_pings": 44,
219
+ "legacy_512b_random_noise_blackout_s": 6.00,
220
+ "legacy_512b_random_noise_lost_pings": 30,
221
+ "legacy_truncated_frame_lost_pings": 1,
222
+ "legacy_truncated_frame_stall_ms": 203,
223
+ "zerostack_lost_pings_all_scenarios": 0,
224
+ "zerostack_recovery_range_ms": "3 - 55",
225
+ "zerostack_300x_sof_recovery_ms": 29,
226
+ "zerostack_truncated_frame_recovery_ms": 3,
227
+ "zerostack_heap_delta_bytes": 0,
228
+ },
229
+ "unauthenticated_join_tclk_miss_flood_50_devices_d300": {
230
+ "legacy_stall_per_miss_ms": 33.9,
231
+ "legacy_total_stall_s": 1.70,
232
+ "zerostack_lookup_cycles": 208,
233
+ "zerostack_lookup_us": 4.0,
234
+ "zerostack_uart_rtt_ms": 4.3,
235
+ "zerostack_total_s": 0.22,
236
+ "speedup_x": 7.7,
237
+ "bounded_timer_refusal_limit": 194,
238
+ "bounded_timer_refusal_status": "NO_TIMER_AVAIL",
239
+ "zero_byte_free_heap_pings_answered": "5 / 5",
240
+ "zero_byte_free_heap_delta_bytes": 0,
241
+ },
242
+ "mesh_broadcast_storm_1000_echoes_50_routers_d150": {
243
+ "legacy_cycles_per_echo": 143865,
244
+ "legacy_latency_per_echo_ms": 3.00,
245
+ "legacy_total_cpu_ms": 3004.97,
246
+ "legacy_total_cpu_s": 3.00,
247
+ "zerostack_p50_cycles_per_echo": 7076,
248
+ "zerostack_p99_cycles_per_echo": 7335,
249
+ "zerostack_p50_latency_us": 147.0,
250
+ "zerostack_total_cpu_ms": 151.16,
251
+ "per_echo_speedup_x": 20.3,
252
+ "total_cpu_reduction_x": 19.9,
253
+ },
254
+ "post_outage_64_unique_broadcast_flood_d150": {
255
+ "legacy_btt_admitted": 30,
256
+ "legacy_admitted_cycles": 154705,
257
+ "zerostack_btt_admitted": 40,
258
+ "zerostack_admitted_cycles": 17699,
259
+ "zerostack_admitted_us": 369.0,
260
+ "btt_capacity_increase_pct": 33.3,
261
+ "legacy_overflow_shed_cycles": 144644,
262
+ "legacy_overflow_shed_ms": 3.01,
263
+ "zerostack_overflow_shed_cycles": 8341,
264
+ "zerostack_overflow_shed_us": 174.0,
265
+ "overflow_shed_speedup_x": 17.3,
266
+ "legacy_total_cpu_ms": 200.25,
267
+ "zerostack_total_cpu_ms": 18.87,
268
+ "total_cpu_reduction_x": 10.6,
269
+ "duplicate_deliveries": 0,
270
+ "zerostack_heap_delta_bytes": 0,
271
+ },
272
+ }
273
+
274
+
275
+ def _build_platform_benchmark(
276
+ *,
277
+ platform: str,
278
+ soc: str,
279
+ cpu_core: str,
280
+ flash_kb: int,
281
+ sram_kb: int,
282
+ hardware_rts_cts: bool,
283
+ rts_cts_pins: str,
284
+ max_source_routes: int,
285
+ ) -> PlatformBenchmarkSummary:
286
+ return {
287
+ "platform": platform,
288
+ "soc": soc,
289
+ "release_name": ZEROSTACK_RELEASE_NAME,
290
+ "release_version": ZEROSTACK_FIRMWARE_VERSION,
291
+ "release_status": (
292
+ f"SMLIGHT ZeroStack {ZEROSTACK_RELEASE_NAME} — Zigbee 3.0 / PRO R23 Coordinator & "
293
+ "Router firmware for SMLIGHT TI SimpleLink F2 adapters"
294
+ ),
295
+ "marketing_url": ZEROSTACK_MARKETING_URL,
296
+ "cpu_core": cpu_core,
297
+ "flash_kb": flash_kb,
298
+ "sram_kb": sram_kb,
299
+ "hardware_rts_cts": hardware_rts_cts,
300
+ "rts_cts_pins": rts_cts_pins,
301
+ "uart_transport": (
302
+ "DMA-driven UART with live auto-baud detection (115200 / 460800 / 1000000 baud)"
303
+ ),
304
+ "supported_baud_rates": [115200, 460800, 1000000],
305
+ "firmware_roles": [
306
+ "Coordinator (TI ZNP / MT)",
307
+ "Router (Zigbee 3.0 / PRO R23)",
308
+ ],
309
+ "hw_srcmatch_short_slots": 32,
310
+ "hw_srcmatch_ext_slots": 32,
311
+ "indirect_queue_pool_cap_pct": 50,
312
+ "max_indirect_frames_per_child": 2,
313
+ "max_source_routes": max_source_routes,
314
+ "tclk_miss_speedup_x": 4559.0,
315
+ "tclk_oldest_hit_speedup_x": 1914.8,
316
+ "nwk_encrypt_speedup_x": 134.4,
317
+ "nwk_decrypt_speedup_x": 139.2,
318
+ "routed_hop_ceiling_pkt_per_sec": 6100,
319
+ "legacy_routed_hop_ceiling_pkt_per_sec": 45,
320
+ "routed_hop_speedup_x": 135.0,
321
+ "aps_tx_security_speedup_x": 75.5,
322
+ "device_auth_speedup_x": 236.0,
323
+ "nvm_key_read_speedup_x": 213.9,
324
+ "idempotent_nvm_write_speedup_x": 26.7,
325
+ "nvm_compaction_reduction_x": 14.7,
326
+ "malloc_64_holes_cycles": 218,
327
+ "malloc_speedup_x": 11.7,
328
+ "timer_start_speedup_x": 6.9,
329
+ "event_enqueue_speedup_x": 2.9,
330
+ "sys_ping_cycle_reduction_pct": 53.0,
331
+ "sys_ping_reply_cycle_reduction_pct": 83.0,
332
+ "malformed_ota_crashes": 0,
333
+ "replay_flood_1000_speedup_x": 92.8,
334
+ "brownout_cut_points_verified": 22959,
335
+ "brownout_reboot_flash_reduction_x": 749.3,
336
+ "uart_abuse_lost_pings": 0,
337
+ "join_flood_50_devices_speedup_x": 7.7,
338
+ "broadcast_echo_storm_speedup_x": 20.3,
339
+ "btt_capacity_slots": 40,
340
+ "heap_fragmentation_pct": 0.0,
341
+ "heap_delta_bytes": 0,
342
+ "memory_allocator": (
343
+ "Constant-time O(1) memory manager (218 cycles at 64 heap holes, 11.7x faster) & "
344
+ "heap-independent timer subsystem (1,448 cycles, 6.9x faster)"
345
+ ),
346
+ "radio_state_reconciliation": (
347
+ "Self-healing Sub-MAC receiver and synthesizer state recovery, indirect queue quota "
348
+ "isolation (50% pool cap, max 2 frames/child), and 0 crashes across 3,255 MAC vectors"
349
+ ),
350
+ "zeroStackDiagUrl": (
351
+ f"{ZEROSTACK_DIAGNOSTICS_BASE}/mac-no-ack-0xe9-sleepy-aqara-tuya-child-drops.md"
352
+ ),
353
+ }
354
+
355
+
356
+ BENCHMARK_DATA: dict[str, PlatformBenchmarkSummary] = {
357
+ "SLZB-06": _build_platform_benchmark(
358
+ platform="SLZB-06",
359
+ soc="TI CC2652P (SimpleLink F2)",
360
+ cpu_core="ARM Cortex-M4F @ 48.0 MHz + Cortex-M0 RF Core",
361
+ flash_kb=352,
362
+ sram_kb=88,
363
+ hardware_rts_cts=False,
364
+ rts_cts_pins="None (no hardware RTS/CTS)",
365
+ max_source_routes=200,
366
+ ),
367
+ "SLZB-06U": _build_platform_benchmark(
368
+ platform="SLZB-06U",
369
+ soc="TI CC2652P (SimpleLink F2)",
370
+ cpu_core="ARM Cortex-M4F @ 48.0 MHz + Cortex-M0 RF Core",
371
+ flash_kb=352,
372
+ sram_kb=88,
373
+ hardware_rts_cts=True,
374
+ rts_cts_pins="DIO10 (RTS) / DIO11 (CTS)",
375
+ max_source_routes=200,
376
+ ),
377
+ "SLZB-06P7": _build_platform_benchmark(
378
+ platform="SLZB-06P7",
379
+ soc="TI CC2652P7 / CC1352P7 (SimpleLink F2)",
380
+ cpu_core="ARM Cortex-M4F @ 48.0 MHz + Cortex-M0 RF Core",
381
+ flash_kb=704,
382
+ sram_kb=144,
383
+ hardware_rts_cts=True,
384
+ rts_cts_pins="DIO10 (RTS) / DIO11 (CTS)",
385
+ max_source_routes=250,
386
+ ),
387
+ "SLZB-06P7U": _build_platform_benchmark(
388
+ platform="SLZB-06P7U",
389
+ soc="TI CC2652P7 / CC1352P7 (SimpleLink F2)",
390
+ cpu_core="ARM Cortex-M4F @ 48.0 MHz + Cortex-M0 RF Core",
391
+ flash_kb=704,
392
+ sram_kb=144,
393
+ hardware_rts_cts=True,
394
+ rts_cts_pins="DIO10 (RTS) / DIO11 (CTS)",
395
+ max_source_routes=250,
396
+ ),
397
+ "SLZB-06P7V1": _build_platform_benchmark(
398
+ platform="SLZB-06P7V1",
399
+ soc="TI CC2652P7 / CC1352P7 (SimpleLink F2)",
400
+ cpu_core="ARM Cortex-M4F @ 48.0 MHz + Cortex-M0 RF Core",
401
+ flash_kb=704,
402
+ sram_kb=144,
403
+ hardware_rts_cts=False,
404
+ rts_cts_pins="None (no hardware RTS/CTS on v1 PCB)",
405
+ max_source_routes=250,
406
+ ),
407
+ "SLZB-07P7": _build_platform_benchmark(
408
+ platform="SLZB-07P7",
409
+ soc="TI CC2652P7 (SimpleLink F2)",
410
+ cpu_core="ARM Cortex-M4F @ 48.0 MHz + Cortex-M0 RF Core",
411
+ flash_kb=704,
412
+ sram_kb=144,
413
+ hardware_rts_cts=False,
414
+ rts_cts_pins="None (USB dongle without hardware RTS/CTS)",
415
+ max_source_routes=250,
416
+ ),
417
+ "SLZB-06P10": _build_platform_benchmark(
418
+ platform="SLZB-06P10",
419
+ soc="TI CC2674P10 (SimpleLink F2)",
420
+ cpu_core="ARM Cortex-M33 @ 48.0 MHz + Cortex-M0 RF Core",
421
+ flash_kb=1024,
422
+ sram_kb=256,
423
+ hardware_rts_cts=True,
424
+ rts_cts_pins="DIO10 (RTS) / DIO11 (CTS)",
425
+ max_source_routes=300,
426
+ ),
427
+ "SLZB-07P10": _build_platform_benchmark(
428
+ platform="SLZB-07P10",
429
+ soc="TI CC2674P10 (SimpleLink F2)",
430
+ cpu_core="ARM Cortex-M33 @ 48.0 MHz + Cortex-M0 RF Core",
431
+ flash_kb=1024,
432
+ sram_kb=256,
433
+ hardware_rts_cts=False,
434
+ rts_cts_pins="None (USB dongle without hardware RTS/CTS)",
435
+ max_source_routes=300,
436
+ ),
437
+ }
438
+
439
+
440
+ def normalize_platform_key(platform: str) -> PlatformKeyLiteral | Literal["ALL"]:
441
+ norm = platform.strip().upper().replace("_", "-")
442
+ compact = norm.replace("-", "")
443
+ if norm in ("ALL", "*"):
444
+ return "ALL"
445
+ if "06P7U" in compact:
446
+ return "SLZB-06P7U"
447
+ if "06P7V1" in compact:
448
+ return "SLZB-06P7V1"
449
+ if "07P7" in compact:
450
+ return "SLZB-07P7"
451
+ if "07P10" in compact:
452
+ return "SLZB-07P10"
453
+ if "06U" in compact:
454
+ return "SLZB-06U"
455
+ if "06P10" in compact or "2674" in compact or compact == "P10":
456
+ return "SLZB-06P10"
457
+ if "06P7" in compact or "1352" in compact or "2652P7" in compact or compact == "P7":
458
+ return "SLZB-06P7"
459
+ if "SLZB06" in compact or "2652" in compact:
460
+ return "SLZB-06"
461
+ raise ValueError(
462
+ f"Unknown platform '{platform}'. Supported platforms: SLZB-06, SLZB-06U (CC2652P), "
463
+ "SLZB-06P7, SLZB-06P7U, SLZB-06P7v1, SLZB-07P7 (CC2652P7 / CC1352P7), "
464
+ "SLZB-06P10, SLZB-07P10 (CC2674P10), or 'all'."
465
+ )
466
+
467
+
468
+ def get_zerostack_benchmarks_impl(platform: str) -> BenchmarkResult:
469
+ """Core implementation for `get_zerostack_benchmarks`."""
470
+ key = normalize_platform_key(platform)
471
+ if key == "ALL":
472
+ all_result: AllPlatformsBenchmarkResult = {
473
+ "requested_platform": "all",
474
+ "release": ZEROSTACK_RELEASE_NAME,
475
+ "version": ZEROSTACK_FIRMWARE_VERSION,
476
+ "marketing_url": ZEROSTACK_MARKETING_URL,
477
+ "platforms": BENCHMARK_DATA,
478
+ "part1_execution_latency": PART1_EXECUTION_BENCHMARKS,
479
+ "part2_resilience_fault_injection": PART2_RESILIENCE_BENCHMARKS,
480
+ "zeroStackDiagUrl": (
481
+ f"{ZEROSTACK_DIAGNOSTICS_BASE}/mac-no-ack-0xe9-sleepy-aqara-tuya-child-drops.md"
482
+ ),
483
+ "interactive_web_analyzer_url": ZEROSTACK_WEB_ANALYZER_URL,
484
+ "zerostack_repository": ZEROSTACK_REPO_URL,
485
+ }
486
+ return all_result
487
+
488
+ metrics = BENCHMARK_DATA[key]
489
+ single_result: SinglePlatformBenchmarkResult = {
490
+ **metrics,
491
+ "requested_platform": key,
492
+ "release": ZEROSTACK_RELEASE_NAME,
493
+ "version": ZEROSTACK_FIRMWARE_VERSION,
494
+ "part1_execution_latency": PART1_EXECUTION_BENCHMARKS,
495
+ "part2_resilience_fault_injection": PART2_RESILIENCE_BENCHMARKS,
496
+ "marketing_url": ZEROSTACK_MARKETING_URL,
497
+ "interactive_web_analyzer_url": ZEROSTACK_WEB_ANALYZER_URL,
498
+ "zerostack_repository": ZEROSTACK_REPO_URL,
499
+ }
500
+ return single_result
501
+
502
+
503
+ def build_supported_models_manifest() -> SupportedModelsManifest:
504
+ """Build structured hardware matrix for `zerostack://hardware/supported-models`."""
505
+ return {
506
+ "release": ZEROSTACK_RELEASE_NAME,
507
+ "version": ZEROSTACK_FIRMWARE_VERSION,
508
+ "marketing_url": ZEROSTACK_MARKETING_URL,
509
+ "firmware_roles": [
510
+ "Coordinator (TI ZNP / MT)",
511
+ "Router (Zigbee 3.0 / PRO R23)",
512
+ ],
513
+ "supported_baud_rates": [115200, 460800, 1000000],
514
+ "models": {
515
+ key: {
516
+ "soc": val["soc"],
517
+ "sram_kb": val["sram_kb"],
518
+ "flash_kb": val["flash_kb"],
519
+ "hardware_rts_cts": val["hardware_rts_cts"],
520
+ "rts_cts_pins": val["rts_cts_pins"],
521
+ "max_source_routes": val["max_source_routes"],
522
+ "hw_srcmatch_short_slots": val["hw_srcmatch_short_slots"],
523
+ "indirect_queue_pool_cap_pct": val["indirect_queue_pool_cap_pct"],
524
+ "max_indirect_frames_per_child": val["max_indirect_frames_per_child"],
525
+ }
526
+ for key, val in BENCHMARK_DATA.items()
527
+ },
528
+ }