@typecad/cuttlefish 0.1.0-alpha.2 → 1.0.0-alpha.11
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.
- package/README.md +10 -10
- package/dist/api/board-types.d.ts +1 -1
- package/dist/api/config.d.ts +38 -2
- package/dist/api/index.d.ts +1 -1
- package/dist/api/schema/types.d.ts +15 -0
- package/dist/api/shared/async-runtime-static.d.ts +12 -1
- package/dist/api/shared/async-runtime-static.js +69 -24
- package/dist/api/shared/async-symbol-detector.d.ts +11 -0
- package/dist/api/shared/async-symbol-detector.js +140 -0
- package/dist/api/shared/async-types.d.ts +24 -0
- package/dist/api/shared/coop-scheduler.d.ts +60 -0
- package/dist/api/shared/coop-scheduler.js +149 -0
- package/dist/api/shared/display-adapter.d.ts +4 -3
- package/dist/api/shared/display-adapter.js +15 -118
- package/dist/api/shared/display-adapters/sdl.js +38 -31
- package/dist/api/shared/display-profile.d.ts +47 -25
- package/dist/api/shared/display-profile.js +31 -164
- package/dist/api/shared/framework-manifest-registry.d.ts +9 -0
- package/dist/api/shared/framework-manifest-registry.js +27 -0
- package/dist/api/shared/framework-manifest.d.ts +595 -0
- package/dist/api/shared/framework-manifest.js +193 -0
- package/dist/api/shared/glcdfont.d.ts +12 -0
- package/dist/api/shared/glcdfont.js +124 -0
- package/dist/api/shared/graphics-strategy.d.ts +37 -0
- package/dist/api/shared/hal-op-ir.d.ts +764 -1
- package/dist/api/shared/hal-op-ir.js +129 -1
- package/dist/api/shared/index.d.ts +22 -2
- package/dist/api/shared/index.js +26 -1
- package/dist/api/shared/ir-core.d.ts +4 -0
- package/dist/api/shared/ir-declarations.d.ts +6 -0
- package/dist/api/shared/native-display-op-resolver.d.ts +10 -0
- package/dist/api/shared/native-display-op-resolver.js +64 -0
- package/dist/api/shared/platform-strategy.d.ts +119 -2
- package/dist/api/shared/polyfill-helper-registry.js +18 -1
- package/dist/api/shared/promise-runtime.d.ts +1 -1
- package/dist/api/shared/promise-runtime.js +95 -13
- package/dist/api/shared/spdx-licenses.d.ts +139 -0
- package/dist/api/shared/spdx-licenses.js +385 -0
- package/dist/api/shared/toolchain-types.d.ts +17 -0
- package/dist/api/shared/types.d.ts +8 -0
- package/dist/api/shared/validate-framework-manifest.d.ts +28 -0
- package/dist/api/shared/validate-framework-manifest.js +494 -0
- package/dist/api/shared/worker-runtime-polyfill.d.ts +22 -0
- package/dist/api/shared/worker-runtime-polyfill.js +34 -0
- package/dist/api/shared/worker-runtime.d.ts +69 -0
- package/dist/api/shared/worker-runtime.js +163 -0
- package/dist/cli-utils.d.ts +1 -0
- package/dist/cli-utils.js +3 -1
- package/dist/cli.js +249 -32
- package/dist/config-loader.d.ts +7 -2
- package/dist/config-loader.js +23 -3
- package/dist/config-schema.d.ts +112 -70
- package/dist/config-schema.js +14 -0
- package/dist/contract/board-generator.d.ts +17 -0
- package/dist/contract/board-generator.js +57 -0
- package/dist/contract/contract-parser.d.ts +217 -0
- package/dist/contract/contract-parser.js +224 -0
- package/dist/contract/index.d.ts +22 -0
- package/dist/contract/index.js +68 -0
- package/dist/create/board-codegen.js +4 -4
- package/dist/create/board-generators.js +4 -5
- package/dist/create/board-spec.d.ts +72 -75
- package/dist/create/board-spec.js +0 -1
- package/dist/create/framework-catalog.d.ts +64 -0
- package/dist/create/framework-catalog.js +136 -0
- package/dist/create/index.d.ts +5 -1
- package/dist/create/index.js +3 -1
- package/dist/create/init-scaffold.d.ts +12 -3
- package/dist/create/init-scaffold.js +49 -14
- package/dist/create/init-templates.d.ts +4 -0
- package/dist/create/init-templates.js +271 -17
- package/dist/create/init-wizard.js +41 -27
- package/dist/create/install-deps.d.ts +32 -0
- package/dist/create/install-deps.js +46 -0
- package/dist/debug/preprocessor.js +178 -39
- package/dist/debug/types.d.ts +23 -0
- package/dist/diagnostics/mermaid-builder.d.ts +1 -1
- package/dist/diagnostics/mermaid-builder.js +34 -24
- package/dist/emit/compliance/arxml-writer.d.ts +11 -0
- package/dist/emit/compliance/arxml-writer.js +34 -0
- package/dist/emit/compliance/compliance-context.d.ts +57 -0
- package/dist/emit/compliance/compliance-context.js +113 -0
- package/dist/emit/compliance/deviation-ledger.d.ts +27 -0
- package/dist/emit/compliance/deviation-ledger.js +47 -0
- package/dist/emit/compliance/deviation-writer.d.ts +30 -0
- package/dist/emit/compliance/deviation-writer.js +37 -0
- package/dist/emit/compliance/index.d.ts +7 -0
- package/dist/emit/compliance/index.js +6 -0
- package/dist/emit/compliance/rule-engine.d.ts +13 -0
- package/dist/emit/compliance/rule-engine.js +101 -0
- package/dist/emit/compliance/rules.d.ts +16 -0
- package/dist/emit/compliance/rules.js +191 -0
- package/dist/emit/compliance/types.d.ts +59 -0
- package/dist/emit/compliance/types.js +8 -0
- package/dist/emit/cpp-emitter.js +4 -3
- package/dist/emit/emitters/class-emitter.js +6 -1
- package/dist/emit/emitters/emitter-context.d.ts +28 -1
- package/dist/emit/emitters/function-emitter-impl.js +153 -53
- package/dist/emit/emitters/line-appender.js +19 -0
- package/dist/emit/emitters/line-marker.d.ts +38 -0
- package/dist/emit/emitters/line-marker.js +39 -0
- package/dist/emit/emitters/output-finalizer.d.ts +6 -0
- package/dist/emit/emitters/output-finalizer.js +101 -12
- package/dist/emit/emitters/setup.d.ts +17 -0
- package/dist/emit/emitters/setup.js +372 -30
- package/dist/emit/emitters/top-level-prep.js +8 -0
- package/dist/emit/emitters/type-decl-emitter.js +28 -3
- package/dist/emit/emitters/ui-emitter.js +33 -9
- package/dist/emit/expression-renderer.d.ts +1 -1
- package/dist/emit/expression-renderer.js +91 -6
- package/dist/emit/route-hal-op.js +18 -5
- package/dist/emit/snprintf-helpers.js +15 -4
- package/dist/emit/statement-renderer.d.ts +10 -0
- package/dist/emit/statement-renderer.js +34 -5
- package/dist/emit/utils/async-state-machine.js +221 -125
- package/dist/emit/utils/hal-op-cpp-type.d.ts +6 -0
- package/dist/emit/utils/hal-op-cpp-type.js +40 -0
- package/dist/framework-package.js +2 -0
- package/dist/framework-registry.d.ts +17 -0
- package/dist/install/framework-catalog.d.ts +53 -0
- package/dist/install/framework-catalog.js +107 -0
- package/dist/install/handle-install.d.ts +35 -0
- package/dist/install/handle-install.js +177 -0
- package/dist/install/index.d.ts +4 -0
- package/dist/install/index.js +3 -0
- package/dist/ir/adc-range-validation.js +40 -26
- package/dist/ir/build-ir-state.d.ts +1 -0
- package/dist/ir/build-ir-state.js +14 -0
- package/dist/ir/build-ir.js +9 -5
- package/dist/ir/call-graph.js +16 -0
- package/dist/ir/expression-to-ir.js +207 -6
- package/dist/ir/feature-registry.js +7 -25
- package/dist/ir/function-builder.js +22 -0
- package/dist/ir/hal/hal-emitter.d.ts +5 -2
- package/dist/ir/hal/hal-emitter.js +50 -18
- package/dist/ir/hal/hal-parser.d.ts +6 -0
- package/dist/ir/hal/hal-parser.js +81 -0
- package/dist/ir/hal/hal-plugins.js +733 -1
- package/dist/ir/identifier-collector.js +35 -0
- package/dist/ir/interrupt-analysis.d.ts +5 -1
- package/dist/ir/interrupt-analysis.js +16 -19
- package/dist/ir/memory-budget-validation.js +1 -0
- package/dist/ir/network-validation.d.ts +4 -0
- package/dist/ir/network-validation.js +184 -0
- package/dist/ir/ownership-analysis.js +39 -1
- package/dist/ir/peripheral-ownership.js +5 -0
- package/dist/ir/peripheral-validation.d.ts +1 -1
- package/dist/ir/peripheral-validation.js +6 -3
- package/dist/ir/pin-alias-conflict.d.ts +1 -1
- package/dist/ir/pin-alias-conflict.js +2 -1
- package/dist/ir/pin-capability-validation.js +71 -32
- package/dist/ir/pin-mode-validation.d.ts +2 -2
- package/dist/ir/pin-mode-validation.js +54 -18
- package/dist/ir/pin-safety.d.ts +1 -1
- package/dist/ir/pin-safety.js +2 -1
- package/dist/ir/program-analysis.d.ts +81 -0
- package/dist/ir/program-analysis.js +429 -0
- package/dist/ir/pulldown-validation.d.ts +1 -1
- package/dist/ir/pulldown-validation.js +2 -1
- package/dist/ir/pwm-timer-sharing.d.ts +1 -1
- package/dist/ir/pwm-timer-sharing.js +2 -1
- package/dist/ir/render-expr.js +11 -0
- package/dist/ir/resource-analysis.js +2 -0
- package/dist/ir/timer0-pwm-timing-conflict.d.ts +1 -1
- package/dist/ir/timer0-pwm-timing-conflict.js +2 -1
- package/dist/ir/timing-validation.d.ts +6 -1
- package/dist/ir/timing-validation.js +61 -13
- package/dist/ir/transformers/call-statement.js +105 -0
- package/dist/ir/transformers/expressions.js +62 -0
- package/dist/ir/transformers/hal-call-resolver.js +21 -0
- package/dist/ir/transformers/hal-emit-helpers.js +1 -1
- package/dist/ir/transformers/namespace-methods.js +17 -12
- package/dist/ir/transformers/ui-reactive.js +2 -2
- package/dist/ir/transformers/variables.js +137 -19
- package/dist/ir/try-catch-validation.js +2 -0
- package/dist/ir/type-resolution.js +20 -2
- package/dist/ir/ui-element-auto-wire.js +7 -5
- package/dist/ir/unit-suspicion-validation.js +9 -7
- package/dist/ir/utils/map-statements.d.ts +4 -0
- package/dist/ir/utils/map-statements.js +79 -0
- package/dist/ir/validation-orchestrator.js +15 -8
- package/dist/ir/worker-analysis.d.ts +10 -0
- package/dist/ir/worker-analysis.js +261 -0
- package/dist/libdef/c-to-decl.d.ts +27 -0
- package/dist/libdef/c-to-decl.js +397 -0
- package/dist/libdef/component-decls.d.ts +2 -0
- package/dist/libdef/component-decls.js +6 -0
- package/dist/libdef/component-discovery.d.ts +43 -0
- package/dist/libdef/component-discovery.js +83 -0
- package/dist/libdef/cpp-to-decl.d.ts +9 -0
- package/dist/libdef/cpp-to-decl.js +72 -0
- package/dist/libdef/registry.js +5 -2
- package/dist/lint-cache.d.ts +59 -0
- package/dist/lint-cache.js +257 -0
- package/dist/orchestrator/graph-builder.js +14 -9
- package/dist/platform/coop-scheduler-runtime.d.ts +19 -0
- package/dist/platform/coop-scheduler-runtime.js +41 -0
- package/dist/platform/generic-strategy.d.ts +15 -3
- package/dist/platform/generic-strategy.js +49 -4
- package/dist/safety/safety-bridge.d.ts +11 -0
- package/dist/safety/safety-bridge.js +48 -0
- package/dist/safety/sidecar-bridge.d.ts +5 -0
- package/dist/safety/sidecar-bridge.js +22 -0
- package/dist/safety-hook.d.ts +79 -0
- package/dist/safety-hook.js +35 -0
- package/dist/testing.d.ts +8 -2
- package/dist/testing.js +9 -2
- package/dist/transpile.d.ts +3 -0
- package/dist/transpile.js +191 -49
- package/dist/types.d.ts +22 -3
- package/dist/ui-hook.d.ts +17 -3
- package/dist/utils/cli.js +123 -2
- package/dist/utils/fs.d.ts +13 -0
- package/dist/utils/fs.js +50 -0
- package/dist/utils/ui.js +3 -1
- package/package.json +23 -3
- package/dist/api/shared/display-adapters/eink-mono.d.ts +0 -2
- package/dist/api/shared/display-adapters/eink-mono.js +0 -53
- package/dist/api/shared/display-adapters/ssd1309.d.ts +0 -2
- package/dist/api/shared/display-adapters/ssd1309.js +0 -136
- package/dist/api/shared/display-adapters/st7796.d.ts +0 -2
- package/dist/api/shared/display-adapters/st7796.js +0 -132
- package/dist/ir/heap-array-validation.d.ts +0 -24
- package/dist/ir/heap-array-validation.js +0 -29
package/dist/config-schema.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export declare const CuttlefishConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
11
11
|
board: z.ZodOptional<z.ZodString>;
|
|
12
12
|
contract: z.ZodOptional<z.ZodString>;
|
|
13
13
|
framework: z.ZodOptional<z.ZodString>;
|
|
14
|
+
/** ESP32 PSRAM type. When set, the framework emits the PSRAM-enabling
|
|
15
|
+
* Kconfig/define so canvas allocations prefer external RAM (large scroll
|
|
16
|
+
* viewports/lists stop failing on PSRAM targets). No effect on boards
|
|
17
|
+
* without PSRAM (the runtime falls back to SRAM then the band renderer). */
|
|
18
|
+
psram: z.ZodOptional<z.ZodEnum<["opi", "quad"]>>;
|
|
14
19
|
output: z.ZodOptional<z.ZodObject<{
|
|
15
20
|
framework: z.ZodOptional<z.ZodString>;
|
|
16
21
|
optimize: z.ZodOptional<z.ZodEnum<["none", "size", "speed", "balanced"]>>;
|
|
@@ -19,14 +24,14 @@ export declare const CuttlefishConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
19
24
|
extraFlags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
20
25
|
}, "strict", z.ZodTypeAny, {
|
|
21
26
|
framework?: string | undefined;
|
|
27
|
+
optimize?: "none" | "size" | "speed" | "balanced" | undefined;
|
|
22
28
|
outDir?: string | undefined;
|
|
23
|
-
optimize?: "size" | "none" | "speed" | "balanced" | undefined;
|
|
24
29
|
defines?: Record<string, string> | undefined;
|
|
25
30
|
extraFlags?: string[] | undefined;
|
|
26
31
|
}, {
|
|
27
32
|
framework?: string | undefined;
|
|
33
|
+
optimize?: "none" | "size" | "speed" | "balanced" | undefined;
|
|
28
34
|
outDir?: string | undefined;
|
|
29
|
-
optimize?: "size" | "none" | "speed" | "balanced" | undefined;
|
|
30
35
|
defines?: Record<string, string> | undefined;
|
|
31
36
|
extraFlags?: string[] | undefined;
|
|
32
37
|
}>>;
|
|
@@ -41,19 +46,19 @@ export declare const CuttlefishConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
41
46
|
buildTarget: z.ZodOptional<z.ZodString>;
|
|
42
47
|
board: z.ZodOptional<z.ZodString>;
|
|
43
48
|
}, "strict", z.ZodTypeAny, {
|
|
44
|
-
buildTarget?: string | undefined;
|
|
45
|
-
port?: string | undefined;
|
|
46
49
|
board?: string | undefined;
|
|
47
|
-
baudRate?: number | undefined;
|
|
48
50
|
include?: string[] | undefined;
|
|
51
|
+
port?: string | undefined;
|
|
52
|
+
baudRate?: number | undefined;
|
|
49
53
|
timeout?: number | undefined;
|
|
50
|
-
}, {
|
|
51
54
|
buildTarget?: string | undefined;
|
|
52
|
-
|
|
55
|
+
}, {
|
|
53
56
|
board?: string | undefined;
|
|
54
|
-
baudRate?: number | undefined;
|
|
55
57
|
include?: string[] | undefined;
|
|
58
|
+
port?: string | undefined;
|
|
59
|
+
baudRate?: number | undefined;
|
|
56
60
|
timeout?: number | undefined;
|
|
61
|
+
buildTarget?: string | undefined;
|
|
57
62
|
}>>;
|
|
58
63
|
toolchain: z.ZodOptional<z.ZodObject<{
|
|
59
64
|
type: z.ZodOptional<z.ZodString>;
|
|
@@ -76,141 +81,178 @@ export declare const CuttlefishConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
76
81
|
baudRate?: number | undefined;
|
|
77
82
|
}>>;
|
|
78
83
|
native: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
+
zephyr: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
kconfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
86
|
+
cmakeArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
87
|
+
runner: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, "strict", z.ZodTypeAny, {
|
|
89
|
+
kconfig?: Record<string, string> | undefined;
|
|
90
|
+
cmakeArgs?: string[] | undefined;
|
|
91
|
+
runner?: string | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
kconfig?: Record<string, string> | undefined;
|
|
94
|
+
cmakeArgs?: string[] | undefined;
|
|
95
|
+
runner?: string | undefined;
|
|
96
|
+
}>>;
|
|
79
97
|
}, "strict", z.ZodTypeAny, {
|
|
80
|
-
|
|
81
|
-
port?: string | undefined;
|
|
82
|
-
baudRate?: number | undefined;
|
|
83
|
-
} | undefined;
|
|
84
|
-
frameworkData?: Record<string, unknown> | undefined;
|
|
98
|
+
entry?: string | undefined;
|
|
85
99
|
target?: string | undefined;
|
|
100
|
+
mcu?: string | undefined;
|
|
101
|
+
board?: string | undefined;
|
|
102
|
+
contract?: string | undefined;
|
|
86
103
|
framework?: string | undefined;
|
|
87
|
-
|
|
104
|
+
psram?: "opi" | "quad" | undefined;
|
|
88
105
|
output?: {
|
|
89
106
|
framework?: string | undefined;
|
|
107
|
+
optimize?: "none" | "size" | "speed" | "balanced" | undefined;
|
|
90
108
|
outDir?: string | undefined;
|
|
91
|
-
optimize?: "size" | "none" | "speed" | "balanced" | undefined;
|
|
92
109
|
defines?: Record<string, string> | undefined;
|
|
93
110
|
extraFlags?: string[] | undefined;
|
|
94
111
|
} | undefined;
|
|
95
|
-
|
|
96
|
-
mcu?: string | undefined;
|
|
112
|
+
frameworkData?: Record<string, unknown> | undefined;
|
|
97
113
|
include?: string[] | undefined;
|
|
98
|
-
entry?: string | undefined;
|
|
99
|
-
toolchain?: {
|
|
100
|
-
type?: string | undefined;
|
|
101
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
102
|
-
} | undefined;
|
|
103
|
-
contract?: string | undefined;
|
|
104
114
|
exclude?: string[] | undefined;
|
|
105
115
|
test?: {
|
|
106
|
-
buildTarget?: string | undefined;
|
|
107
|
-
port?: string | undefined;
|
|
108
116
|
board?: string | undefined;
|
|
109
|
-
baudRate?: number | undefined;
|
|
110
117
|
include?: string[] | undefined;
|
|
118
|
+
port?: string | undefined;
|
|
119
|
+
baudRate?: number | undefined;
|
|
111
120
|
timeout?: number | undefined;
|
|
121
|
+
buildTarget?: string | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
toolchain?: {
|
|
124
|
+
type?: string | undefined;
|
|
125
|
+
frameworkOptions?: Record<string, unknown> | undefined;
|
|
112
126
|
} | undefined;
|
|
113
|
-
}, {
|
|
114
127
|
console?: {
|
|
115
128
|
port?: string | undefined;
|
|
116
129
|
baudRate?: number | undefined;
|
|
117
130
|
} | undefined;
|
|
118
|
-
|
|
131
|
+
native?: Record<string, unknown> | undefined;
|
|
132
|
+
zephyr?: {
|
|
133
|
+
kconfig?: Record<string, string> | undefined;
|
|
134
|
+
cmakeArgs?: string[] | undefined;
|
|
135
|
+
runner?: string | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
}, {
|
|
138
|
+
entry?: string | undefined;
|
|
119
139
|
target?: string | undefined;
|
|
140
|
+
mcu?: string | undefined;
|
|
141
|
+
board?: string | undefined;
|
|
142
|
+
contract?: string | undefined;
|
|
120
143
|
framework?: string | undefined;
|
|
121
|
-
|
|
144
|
+
psram?: "opi" | "quad" | undefined;
|
|
122
145
|
output?: {
|
|
123
146
|
framework?: string | undefined;
|
|
147
|
+
optimize?: "none" | "size" | "speed" | "balanced" | undefined;
|
|
124
148
|
outDir?: string | undefined;
|
|
125
|
-
optimize?: "size" | "none" | "speed" | "balanced" | undefined;
|
|
126
149
|
defines?: Record<string, string> | undefined;
|
|
127
150
|
extraFlags?: string[] | undefined;
|
|
128
151
|
} | undefined;
|
|
129
|
-
|
|
130
|
-
mcu?: string | undefined;
|
|
152
|
+
frameworkData?: Record<string, unknown> | undefined;
|
|
131
153
|
include?: string[] | undefined;
|
|
132
|
-
entry?: string | undefined;
|
|
133
|
-
toolchain?: {
|
|
134
|
-
type?: string | undefined;
|
|
135
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
136
|
-
} | undefined;
|
|
137
|
-
contract?: string | undefined;
|
|
138
154
|
exclude?: string[] | undefined;
|
|
139
155
|
test?: {
|
|
140
|
-
buildTarget?: string | undefined;
|
|
141
|
-
port?: string | undefined;
|
|
142
156
|
board?: string | undefined;
|
|
143
|
-
baudRate?: number | undefined;
|
|
144
157
|
include?: string[] | undefined;
|
|
158
|
+
port?: string | undefined;
|
|
159
|
+
baudRate?: number | undefined;
|
|
145
160
|
timeout?: number | undefined;
|
|
161
|
+
buildTarget?: string | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
toolchain?: {
|
|
164
|
+
type?: string | undefined;
|
|
165
|
+
frameworkOptions?: Record<string, unknown> | undefined;
|
|
146
166
|
} | undefined;
|
|
147
|
-
}>, {
|
|
148
167
|
console?: {
|
|
149
168
|
port?: string | undefined;
|
|
150
169
|
baudRate?: number | undefined;
|
|
151
170
|
} | undefined;
|
|
152
|
-
|
|
171
|
+
native?: Record<string, unknown> | undefined;
|
|
172
|
+
zephyr?: {
|
|
173
|
+
kconfig?: Record<string, string> | undefined;
|
|
174
|
+
cmakeArgs?: string[] | undefined;
|
|
175
|
+
runner?: string | undefined;
|
|
176
|
+
} | undefined;
|
|
177
|
+
}>, {
|
|
178
|
+
entry?: string | undefined;
|
|
153
179
|
target?: string | undefined;
|
|
180
|
+
mcu?: string | undefined;
|
|
181
|
+
board?: string | undefined;
|
|
182
|
+
contract?: string | undefined;
|
|
154
183
|
framework?: string | undefined;
|
|
155
|
-
|
|
184
|
+
psram?: "opi" | "quad" | undefined;
|
|
156
185
|
output?: {
|
|
157
186
|
framework?: string | undefined;
|
|
187
|
+
optimize?: "none" | "size" | "speed" | "balanced" | undefined;
|
|
158
188
|
outDir?: string | undefined;
|
|
159
|
-
optimize?: "size" | "none" | "speed" | "balanced" | undefined;
|
|
160
189
|
defines?: Record<string, string> | undefined;
|
|
161
190
|
extraFlags?: string[] | undefined;
|
|
162
191
|
} | undefined;
|
|
163
|
-
|
|
164
|
-
mcu?: string | undefined;
|
|
192
|
+
frameworkData?: Record<string, unknown> | undefined;
|
|
165
193
|
include?: string[] | undefined;
|
|
166
|
-
entry?: string | undefined;
|
|
167
|
-
toolchain?: {
|
|
168
|
-
type?: string | undefined;
|
|
169
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
170
|
-
} | undefined;
|
|
171
|
-
contract?: string | undefined;
|
|
172
194
|
exclude?: string[] | undefined;
|
|
173
195
|
test?: {
|
|
174
|
-
buildTarget?: string | undefined;
|
|
175
|
-
port?: string | undefined;
|
|
176
196
|
board?: string | undefined;
|
|
177
|
-
baudRate?: number | undefined;
|
|
178
197
|
include?: string[] | undefined;
|
|
198
|
+
port?: string | undefined;
|
|
199
|
+
baudRate?: number | undefined;
|
|
179
200
|
timeout?: number | undefined;
|
|
201
|
+
buildTarget?: string | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
toolchain?: {
|
|
204
|
+
type?: string | undefined;
|
|
205
|
+
frameworkOptions?: Record<string, unknown> | undefined;
|
|
180
206
|
} | undefined;
|
|
181
|
-
}, {
|
|
182
207
|
console?: {
|
|
183
208
|
port?: string | undefined;
|
|
184
209
|
baudRate?: number | undefined;
|
|
185
210
|
} | undefined;
|
|
186
|
-
|
|
211
|
+
native?: Record<string, unknown> | undefined;
|
|
212
|
+
zephyr?: {
|
|
213
|
+
kconfig?: Record<string, string> | undefined;
|
|
214
|
+
cmakeArgs?: string[] | undefined;
|
|
215
|
+
runner?: string | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
entry?: string | undefined;
|
|
187
219
|
target?: string | undefined;
|
|
220
|
+
mcu?: string | undefined;
|
|
221
|
+
board?: string | undefined;
|
|
222
|
+
contract?: string | undefined;
|
|
188
223
|
framework?: string | undefined;
|
|
189
|
-
|
|
224
|
+
psram?: "opi" | "quad" | undefined;
|
|
190
225
|
output?: {
|
|
191
226
|
framework?: string | undefined;
|
|
227
|
+
optimize?: "none" | "size" | "speed" | "balanced" | undefined;
|
|
192
228
|
outDir?: string | undefined;
|
|
193
|
-
optimize?: "size" | "none" | "speed" | "balanced" | undefined;
|
|
194
229
|
defines?: Record<string, string> | undefined;
|
|
195
230
|
extraFlags?: string[] | undefined;
|
|
196
231
|
} | undefined;
|
|
197
|
-
|
|
198
|
-
mcu?: string | undefined;
|
|
232
|
+
frameworkData?: Record<string, unknown> | undefined;
|
|
199
233
|
include?: string[] | undefined;
|
|
200
|
-
|
|
234
|
+
exclude?: string[] | undefined;
|
|
235
|
+
test?: {
|
|
236
|
+
board?: string | undefined;
|
|
237
|
+
include?: string[] | undefined;
|
|
238
|
+
port?: string | undefined;
|
|
239
|
+
baudRate?: number | undefined;
|
|
240
|
+
timeout?: number | undefined;
|
|
241
|
+
buildTarget?: string | undefined;
|
|
242
|
+
} | undefined;
|
|
201
243
|
toolchain?: {
|
|
202
244
|
type?: string | undefined;
|
|
203
245
|
frameworkOptions?: Record<string, unknown> | undefined;
|
|
204
246
|
} | undefined;
|
|
205
|
-
|
|
206
|
-
exclude?: string[] | undefined;
|
|
207
|
-
test?: {
|
|
208
|
-
buildTarget?: string | undefined;
|
|
247
|
+
console?: {
|
|
209
248
|
port?: string | undefined;
|
|
210
|
-
board?: string | undefined;
|
|
211
249
|
baudRate?: number | undefined;
|
|
212
|
-
|
|
213
|
-
|
|
250
|
+
} | undefined;
|
|
251
|
+
native?: Record<string, unknown> | undefined;
|
|
252
|
+
zephyr?: {
|
|
253
|
+
kconfig?: Record<string, string> | undefined;
|
|
254
|
+
cmakeArgs?: string[] | undefined;
|
|
255
|
+
runner?: string | undefined;
|
|
214
256
|
} | undefined;
|
|
215
257
|
}>;
|
|
216
258
|
/** Inferred TypeScript type from the Zod schema. */
|
package/dist/config-schema.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
/** Optimization levels accepted by the output.optimize field. */
|
|
10
10
|
const OptimizationLevel = z.enum(['none', 'size', 'speed', 'balanced']);
|
|
11
|
+
/** PSRAM types accepted by the top-level `psram` field (ESP32 PSRAM variants). */
|
|
12
|
+
const PsramType = z.enum(['opi', 'quad']);
|
|
11
13
|
/** Schema for the `output` section. */
|
|
12
14
|
const OutputConfig = z.object({
|
|
13
15
|
framework: z.string().min(1).optional(),
|
|
@@ -35,6 +37,12 @@ const ToolchainConfig = z.object({
|
|
|
35
37
|
type: z.string().optional(),
|
|
36
38
|
frameworkOptions: z.record(z.string(), z.unknown()).optional(),
|
|
37
39
|
}).strict();
|
|
40
|
+
/** Schema for the `zephyr` section. */
|
|
41
|
+
const ZephyrConfig = z.object({
|
|
42
|
+
kconfig: z.record(z.string(), z.string()).optional(),
|
|
43
|
+
cmakeArgs: z.array(z.string()).optional(),
|
|
44
|
+
runner: z.string().optional(),
|
|
45
|
+
}).strict();
|
|
38
46
|
/**
|
|
39
47
|
* Schema for the full CuttlefishConfig shape.
|
|
40
48
|
*
|
|
@@ -47,6 +55,11 @@ export const CuttlefishConfigSchema = z.object({
|
|
|
47
55
|
board: z.string().optional(),
|
|
48
56
|
contract: z.string().optional(),
|
|
49
57
|
framework: z.string().optional(),
|
|
58
|
+
/** ESP32 PSRAM type. When set, the framework emits the PSRAM-enabling
|
|
59
|
+
* Kconfig/define so canvas allocations prefer external RAM (large scroll
|
|
60
|
+
* viewports/lists stop failing on PSRAM targets). No effect on boards
|
|
61
|
+
* without PSRAM (the runtime falls back to SRAM then the band renderer). */
|
|
62
|
+
psram: PsramType.optional(),
|
|
50
63
|
output: OutputConfig.optional(),
|
|
51
64
|
frameworkData: z.record(z.string(), z.unknown()).optional(),
|
|
52
65
|
include: z.array(z.string()).optional(),
|
|
@@ -55,6 +68,7 @@ export const CuttlefishConfigSchema = z.object({
|
|
|
55
68
|
toolchain: ToolchainConfig.optional(),
|
|
56
69
|
console: ConsoleConfig.optional(),
|
|
57
70
|
native: z.record(z.string(), z.unknown()).optional(),
|
|
71
|
+
zephyr: ZephyrConfig.optional(),
|
|
58
72
|
}).strict().refine(data => !(data.board && data.contract), {
|
|
59
73
|
message: "Specifying both 'board' and 'contract' is not allowed. Choose one.",
|
|
60
74
|
path: ['board'],
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The directory (relative to the project root) where board.ts is generated. */
|
|
2
|
+
export declare const CUTTLEFISH_DIR = ".cuttlefish";
|
|
3
|
+
export interface GenerateBoardOptions {
|
|
4
|
+
/** Absolute project root dir (where .cuttlefish/ lives). */
|
|
5
|
+
projectDir: string;
|
|
6
|
+
/** MCU package specifier, e.g. '@typecad/mcu-atmega328p'. */
|
|
7
|
+
mcuPackage: string;
|
|
8
|
+
/** Matched MCU pin names to re-export (e.g. ['PB5','PC4']). */
|
|
9
|
+
connectedPins: string[];
|
|
10
|
+
/** Selected peripheral instance names to re-export (e.g. ['I2C0']). */
|
|
11
|
+
peripherals: string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Writes the narrowed `.cuttlefish/board.ts`.
|
|
15
|
+
* @returns the absolute path to the generated file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateBoardFile(opts: GenerateBoardOptions): string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Board generator — emits the narrowed `.cuttlefish/board.ts` for a contract
|
|
3
|
+
//
|
|
4
|
+
// Given the MCU package name plus the matched pin and peripheral names, writes
|
|
5
|
+
// a board.ts that:
|
|
6
|
+
// - re-exports the full HAL surface from @typecad/hal (constants, functions,
|
|
7
|
+
// timing, math, GPIO/Pin helpers, buses) so firmware has the complete
|
|
8
|
+
// runtime vocabulary; and
|
|
9
|
+
// - re-exports ONLY the connected pins and selected peripherals from the MCU
|
|
10
|
+
// package, so any pin the PCB did not wire is absent from `@typecad/board`
|
|
11
|
+
// and using it becomes a compile error.
|
|
12
|
+
//
|
|
13
|
+
// The emitted file is consumed via cuttlefish-env.d.ts, which emits
|
|
14
|
+
// `declare module '@typecad/board' { export * from './board.js'; ... }`
|
|
15
|
+
// for contract-based configs (see config-loader.ts). The './board.js' relative
|
|
16
|
+
// specifier resolves to this file in the same `.cuttlefish/` directory.
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
/** The directory (relative to the project root) where board.ts is generated. */
|
|
21
|
+
export const CUTTLEFISH_DIR = '.cuttlefish';
|
|
22
|
+
/**
|
|
23
|
+
* Writes the narrowed `.cuttlefish/board.ts`.
|
|
24
|
+
* @returns the absolute path to the generated file.
|
|
25
|
+
*/
|
|
26
|
+
export function generateBoardFile(opts) {
|
|
27
|
+
const { projectDir, mcuPackage, connectedPins, peripherals } = opts;
|
|
28
|
+
const cuttlefishDir = path.join(projectDir, CUTTLEFISH_DIR);
|
|
29
|
+
if (!fs.existsSync(cuttlefishDir)) {
|
|
30
|
+
fs.mkdirSync(cuttlefishDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
const lines = [
|
|
33
|
+
'// Auto-generated by the cuttlefish transpiler from a TypeCAD contract.',
|
|
34
|
+
'// Do not edit manually — regenerate by re-running cuttlefish.',
|
|
35
|
+
'//',
|
|
36
|
+
'// This board exposes only the pins and peripherals that the source contract',
|
|
37
|
+
`// (${mcuPackage}) declares as connected on the PCB. Pins the board did not wire`,
|
|
38
|
+
'// are intentionally absent: using one is a compile error.',
|
|
39
|
+
'',
|
|
40
|
+
'// Full HAL runtime surface (constants, timing, math, GPIO/bus helpers).',
|
|
41
|
+
"export * from '@typecad/hal';",
|
|
42
|
+
'',
|
|
43
|
+
'// Narrowed pin set — only pins the contract declares connected.',
|
|
44
|
+
];
|
|
45
|
+
if (connectedPins.length > 0) {
|
|
46
|
+
lines.push(`export { ${connectedPins.join(', ')} } from '${mcuPackage}';`);
|
|
47
|
+
}
|
|
48
|
+
if (peripherals.length > 0) {
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push('// Narrowed peripheral set — only buses whose pins are wired on the PCB.');
|
|
51
|
+
lines.push(`export { ${peripherals.join(', ')} } from '${mcuPackage}';`);
|
|
52
|
+
}
|
|
53
|
+
lines.push(''); // trailing newline
|
|
54
|
+
const outPath = path.join(cuttlefishDir, 'board.ts');
|
|
55
|
+
fs.writeFileSync(outPath, lines.join('\n'), 'utf-8');
|
|
56
|
+
return outPath;
|
|
57
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Contract schema version. Only 1 is currently defined. */
|
|
3
|
+
export declare const CONTRACT_VERSION: 1;
|
|
4
|
+
/**
|
|
5
|
+
* An external component on the same net as an MCU pin. Validated LENIENTLY:
|
|
6
|
+
* cuttlefish does not act on component metadata, so we only require the fields
|
|
7
|
+
* the firmware toolchain reads (reference + dnp) and accept unknown extras
|
|
8
|
+
* (voltage, wattage, tolerance, ...) without rejecting the contract. This
|
|
9
|
+
* keeps cuttlefish forward-compatible with typecad.net adding component fields.
|
|
10
|
+
*/
|
|
11
|
+
declare const ContractComponentSchema: z.ZodObject<{
|
|
12
|
+
reference: z.ZodString;
|
|
13
|
+
dnp: z.ZodBoolean;
|
|
14
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
15
|
+
reference: z.ZodString;
|
|
16
|
+
dnp: z.ZodBoolean;
|
|
17
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
18
|
+
reference: z.ZodString;
|
|
19
|
+
dnp: z.ZodBoolean;
|
|
20
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
21
|
+
/**
|
|
22
|
+
* Info about a single connected MCU pin. The fields cuttlefish consumes
|
|
23
|
+
* (pinName, pinType, net) are required; boardName is optional (present only
|
|
24
|
+
* when typecad.net's Component.typehal map was set).
|
|
25
|
+
*/
|
|
26
|
+
declare const ContractPinSchema: z.ZodObject<{
|
|
27
|
+
pinName: z.ZodString;
|
|
28
|
+
pinType: z.ZodString;
|
|
29
|
+
boardName: z.ZodOptional<z.ZodString>;
|
|
30
|
+
net: z.ZodString;
|
|
31
|
+
externalComponents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
32
|
+
reference: z.ZodString;
|
|
33
|
+
dnp: z.ZodBoolean;
|
|
34
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
35
|
+
reference: z.ZodString;
|
|
36
|
+
dnp: z.ZodBoolean;
|
|
37
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
38
|
+
reference: z.ZodString;
|
|
39
|
+
dnp: z.ZodBoolean;
|
|
40
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
pinName: string;
|
|
43
|
+
pinType: string;
|
|
44
|
+
net: string;
|
|
45
|
+
externalComponents: z.objectOutputType<{
|
|
46
|
+
reference: z.ZodString;
|
|
47
|
+
dnp: z.ZodBoolean;
|
|
48
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
49
|
+
boardName?: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
pinName: string;
|
|
52
|
+
pinType: string;
|
|
53
|
+
net: string;
|
|
54
|
+
boardName?: string | undefined;
|
|
55
|
+
externalComponents?: z.objectInputType<{
|
|
56
|
+
reference: z.ZodString;
|
|
57
|
+
dnp: z.ZodBoolean;
|
|
58
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
59
|
+
}>;
|
|
60
|
+
/** Which peripheral buses have all their required pins wired. */
|
|
61
|
+
declare const AvailablePeripheralsSchema: z.ZodObject<{
|
|
62
|
+
i2c: z.ZodBoolean;
|
|
63
|
+
spi: z.ZodBoolean;
|
|
64
|
+
uart: z.ZodBoolean;
|
|
65
|
+
}, "strict", z.ZodTypeAny, {
|
|
66
|
+
i2c: boolean;
|
|
67
|
+
spi: boolean;
|
|
68
|
+
uart: boolean;
|
|
69
|
+
}, {
|
|
70
|
+
i2c: boolean;
|
|
71
|
+
spi: boolean;
|
|
72
|
+
uart: boolean;
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* The top-level contract object. `.strict()` so a future v2 contract with new
|
|
76
|
+
* top-level keys is rejected clearly (complementing the version check) rather
|
|
77
|
+
* than silently accepted with the new fields dropped.
|
|
78
|
+
*/
|
|
79
|
+
export declare const HwContractSchema: z.ZodObject<{
|
|
80
|
+
version: z.ZodLiteral<1>;
|
|
81
|
+
mcu: z.ZodObject<{
|
|
82
|
+
symbol: z.ZodString;
|
|
83
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
84
|
+
symbol: z.ZodString;
|
|
85
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
86
|
+
symbol: z.ZodString;
|
|
87
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
88
|
+
connectedPins: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
89
|
+
pinName: z.ZodString;
|
|
90
|
+
pinType: z.ZodString;
|
|
91
|
+
boardName: z.ZodOptional<z.ZodString>;
|
|
92
|
+
net: z.ZodString;
|
|
93
|
+
externalComponents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
94
|
+
reference: z.ZodString;
|
|
95
|
+
dnp: z.ZodBoolean;
|
|
96
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
97
|
+
reference: z.ZodString;
|
|
98
|
+
dnp: z.ZodBoolean;
|
|
99
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
100
|
+
reference: z.ZodString;
|
|
101
|
+
dnp: z.ZodBoolean;
|
|
102
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
103
|
+
}, "strict", z.ZodTypeAny, {
|
|
104
|
+
pinName: string;
|
|
105
|
+
pinType: string;
|
|
106
|
+
net: string;
|
|
107
|
+
externalComponents: z.objectOutputType<{
|
|
108
|
+
reference: z.ZodString;
|
|
109
|
+
dnp: z.ZodBoolean;
|
|
110
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
111
|
+
boardName?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
pinName: string;
|
|
114
|
+
pinType: string;
|
|
115
|
+
net: string;
|
|
116
|
+
boardName?: string | undefined;
|
|
117
|
+
externalComponents?: z.objectInputType<{
|
|
118
|
+
reference: z.ZodString;
|
|
119
|
+
dnp: z.ZodBoolean;
|
|
120
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
121
|
+
}>>;
|
|
122
|
+
availablePeripherals: z.ZodObject<{
|
|
123
|
+
i2c: z.ZodBoolean;
|
|
124
|
+
spi: z.ZodBoolean;
|
|
125
|
+
uart: z.ZodBoolean;
|
|
126
|
+
}, "strict", z.ZodTypeAny, {
|
|
127
|
+
i2c: boolean;
|
|
128
|
+
spi: boolean;
|
|
129
|
+
uart: boolean;
|
|
130
|
+
}, {
|
|
131
|
+
i2c: boolean;
|
|
132
|
+
spi: boolean;
|
|
133
|
+
uart: boolean;
|
|
134
|
+
}>;
|
|
135
|
+
}, "strict", z.ZodTypeAny, {
|
|
136
|
+
mcu: {
|
|
137
|
+
symbol: string;
|
|
138
|
+
} & {
|
|
139
|
+
[k: string]: unknown;
|
|
140
|
+
};
|
|
141
|
+
version: 1;
|
|
142
|
+
connectedPins: Record<string, {
|
|
143
|
+
pinName: string;
|
|
144
|
+
pinType: string;
|
|
145
|
+
net: string;
|
|
146
|
+
externalComponents: z.objectOutputType<{
|
|
147
|
+
reference: z.ZodString;
|
|
148
|
+
dnp: z.ZodBoolean;
|
|
149
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
150
|
+
boardName?: string | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
availablePeripherals: {
|
|
153
|
+
i2c: boolean;
|
|
154
|
+
spi: boolean;
|
|
155
|
+
uart: boolean;
|
|
156
|
+
};
|
|
157
|
+
}, {
|
|
158
|
+
mcu: {
|
|
159
|
+
symbol: string;
|
|
160
|
+
} & {
|
|
161
|
+
[k: string]: unknown;
|
|
162
|
+
};
|
|
163
|
+
version: 1;
|
|
164
|
+
connectedPins: Record<string, {
|
|
165
|
+
pinName: string;
|
|
166
|
+
pinType: string;
|
|
167
|
+
net: string;
|
|
168
|
+
boardName?: string | undefined;
|
|
169
|
+
externalComponents?: z.objectInputType<{
|
|
170
|
+
reference: z.ZodString;
|
|
171
|
+
dnp: z.ZodBoolean;
|
|
172
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
173
|
+
}>;
|
|
174
|
+
availablePeripherals: {
|
|
175
|
+
i2c: boolean;
|
|
176
|
+
spi: boolean;
|
|
177
|
+
uart: boolean;
|
|
178
|
+
};
|
|
179
|
+
}>;
|
|
180
|
+
export type ContractComponent = z.infer<typeof ContractComponentSchema>;
|
|
181
|
+
export type ContractPin = z.infer<typeof ContractPinSchema>;
|
|
182
|
+
export type AvailablePeripherals = z.infer<typeof AvailablePeripheralsSchema>;
|
|
183
|
+
export type HwContract = z.infer<typeof HwContractSchema>;
|
|
184
|
+
/**
|
|
185
|
+
* Parses a TypeCAD contract file.
|
|
186
|
+
*
|
|
187
|
+
* The version is checked first as a fast path so a v2 (or later) contract
|
|
188
|
+
* fails with "unsupported version, update cuttlefish" rather than a cascade
|
|
189
|
+
* of field-mismatch errors. After the version check, the full schema is
|
|
190
|
+
* applied for precise per-field validation.
|
|
191
|
+
*
|
|
192
|
+
* @throws on an unreadable file, invalid JSON, unsupported version, or
|
|
193
|
+
* schema-validation failure (with a path-annotated message).
|
|
194
|
+
*/
|
|
195
|
+
export declare function parseContractFile(contractPath: string): HwContract;
|
|
196
|
+
/**
|
|
197
|
+
* Matches contract pins to canonical MCU pin names (e.g. 'PB5', 'PC4').
|
|
198
|
+
*
|
|
199
|
+
* Strategy (boardName-first, substring fallback):
|
|
200
|
+
* 1. If the contract pin carries a `boardName` (populated by typecad.net when
|
|
201
|
+
* Component.typehal was set) and that name appears in mcuPinNames, use it
|
|
202
|
+
* directly — it is the user-validated mapping.
|
|
203
|
+
* 2. Otherwise, substring-match the KiCAD `pinName` against mcuPinNames
|
|
204
|
+
* (e.g. "XTAL1/PB6" contains "PB6"). This covers contracts emitted without
|
|
205
|
+
* a typehal map.
|
|
206
|
+
*
|
|
207
|
+
* Power/ground pins are excluded. The result is de-duplicated.
|
|
208
|
+
*/
|
|
209
|
+
export declare function matchConnectedPins(contract: HwContract, mcuPinNames: readonly string[]): string[];
|
|
210
|
+
/**
|
|
211
|
+
* Selects which MCU peripheral instance names to re-export based on the
|
|
212
|
+
* contract's availablePeripherals. If the contract says SPI isn't wired,
|
|
213
|
+
* SPI0 (and friends) is dropped from the narrowed board — so `SPI0.begin()`
|
|
214
|
+
* becomes a compile error on a board whose PCB doesn't route SPI.
|
|
215
|
+
*/
|
|
216
|
+
export declare function selectPeripherals(contract: HwContract, mcuPeripheralNames: readonly string[]): string[];
|
|
217
|
+
export {};
|