@typecad/cuttlefish 1.0.0-alpha.6 → 1.0.0-alpha.8
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/dist/api/config.d.ts +32 -0
- 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 +581 -0
- package/dist/api/shared/framework-manifest.js +182 -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 +755 -1
- package/dist/api/shared/hal-op-ir.js +129 -1
- package/dist/api/shared/index.d.ts +20 -2
- package/dist/api/shared/index.js +25 -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 +113 -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/toolchain-types.d.ts +17 -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.js +186 -82
- 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/init-scaffold.d.ts +9 -2
- package/dist/create/init-scaffold.js +0 -14
- package/dist/create/init-templates.d.ts +2 -0
- package/dist/create/init-templates.js +74 -8
- package/dist/create/init-wizard.js +31 -7
- 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 +257 -36
- 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/ir/adc-range-validation.js +14 -1
- 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 +164 -0
- 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 +723 -1
- package/dist/ir/identifier-collector.js +35 -0
- package/dist/ir/interrupt-analysis.d.ts +5 -1
- package/dist/ir/interrupt-analysis.js +8 -16
- package/dist/ir/network-validation.d.ts +4 -0
- package/dist/ir/network-validation.js +184 -0
- package/dist/ir/ownership-analysis.js +20 -1
- package/dist/ir/pin-capability-validation.js +37 -0
- package/dist/ir/pin-mode-validation.d.ts +2 -2
- package/dist/ir/pin-mode-validation.js +49 -18
- package/dist/ir/program-analysis.d.ts +65 -0
- package/dist/ir/program-analysis.js +318 -2
- package/dist/ir/render-expr.js +11 -0
- package/dist/ir/timing-validation.d.ts +6 -1
- package/dist/ir/timing-validation.js +60 -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 +92 -3
- package/dist/ir/type-resolution.js +18 -0
- package/dist/ir/ui-element-auto-wire.js +7 -5
- 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 +9 -2
- 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 +7 -1
- package/dist/testing.js +8 -1
- package/dist/transpile.d.ts +3 -0
- package/dist/transpile.js +175 -41
- package/dist/types.d.ts +13 -2
- package/dist/ui-hook.d.ts +17 -3
- package/dist/utils/cli.js +78 -4
- package/dist/utils/fs.d.ts +13 -0
- package/dist/utils/fs.js +50 -0
- package/package.json +24 -5
- 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/licenses.d.ts +0 -185
- package/dist/licenses.js +0 -963
|
@@ -10,7 +10,6 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
10
10
|
description: z.ZodOptional<z.ZodString>;
|
|
11
11
|
clockSpeed: z.ZodNumber;
|
|
12
12
|
fqbn: z.ZodString;
|
|
13
|
-
platformioTarget: z.ZodString;
|
|
14
13
|
arduinoDefine: z.ZodString;
|
|
15
14
|
moduleFlash: z.ZodNullable<z.ZodNumber>;
|
|
16
15
|
externalRam: z.ZodNullable<z.ZodNumber>;
|
|
@@ -262,11 +261,11 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
262
261
|
channels: z.ZodNumber;
|
|
263
262
|
pins: z.ZodArray<z.ZodString, "many">;
|
|
264
263
|
}, "strip", z.ZodTypeAny, {
|
|
265
|
-
channels: number;
|
|
266
264
|
pins: string[];
|
|
267
|
-
}, {
|
|
268
265
|
channels: number;
|
|
266
|
+
}, {
|
|
269
267
|
pins: string[];
|
|
268
|
+
channels: number;
|
|
270
269
|
}>>>;
|
|
271
270
|
timers: z.ZodArray<z.ZodObject<{
|
|
272
271
|
instance: z.ZodNumber;
|
|
@@ -276,12 +275,12 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
276
275
|
}, "strict", z.ZodTypeAny, {
|
|
277
276
|
type: "general" | "high_speed" | "rtc" | "sys";
|
|
278
277
|
instance: number;
|
|
279
|
-
bits:
|
|
278
|
+
bits: 8 | 16 | 32 | 64;
|
|
280
279
|
features?: ("pwm" | "capture" | "compare" | "interrupt" | "dma")[] | undefined;
|
|
281
280
|
}, {
|
|
282
281
|
type: "general" | "high_speed" | "rtc" | "sys";
|
|
283
282
|
instance: number;
|
|
284
|
-
bits:
|
|
283
|
+
bits: 8 | 16 | 32 | 64;
|
|
285
284
|
features?: ("pwm" | "capture" | "compare" | "interrupt" | "dma")[] | undefined;
|
|
286
285
|
}>, "many">;
|
|
287
286
|
wifi: z.ZodObject<{
|
|
@@ -366,6 +365,32 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
366
365
|
}>;
|
|
367
366
|
}, "strict", z.ZodTypeAny, {
|
|
368
367
|
architecture: string;
|
|
368
|
+
mcuId: string;
|
|
369
|
+
mcuName: string;
|
|
370
|
+
boardId: string;
|
|
371
|
+
boardName: string;
|
|
372
|
+
vendor: string;
|
|
373
|
+
clockSpeed: number;
|
|
374
|
+
fqbn: string;
|
|
375
|
+
arduinoDefine: string;
|
|
376
|
+
moduleFlash: number | null;
|
|
377
|
+
externalRam: number | null;
|
|
378
|
+
gpioRange: [number, number];
|
|
379
|
+
excludedGpio: number[];
|
|
380
|
+
pins: {
|
|
381
|
+
gpio: number;
|
|
382
|
+
capabilities: "FULL_GPIO" | "FULL_GPIO_ANALOG" | "FULL_GPIO_TOUCH" | "FULL_GPIO_ANALOG_TOUCH" | "FULL_GPIO_DAC" | "INPUT_ONLY";
|
|
383
|
+
functions?: {
|
|
384
|
+
type: "i2c" | "spi" | "uart" | "adc" | "dac" | "pwm" | "touch" | "usb";
|
|
385
|
+
instance: number;
|
|
386
|
+
role: string;
|
|
387
|
+
}[] | undefined;
|
|
388
|
+
alt?: string[] | undefined;
|
|
389
|
+
warnings?: string[] | undefined;
|
|
390
|
+
unsafe?: boolean | undefined;
|
|
391
|
+
notes?: string | undefined;
|
|
392
|
+
onboardLed?: boolean | undefined;
|
|
393
|
+
}[];
|
|
369
394
|
i2c: Record<string, {
|
|
370
395
|
sda?: string | undefined;
|
|
371
396
|
scl?: string | undefined;
|
|
@@ -414,39 +439,7 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
414
439
|
vid: string;
|
|
415
440
|
pid: string;
|
|
416
441
|
};
|
|
417
|
-
wifi: {
|
|
418
|
-
type: "wifi" | "wifi6";
|
|
419
|
-
supportsStation: boolean;
|
|
420
|
-
supportsAp: boolean;
|
|
421
|
-
};
|
|
422
442
|
unsafe: string[];
|
|
423
|
-
mcuId: string;
|
|
424
|
-
mcuName: string;
|
|
425
|
-
boardId: string;
|
|
426
|
-
boardName: string;
|
|
427
|
-
vendor: string;
|
|
428
|
-
clockSpeed: number;
|
|
429
|
-
fqbn: string;
|
|
430
|
-
platformioTarget: string;
|
|
431
|
-
arduinoDefine: string;
|
|
432
|
-
moduleFlash: number | null;
|
|
433
|
-
externalRam: number | null;
|
|
434
|
-
gpioRange: [number, number];
|
|
435
|
-
excludedGpio: number[];
|
|
436
|
-
pins: {
|
|
437
|
-
gpio: number;
|
|
438
|
-
capabilities: "FULL_GPIO" | "FULL_GPIO_ANALOG" | "FULL_GPIO_TOUCH" | "FULL_GPIO_ANALOG_TOUCH" | "FULL_GPIO_DAC" | "INPUT_ONLY";
|
|
439
|
-
functions?: {
|
|
440
|
-
type: "i2c" | "spi" | "uart" | "adc" | "dac" | "pwm" | "touch" | "usb";
|
|
441
|
-
instance: number;
|
|
442
|
-
role: string;
|
|
443
|
-
}[] | undefined;
|
|
444
|
-
alt?: string[] | undefined;
|
|
445
|
-
warnings?: string[] | undefined;
|
|
446
|
-
unsafe?: boolean | undefined;
|
|
447
|
-
notes?: string | undefined;
|
|
448
|
-
onboardLed?: boolean | undefined;
|
|
449
|
-
}[];
|
|
450
443
|
analog: string[];
|
|
451
444
|
peripheralInstances: {
|
|
452
445
|
i2c: {
|
|
@@ -468,7 +461,7 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
468
461
|
timers: {
|
|
469
462
|
type: "general" | "high_speed" | "rtc" | "sys";
|
|
470
463
|
instance: number;
|
|
471
|
-
bits:
|
|
464
|
+
bits: 8 | 16 | 32 | 64;
|
|
472
465
|
features?: ("pwm" | "capture" | "compare" | "interrupt" | "dma")[] | undefined;
|
|
473
466
|
}[];
|
|
474
467
|
features: {
|
|
@@ -480,6 +473,11 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
480
473
|
hardwareRng: boolean;
|
|
481
474
|
fpu: boolean;
|
|
482
475
|
};
|
|
476
|
+
wifi: {
|
|
477
|
+
type: "wifi" | "wifi6";
|
|
478
|
+
supportsStation: boolean;
|
|
479
|
+
supportsAp: boolean;
|
|
480
|
+
};
|
|
483
481
|
bluetooth: {
|
|
484
482
|
type: "classic" | "ble" | "dual";
|
|
485
483
|
version: string;
|
|
@@ -491,13 +489,39 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
491
489
|
externalRam?: number | undefined;
|
|
492
490
|
rtcMemory?: number | undefined;
|
|
493
491
|
};
|
|
492
|
+
description?: string | undefined;
|
|
494
493
|
touch?: {
|
|
495
|
-
channels: number;
|
|
496
494
|
pins: string[];
|
|
495
|
+
channels: number;
|
|
497
496
|
} | null | undefined;
|
|
498
|
-
description?: string | undefined;
|
|
499
497
|
}, {
|
|
500
498
|
architecture: string;
|
|
499
|
+
mcuId: string;
|
|
500
|
+
mcuName: string;
|
|
501
|
+
boardId: string;
|
|
502
|
+
boardName: string;
|
|
503
|
+
vendor: string;
|
|
504
|
+
clockSpeed: number;
|
|
505
|
+
fqbn: string;
|
|
506
|
+
arduinoDefine: string;
|
|
507
|
+
moduleFlash: number | null;
|
|
508
|
+
externalRam: number | null;
|
|
509
|
+
gpioRange: [number, number];
|
|
510
|
+
excludedGpio: number[];
|
|
511
|
+
pins: {
|
|
512
|
+
gpio: number;
|
|
513
|
+
capabilities: "FULL_GPIO" | "FULL_GPIO_ANALOG" | "FULL_GPIO_TOUCH" | "FULL_GPIO_ANALOG_TOUCH" | "FULL_GPIO_DAC" | "INPUT_ONLY";
|
|
514
|
+
functions?: {
|
|
515
|
+
type: "i2c" | "spi" | "uart" | "adc" | "dac" | "pwm" | "touch" | "usb";
|
|
516
|
+
instance: number;
|
|
517
|
+
role: string;
|
|
518
|
+
}[] | undefined;
|
|
519
|
+
alt?: string[] | undefined;
|
|
520
|
+
warnings?: string[] | undefined;
|
|
521
|
+
unsafe?: boolean | undefined;
|
|
522
|
+
notes?: string | undefined;
|
|
523
|
+
onboardLed?: boolean | undefined;
|
|
524
|
+
}[];
|
|
501
525
|
i2c: Record<string, {
|
|
502
526
|
sda?: string | undefined;
|
|
503
527
|
scl?: string | undefined;
|
|
@@ -546,39 +570,7 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
546
570
|
vid: string;
|
|
547
571
|
pid: string;
|
|
548
572
|
};
|
|
549
|
-
wifi: {
|
|
550
|
-
type: "wifi" | "wifi6";
|
|
551
|
-
supportsStation: boolean;
|
|
552
|
-
supportsAp: boolean;
|
|
553
|
-
};
|
|
554
573
|
unsafe: string[];
|
|
555
|
-
mcuId: string;
|
|
556
|
-
mcuName: string;
|
|
557
|
-
boardId: string;
|
|
558
|
-
boardName: string;
|
|
559
|
-
vendor: string;
|
|
560
|
-
clockSpeed: number;
|
|
561
|
-
fqbn: string;
|
|
562
|
-
platformioTarget: string;
|
|
563
|
-
arduinoDefine: string;
|
|
564
|
-
moduleFlash: number | null;
|
|
565
|
-
externalRam: number | null;
|
|
566
|
-
gpioRange: [number, number];
|
|
567
|
-
excludedGpio: number[];
|
|
568
|
-
pins: {
|
|
569
|
-
gpio: number;
|
|
570
|
-
capabilities: "FULL_GPIO" | "FULL_GPIO_ANALOG" | "FULL_GPIO_TOUCH" | "FULL_GPIO_ANALOG_TOUCH" | "FULL_GPIO_DAC" | "INPUT_ONLY";
|
|
571
|
-
functions?: {
|
|
572
|
-
type: "i2c" | "spi" | "uart" | "adc" | "dac" | "pwm" | "touch" | "usb";
|
|
573
|
-
instance: number;
|
|
574
|
-
role: string;
|
|
575
|
-
}[] | undefined;
|
|
576
|
-
alt?: string[] | undefined;
|
|
577
|
-
warnings?: string[] | undefined;
|
|
578
|
-
unsafe?: boolean | undefined;
|
|
579
|
-
notes?: string | undefined;
|
|
580
|
-
onboardLed?: boolean | undefined;
|
|
581
|
-
}[];
|
|
582
574
|
analog: string[];
|
|
583
575
|
peripheralInstances: {
|
|
584
576
|
i2c: {
|
|
@@ -600,7 +592,7 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
600
592
|
timers: {
|
|
601
593
|
type: "general" | "high_speed" | "rtc" | "sys";
|
|
602
594
|
instance: number;
|
|
603
|
-
bits:
|
|
595
|
+
bits: 8 | 16 | 32 | 64;
|
|
604
596
|
features?: ("pwm" | "capture" | "compare" | "interrupt" | "dma")[] | undefined;
|
|
605
597
|
}[];
|
|
606
598
|
features: {
|
|
@@ -612,6 +604,11 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
612
604
|
hardwareRng: boolean;
|
|
613
605
|
fpu: boolean;
|
|
614
606
|
};
|
|
607
|
+
wifi: {
|
|
608
|
+
type: "wifi" | "wifi6";
|
|
609
|
+
supportsStation: boolean;
|
|
610
|
+
supportsAp: boolean;
|
|
611
|
+
};
|
|
615
612
|
bluetooth: {
|
|
616
613
|
type: "classic" | "ble" | "dual";
|
|
617
614
|
version: string;
|
|
@@ -623,11 +620,11 @@ export declare const BoardSpecSchema: z.ZodObject<{
|
|
|
623
620
|
externalRam?: number | undefined;
|
|
624
621
|
rtcMemory?: number | undefined;
|
|
625
622
|
};
|
|
623
|
+
description?: string | undefined;
|
|
626
624
|
touch?: {
|
|
627
|
-
channels: number;
|
|
628
625
|
pins: string[];
|
|
626
|
+
channels: number;
|
|
629
627
|
} | null | undefined;
|
|
630
|
-
description?: string | undefined;
|
|
631
628
|
}>;
|
|
632
629
|
export type BoardSpec = z.infer<typeof BoardSpecSchema>;
|
|
633
630
|
export declare function parseBoardSpec(jsoncText: string): BoardSpec;
|
|
@@ -111,7 +111,6 @@ export const BoardSpecSchema = z.object({
|
|
|
111
111
|
// Build
|
|
112
112
|
clockSpeed: z.number().int(),
|
|
113
113
|
fqbn: z.string().min(1),
|
|
114
|
-
platformioTarget: z.string().min(1),
|
|
115
114
|
arduinoDefine: z.string().min(1),
|
|
116
115
|
// Memory (module-level; silicon memory is derived)
|
|
117
116
|
moduleFlash: z.number().int().nullable(),
|
|
@@ -6,10 +6,17 @@ export interface KnownTarget {
|
|
|
6
6
|
isNative: boolean;
|
|
7
7
|
architecture?: ArchitectureIdentifier;
|
|
8
8
|
boardPackage?: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/** Framework package + id. Optional on embedded targets: the scaffold wizard
|
|
10
|
+
* fills these in by discovering installed @typecad/framework-* packages, so
|
|
11
|
+
* KNOWN_TARGETS board entries do not hardcode a framework. Native targets
|
|
12
|
+
* set them directly. */
|
|
13
|
+
frameworkPackage?: string;
|
|
14
|
+
framework?: string;
|
|
11
15
|
buildTarget?: string;
|
|
12
16
|
mcu?: string;
|
|
17
|
+
/** Framework-specific config (becomes frameworkData in cuttlefish.config.ts).
|
|
18
|
+
* Carries framework-specific target/options data for the selected framework. */
|
|
19
|
+
frameworkData?: Record<string, unknown>;
|
|
13
20
|
}
|
|
14
21
|
export declare function registerKnownTarget(target: KnownTarget): void;
|
|
15
22
|
export declare const KNOWN_TARGETS: ReadonlyArray<KnownTarget>;
|
|
@@ -17,8 +17,6 @@ const _knownTargets = [
|
|
|
17
17
|
isNative: false,
|
|
18
18
|
architecture: 'avr',
|
|
19
19
|
boardPackage: '@typecad/board-arduino-uno',
|
|
20
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
21
|
-
framework: 'arduino',
|
|
22
20
|
buildTarget: 'arduino:avr:uno',
|
|
23
21
|
mcu: 'atmega328p',
|
|
24
22
|
},
|
|
@@ -28,8 +26,6 @@ const _knownTargets = [
|
|
|
28
26
|
isNative: false,
|
|
29
27
|
architecture: 'esp32',
|
|
30
28
|
boardPackage: '@typecad/board-esp32-devkit',
|
|
31
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
32
|
-
framework: 'arduino',
|
|
33
29
|
buildTarget: 'esp32:esp32:esp32',
|
|
34
30
|
mcu: 'esp32',
|
|
35
31
|
},
|
|
@@ -39,8 +35,6 @@ const _knownTargets = [
|
|
|
39
35
|
isNative: false,
|
|
40
36
|
architecture: 'esp32s3',
|
|
41
37
|
boardPackage: '@typecad/board-esp32s3',
|
|
42
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
43
|
-
framework: 'arduino',
|
|
44
38
|
buildTarget: 'esp32:esp32:esp32s3',
|
|
45
39
|
mcu: 'esp32s3',
|
|
46
40
|
},
|
|
@@ -50,8 +44,6 @@ const _knownTargets = [
|
|
|
50
44
|
isNative: false,
|
|
51
45
|
architecture: 'esp32c3',
|
|
52
46
|
boardPackage: '@typecad/board-esp32c3',
|
|
53
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
54
|
-
framework: 'arduino',
|
|
55
47
|
buildTarget: 'esp32:esp32:esp32c3',
|
|
56
48
|
mcu: 'esp32c3',
|
|
57
49
|
},
|
|
@@ -61,8 +53,6 @@ const _knownTargets = [
|
|
|
61
53
|
isNative: false,
|
|
62
54
|
architecture: 'esp32c6',
|
|
63
55
|
boardPackage: '@typecad/board-esp32c6',
|
|
64
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
65
|
-
framework: 'arduino',
|
|
66
56
|
buildTarget: 'esp32:esp32:esp32c6',
|
|
67
57
|
mcu: 'esp32c6',
|
|
68
58
|
},
|
|
@@ -72,8 +62,6 @@ const _knownTargets = [
|
|
|
72
62
|
isNative: false,
|
|
73
63
|
architecture: 'rp2040',
|
|
74
64
|
boardPackage: '@typecad/board-rp2040',
|
|
75
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
76
|
-
framework: 'arduino',
|
|
77
65
|
buildTarget: 'rp2040:rp2040:rpipico',
|
|
78
66
|
mcu: 'rp2040',
|
|
79
67
|
},
|
|
@@ -83,8 +71,6 @@ const _knownTargets = [
|
|
|
83
71
|
isNative: false,
|
|
84
72
|
architecture: 'rp2350',
|
|
85
73
|
boardPackage: '@typecad/board-rp2350',
|
|
86
|
-
frameworkPackage: '@typecad/framework-arduino',
|
|
87
|
-
framework: 'arduino',
|
|
88
74
|
buildTarget: 'rp2040:rp2040:rpipico2',
|
|
89
75
|
mcu: 'rp2350',
|
|
90
76
|
},
|
|
@@ -13,6 +13,8 @@ export interface InitProjectOptions {
|
|
|
13
13
|
baudRate?: number;
|
|
14
14
|
includeSketch: boolean;
|
|
15
15
|
toolchainType?: string;
|
|
16
|
+
/** Extra frameworkData fields (e.g. `{ target: 'esp32s3' }` for framework-esp32). */
|
|
17
|
+
frameworkData?: Record<string, unknown>;
|
|
16
18
|
}
|
|
17
19
|
export declare function generateProjectPackageJson(options: InitProjectOptions): string;
|
|
18
20
|
export declare function generateProjectTsconfig(options: InitProjectOptions): string;
|
|
@@ -150,8 +150,12 @@ export default config;
|
|
|
150
150
|
`;
|
|
151
151
|
}
|
|
152
152
|
const buildTarget = options.buildTarget;
|
|
153
|
-
const resolvedToolchain = options.toolchainType
|
|
154
|
-
|
|
153
|
+
const resolvedToolchain = options.toolchainType
|
|
154
|
+
?? 'arduino-cli';
|
|
155
|
+
let frameworkDataBlock = '';
|
|
156
|
+
if (buildTarget) {
|
|
157
|
+
frameworkDataBlock = `\n // Framework data\n frameworkData: {\n buildTarget: '${buildTarget}',\n },`;
|
|
158
|
+
}
|
|
155
159
|
const mcuLine = options.mcu
|
|
156
160
|
? `\n // MCU package — provides silicon-level pin definitions\n mcu: '${options.mcu.startsWith('@') ? options.mcu : `@typecad/mcu-${options.mcu}`}',\n`
|
|
157
161
|
: '';
|
|
@@ -181,7 +185,7 @@ const config: CuttlefishConfig = {
|
|
|
181
185
|
target: '${options.architecture}',${mcuLine}${boardLine}
|
|
182
186
|
|
|
183
187
|
// Framework package — controls code generation strategy
|
|
184
|
-
framework: '${options.frameworkPackage}',${
|
|
188
|
+
framework: '${options.frameworkPackage}',${frameworkDataBlock}
|
|
185
189
|
|
|
186
190
|
// Output / build options
|
|
187
191
|
output: {
|
|
@@ -211,6 +215,22 @@ declare global {
|
|
|
211
215
|
type Owned<T = unknown> = T;
|
|
212
216
|
type Shared<T = unknown> = T;
|
|
213
217
|
type Mutable<T = unknown> = T;
|
|
218
|
+
// SafeVariable: SEU-resistant storage. The transpiler lowers SafeVariable<number>
|
|
219
|
+
// to a C++ template with inverted-redundancy storage. Declared as an interface
|
|
220
|
+
// (not a type alias) so the TS type checker recognizes method calls.
|
|
221
|
+
// Arithmetic T only (integral or floating-point); string is rejected by a
|
|
222
|
+
// static_assert in the emitted C++ template.
|
|
223
|
+
interface SafeVariable<T = number> { set(value: T): void; get(): T; valid(): boolean; hasFault(): boolean; }
|
|
224
|
+
// SafeInt: chainable bounds-checked signed-integer arithmetic. The transpiler
|
|
225
|
+
// lowers SafeInt<number> to SafeInt<int32_t> (a C++ template with sticky-fault
|
|
226
|
+
// overflow detection). Signed integer T only — unsigned/bool/float/string are
|
|
227
|
+
// rejected by a static_assert in the emitted C++ template.
|
|
228
|
+
interface SafeInt<T = number> {
|
|
229
|
+
add(delta: T): SafeInt<T>; sub(delta: T): SafeInt<T>;
|
|
230
|
+
mul(factor: T): SafeInt<T>; divide(d: T): SafeInt<T>; mod(d: T): SafeInt<T>;
|
|
231
|
+
negate(): SafeInt<T>; absValue(): SafeInt<T>;
|
|
232
|
+
get(): T; hasFault(): boolean; valid(): boolean; reset(newValue: T): void;
|
|
233
|
+
}
|
|
214
234
|
|
|
215
235
|
type uint8_t = number;
|
|
216
236
|
type int8_t = number;
|
|
@@ -236,6 +256,20 @@ declare global {
|
|
|
236
256
|
error(...args: unknown[]): void;
|
|
237
257
|
}
|
|
238
258
|
const console: Console;
|
|
259
|
+
|
|
260
|
+
// Convenience helper for volatile variables in TypeCAD programs.
|
|
261
|
+
// The transpiler detects calls to volatile() and emits the C++ volatile qualifier.
|
|
262
|
+
declare function volatile<T>(value: T): T;
|
|
263
|
+
|
|
264
|
+
// JS-style timers (declared here so a project does not need "dom" in tsconfig
|
|
265
|
+
// lib to type setInterval/setTimeout). The transpiler rewrites these to
|
|
266
|
+
// __tc_setInterval/__tc_setTimeout and emits the timer_methods polyfill when
|
|
267
|
+
// used. Note: Timing.setInterval/setTimeout (from @typecad/hal) is the
|
|
268
|
+
// preferred single entry point and is typed via the @typecad/board import.
|
|
269
|
+
declare function setInterval(handler: () => void, timeout?: number): number;
|
|
270
|
+
declare function setTimeout(handler: () => void, timeout?: number): number;
|
|
271
|
+
declare function clearInterval(id: number): void;
|
|
272
|
+
declare function clearTimeout(id: number): void;
|
|
239
273
|
}
|
|
240
274
|
|
|
241
275
|
export {};
|
|
@@ -254,6 +288,22 @@ declare global {
|
|
|
254
288
|
type Owned<T = unknown> = T;
|
|
255
289
|
type Shared<T = unknown> = T;
|
|
256
290
|
type Mutable<T = unknown> = T;
|
|
291
|
+
// SafeVariable: SEU-resistant storage. The transpiler lowers SafeVariable<number>
|
|
292
|
+
// to a C++ template with inverted-redundancy storage. Declared as an interface
|
|
293
|
+
// (not a type alias) so the TS type checker recognizes method calls.
|
|
294
|
+
// Arithmetic T only (integral or floating-point); string is rejected by a
|
|
295
|
+
// static_assert in the emitted C++ template.
|
|
296
|
+
interface SafeVariable<T = number> { set(value: T): void; get(): T; valid(): boolean; hasFault(): boolean; }
|
|
297
|
+
// SafeInt: chainable bounds-checked signed-integer arithmetic. The transpiler
|
|
298
|
+
// lowers SafeInt<number> to SafeInt<int32_t> (a C++ template with sticky-fault
|
|
299
|
+
// overflow detection). Signed integer T only — unsigned/bool/float/string are
|
|
300
|
+
// rejected by a static_assert in the emitted C++ template.
|
|
301
|
+
interface SafeInt<T = number> {
|
|
302
|
+
add(delta: T): SafeInt<T>; sub(delta: T): SafeInt<T>;
|
|
303
|
+
mul(factor: T): SafeInt<T>; divide(d: T): SafeInt<T>; mod(d: T): SafeInt<T>;
|
|
304
|
+
negate(): SafeInt<T>; absValue(): SafeInt<T>;
|
|
305
|
+
get(): T; hasFault(): boolean; valid(): boolean; reset(newValue: T): void;
|
|
306
|
+
}
|
|
257
307
|
|
|
258
308
|
type uint8_t = number;
|
|
259
309
|
type int8_t = number;
|
|
@@ -279,6 +329,20 @@ declare global {
|
|
|
279
329
|
error(...args: unknown[]): void;
|
|
280
330
|
}
|
|
281
331
|
const console: Console;
|
|
332
|
+
|
|
333
|
+
// Convenience helper for volatile variables in TypeCAD programs.
|
|
334
|
+
// The transpiler detects calls to volatile() and emits the C++ volatile qualifier.
|
|
335
|
+
declare function volatile<T>(value: T): T;
|
|
336
|
+
|
|
337
|
+
// JS-style timers (declared here so a project does not need "dom" in tsconfig
|
|
338
|
+
// lib to type setInterval/setTimeout). The transpiler rewrites these to
|
|
339
|
+
// __tc_setInterval/__tc_setTimeout and emits the timer_methods polyfill when
|
|
340
|
+
// used. Note: Timing.setInterval/setTimeout (from @typecad/hal) is the
|
|
341
|
+
// preferred single entry point and is typed via the @typecad/board import.
|
|
342
|
+
declare function setInterval(handler: () => void, timeout?: number): number;
|
|
343
|
+
declare function setTimeout(handler: () => void, timeout?: number): number;
|
|
344
|
+
declare function clearInterval(id: number): void;
|
|
345
|
+
declare function clearTimeout(id: number): void;
|
|
282
346
|
}
|
|
283
347
|
|
|
284
348
|
declare module '@typecad/board' {
|
|
@@ -508,11 +572,13 @@ export default [
|
|
|
508
572
|
files: ["src/**/*.ts"],
|
|
509
573
|
languageOptions: {
|
|
510
574
|
parser: tsparser,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
575
|
+
// NOTE: do NOT set parserOptions.project here. None of the rules below
|
|
576
|
+
// (no-restricted-syntax, the cuttlefish/* AST rules, no-explicit-any,
|
|
577
|
+
// no-eval, ...) consume type information, so enabling type-aware linting
|
|
578
|
+
// only forces ESLint to build a full TS type-program per file — ~3.4s of
|
|
579
|
+
// pure overhead on small projects with zero change to what is detected.
|
|
580
|
+
// If a future rule needs types, scope project to that rule only via
|
|
581
|
+
// parserOptions on a dedicated config block, not globally.
|
|
516
582
|
},
|
|
517
583
|
plugins: {
|
|
518
584
|
"@typescript-eslint": tseslint,
|
|
@@ -84,15 +84,29 @@ export async function runInitWizard(partialOptions) {
|
|
|
84
84
|
targetId = await promptSelect(rl, "Target", targetOptions);
|
|
85
85
|
}
|
|
86
86
|
const target = KNOWN_TARGETS.find((t) => t.id === targetId);
|
|
87
|
-
// 3. Framework (only for embedded targets)
|
|
87
|
+
// 3. Framework (only for embedded targets). Discover installed
|
|
88
|
+
// @typecad/framework-* packages rather than hardcoding a single option, so
|
|
89
|
+
// the wizard reflects whichever frameworks the user has installed.
|
|
88
90
|
let framework = target.framework;
|
|
89
91
|
let frameworkPackage = target.frameworkPackage;
|
|
90
92
|
if (!target.isNative) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
// Candidate framework families and their user-facing labels. The wizard
|
|
94
|
+
// shows whichever are installed (resolvable) in the user's project.
|
|
95
|
+
const frameworkCandidates = [
|
|
96
|
+
{ value: 'arduino', label: 'Arduino (digitalWrite, Wire, SPI)' },
|
|
97
|
+
{ value: 'zephyr', label: 'Zephyr RTOS' },
|
|
98
|
+
{ value: 'esp-idf', label: 'ESP-IDF' },
|
|
93
99
|
];
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
const frameworkOptions = [];
|
|
101
|
+
for (const candidate of frameworkCandidates) {
|
|
102
|
+
const pkg = `@typecad/framework-${candidate.value}`;
|
|
103
|
+
try {
|
|
104
|
+
require.resolve(`${pkg}/package.json`, { paths: [process.cwd()] });
|
|
105
|
+
frameworkOptions.push({ label: candidate.label, value: candidate.value, pkg });
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// framework not installed; skip
|
|
109
|
+
}
|
|
96
110
|
}
|
|
97
111
|
if (partialOptions?.framework) {
|
|
98
112
|
const match = frameworkOptions.find(f => f.value === partialOptions.framework);
|
|
@@ -100,6 +114,13 @@ export async function runInitWizard(partialOptions) {
|
|
|
100
114
|
frameworkPackage = match?.pkg ?? `@typecad/framework-${partialOptions.framework}`;
|
|
101
115
|
console.log(`${chalk.cyan("?")} Framework: ${chalk.white(framework)}`);
|
|
102
116
|
}
|
|
117
|
+
else if (frameworkOptions.length === 0) {
|
|
118
|
+
// No framework installed and none requested via --framework: abort
|
|
119
|
+
// rather than produce a broken scaffold with an empty framework field
|
|
120
|
+
// (which would generate invalid package.json + cuttlefish.config.ts).
|
|
121
|
+
throw new Error("No @typecad/framework-* packages found in this project. " +
|
|
122
|
+
"Install one before scaffolding, e.g.: npm i @typecad/framework-arduino");
|
|
123
|
+
}
|
|
103
124
|
else if (frameworkOptions.length === 1) {
|
|
104
125
|
framework = frameworkOptions[0].value;
|
|
105
126
|
frameworkPackage = frameworkOptions[0].pkg;
|
|
@@ -148,12 +169,15 @@ export async function runInitWizard(partialOptions) {
|
|
|
148
169
|
isNative: target.isNative,
|
|
149
170
|
architecture: target.architecture,
|
|
150
171
|
boardPackage: target.boardPackage,
|
|
151
|
-
frameworkPackage,
|
|
152
|
-
framework,
|
|
172
|
+
frameworkPackage: frameworkPackage ?? '',
|
|
173
|
+
framework: framework ?? '',
|
|
153
174
|
buildTarget: target.buildTarget,
|
|
154
175
|
mcu: target.mcu,
|
|
155
176
|
baudRate,
|
|
156
177
|
includeSketch,
|
|
178
|
+
...(target.frameworkData
|
|
179
|
+
? { frameworkData: target.frameworkData }
|
|
180
|
+
: {}),
|
|
157
181
|
};
|
|
158
182
|
}
|
|
159
183
|
catch (err) {
|