From 1ac8e7f2861003af42fcb886d4c4987bf1a001aa Mon Sep 17 00:00:00 2001 From: AnasSarkiz Date: Tue, 6 Oct 2026 20:38:47 +0200 Subject: [PATCH 1/4] Bundle CC2340 bidirectional capability handling in TI CLI --- package.json | 2 +- scripts/test-npm-package.mjs | 2 ++ tests/cli/sysconfig-errors-snapshot.test.ts | 10 ++++++---- tests/cli/sysconfig-from-circuit.test.mjs | 9 +++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 2fc22d0..75e34ac 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@types/bun": "^1.4.0", "@types/react": "^19.2.17", "bun-match-svg": "^0.0.17", - "circuit-json-to-sysconfig": "github:tscircuit/circuit-json-to-sysconfig#3da9ac4b464a84eac13615dc684da7105065c685", + "circuit-json-to-sysconfig": "github:tscircuit/circuit-json-to-sysconfig#aecec5b4b0afe163d4fabf89abd5c640df0bb9a3", "circuit-to-svg": "0.0.410", "tscircuit": "0.0.2745", "typescript": "^5.0.0" diff --git a/scripts/test-npm-package.mjs b/scripts/test-npm-package.mjs index 26a7fc9..932a0e0 100644 --- a/scripts/test-npm-package.mjs +++ b/scripts/test-npm-package.mjs @@ -157,6 +157,7 @@ async function testCli({ command, cwd }) { name: "ENABLE", pin_number: 4, is_output: true, + is_bidirectional: true, }, ]), ); @@ -202,6 +203,7 @@ async function testCli({ command, cwd }) { name: "ENABLE", pin_number: 4, is_output: true, + is_bidirectional: true, }, { type: "source_trace", diff --git a/tests/cli/sysconfig-errors-snapshot.test.ts b/tests/cli/sysconfig-errors-snapshot.test.ts index 0b85437..28d1684 100644 --- a/tests/cli/sysconfig-errors-snapshot.test.ts +++ b/tests/cli/sysconfig-errors-snapshot.test.ts @@ -68,6 +68,7 @@ test("Circuit JSON error output names unresolved pins without IDs or a stack", ( name: "DIO11", pin_number: 4, is_gpio: true, + is_bidirectional: true, }, { type: "source_port", @@ -76,6 +77,7 @@ test("Circuit JSON error output names unresolved pins without IDs or a stack", ( name: "DIO13", pin_number: 6, is_gpio: true, + is_bidirectional: true, }, { type: "source_trace", @@ -95,7 +97,7 @@ test("Circuit JSON error output names unresolved pins without IDs or a stack", ( - U1 pin 4 (DIO11): no GPIO direction or supported peripheral selected - U1 pin 6 (DIO13): no GPIO direction or supported peripheral selected Update U1's TSX pinAttributes with the intended function for each listed pin: set exactly one of isInput: true or isOutput: true for GPIO, or activeCapability: "i2c_sda" / "i2c_scl" for I2C. - Datasheet capabilities such as isGpio describe what a pin supports; they do not select how this board uses it. + Datasheet capabilities such as isGpio and isBidirectional describe what a pin supports; they do not select how this board uses it. " `); }); @@ -108,8 +110,8 @@ test("TSX error output explains board choices without a request file or stack", @@ -124,7 +126,7 @@ test("TSX error output explains board choices without a request file or stack", - U1 pin 4 (DIO11): no GPIO direction or supported peripheral selected - U1 pin 6 (DIO13): no GPIO direction or supported peripheral selected Update U1's TSX pinAttributes with the intended function for each listed pin: set exactly one of isInput: true or isOutput: true for GPIO, or activeCapability: "i2c_sda" / "i2c_scl" for I2C. - Datasheet capabilities such as isGpio describe what a pin supports; they do not select how this board uses it. + Datasheet capabilities such as isGpio and isBidirectional describe what a pin supports; they do not select how this board uses it. " `); }); diff --git a/tests/cli/sysconfig-from-circuit.test.mjs b/tests/cli/sysconfig-from-circuit.test.mjs index 7f73a92..229714c 100644 --- a/tests/cli/sysconfig-from-circuit.test.mjs +++ b/tests/cli/sysconfig-from-circuit.test.mjs @@ -183,8 +183,8 @@ test("TSX pinAttributes export selected GPIO roles without a request file", asyn );`, @@ -200,6 +200,11 @@ test("TSX pinAttributes export selected GPIO roles without a request file", asyn const exported = JSON.parse( readFileSync(join(f.cwd, "dist/board/circuit.json"), "utf8"), ); + assert.ok( + exported + .filter((port) => port.type === "source_port") + .every((port) => port.is_bidirectional === true), + ); assert.equal( exported.find( (port) => port.type === "source_port" && port.pin_number === 4, From 89226a572e0cde3476b49e1f228cd479cc5d872d Mon Sep 17 00:00:00 2001 From: AnasSarkiz Date: Tue, 6 Oct 2026 21:42:07 +0200 Subject: [PATCH 2/4] Bundle concise GPIO direction errors in TI CLI --- package.json | 2 +- tests/cli/sysconfig-errors-snapshot.test.ts | 14 ++++++-------- tests/cli/sysconfig-from-circuit.test.mjs | 5 ++++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 75e34ac..b6d882b 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@types/bun": "^1.4.0", "@types/react": "^19.2.17", "bun-match-svg": "^0.0.17", - "circuit-json-to-sysconfig": "github:tscircuit/circuit-json-to-sysconfig#aecec5b4b0afe163d4fabf89abd5c640df0bb9a3", + "circuit-json-to-sysconfig": "github:tscircuit/circuit-json-to-sysconfig#f31423c8b0547b0c03315b894f955a8b8f2d2436", "circuit-to-svg": "0.0.410", "tscircuit": "0.0.2745", "typescript": "^5.0.0" diff --git a/tests/cli/sysconfig-errors-snapshot.test.ts b/tests/cli/sysconfig-errors-snapshot.test.ts index 28d1684..2a1835c 100644 --- a/tests/cli/sysconfig-errors-snapshot.test.ts +++ b/tests/cli/sysconfig-errors-snapshot.test.ts @@ -94,10 +94,9 @@ test("Circuit JSON error output names unresolved pins without IDs or a stack", ( expect(stderr).toMatchInlineSnapshot(` "Failed to generate SysConfig: SysConfig conversion failed: Unresolved CC2340 pin configuration for U1 (CC2340R52E0RGER): - - U1 pin 4 (DIO11): no GPIO direction or supported peripheral selected - - U1 pin 6 (DIO13): no GPIO direction or supported peripheral selected - Update U1's TSX pinAttributes with the intended function for each listed pin: set exactly one of isInput: true or isOutput: true for GPIO, or activeCapability: "i2c_sda" / "i2c_scl" for I2C. - Datasheet capabilities such as isGpio and isBidirectional describe what a pin supports; they do not select how this board uses it. + - U1 pin 4 (DIO11): GPIO direction is missing + - U1 pin 6 (DIO13): GPIO direction is missing + Set exactly one of isInput: true or isOutput: true in U1's TSX pinAttributes. " `); }); @@ -123,10 +122,9 @@ test("TSX error output explains board choices without a request file or stack", expect(stderr).toMatchInlineSnapshot(` "Failed to generate SysConfig: SysConfig conversion failed: Unresolved CC2340 pin configuration for U1 (CC2340R52E0RGER): - - U1 pin 4 (DIO11): no GPIO direction or supported peripheral selected - - U1 pin 6 (DIO13): no GPIO direction or supported peripheral selected - Update U1's TSX pinAttributes with the intended function for each listed pin: set exactly one of isInput: true or isOutput: true for GPIO, or activeCapability: "i2c_sda" / "i2c_scl" for I2C. - Datasheet capabilities such as isGpio and isBidirectional describe what a pin supports; they do not select how this board uses it. + - U1 pin 4 (DIO11): GPIO direction is missing + - U1 pin 6 (DIO13): GPIO direction is missing + Set exactly one of isInput: true or isOutput: true in U1's TSX pinAttributes. " `); }); diff --git a/tests/cli/sysconfig-from-circuit.test.mjs b/tests/cli/sysconfig-from-circuit.test.mjs index 229714c..002a1aa 100644 --- a/tests/cli/sysconfig-from-circuit.test.mjs +++ b/tests/cli/sysconfig-from-circuit.test.mjs @@ -239,7 +239,10 @@ test("a TSX pin failure prints actionable labels without the converter stack", a assert.match(message, /U1 \(CC2340R52E0RGER\)/); assert.match(message, /U1 pin 4 \(DIO11\)/); assert.match(message, /U1 pin 6 \(DIO13\)/); - assert.match(message, /Update U1's TSX pinAttributes/); + assert.match( + message, + /Set exactly one of isInput: true or isOutput: true in U1's TSX pinAttributes/, + ); assert.doesNotMatch( message, /source_component_\d|source_port_\d|\bat \S+|throw new Error/, From fff676eab89b5968b087eb88c0b2b31a5fbd6774 Mon Sep 17 00:00:00 2001 From: AnasSarkiz Date: Tue, 6 Oct 2026 21:54:29 +0200 Subject: [PATCH 3/4] Bundle pin-only CC2340 error messages in TI CLI --- package.json | 2 +- tests/cli/sysconfig-errors-snapshot.test.ts | 4 ---- tests/cli/sysconfig-from-circuit.test.mjs | 16 ++++++---------- tests/cli/sysconfig.test.mjs | 6 ++++-- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index b6d882b..2a599ee 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@types/bun": "^1.4.0", "@types/react": "^19.2.17", "bun-match-svg": "^0.0.17", - "circuit-json-to-sysconfig": "github:tscircuit/circuit-json-to-sysconfig#f31423c8b0547b0c03315b894f955a8b8f2d2436", + "circuit-json-to-sysconfig": "github:tscircuit/circuit-json-to-sysconfig#05add591d6d678cc7457c985b08096690d1e3949", "circuit-to-svg": "0.0.410", "tscircuit": "0.0.2745", "typescript": "^5.0.0" diff --git a/tests/cli/sysconfig-errors-snapshot.test.ts b/tests/cli/sysconfig-errors-snapshot.test.ts index 2a1835c..3155f64 100644 --- a/tests/cli/sysconfig-errors-snapshot.test.ts +++ b/tests/cli/sysconfig-errors-snapshot.test.ts @@ -93,10 +93,8 @@ test("Circuit JSON error output names unresolved pins without IDs or a stack", ( expect(result).toEqual({ status: 1, stdout: "", sysconfigWritten: false }); expect(stderr).toMatchInlineSnapshot(` "Failed to generate SysConfig: SysConfig conversion failed: - Unresolved CC2340 pin configuration for U1 (CC2340R52E0RGER): - U1 pin 4 (DIO11): GPIO direction is missing - U1 pin 6 (DIO13): GPIO direction is missing - Set exactly one of isInput: true or isOutput: true in U1's TSX pinAttributes. " `); }); @@ -121,10 +119,8 @@ test("TSX error output explains board choices without a request file or stack", expect(result).toEqual({ status: 1, stdout: "", sysconfigWritten: false }); expect(stderr).toMatchInlineSnapshot(` "Failed to generate SysConfig: SysConfig conversion failed: - Unresolved CC2340 pin configuration for U1 (CC2340R52E0RGER): - U1 pin 4 (DIO11): GPIO direction is missing - U1 pin 6 (DIO13): GPIO direction is missing - Set exactly one of isInput: true or isOutput: true in U1's TSX pinAttributes. " `); }); diff --git a/tests/cli/sysconfig-from-circuit.test.mjs b/tests/cli/sysconfig-from-circuit.test.mjs index 002a1aa..72e25bd 100644 --- a/tests/cli/sysconfig-from-circuit.test.mjs +++ b/tests/cli/sysconfig-from-circuit.test.mjs @@ -102,14 +102,15 @@ test("connected pins with missing roles fail without a request-file suggestion", }); writeFileSync(join(f.cwd, "board.circuit.json"), JSON.stringify(incomplete)); assert.equal(await f.run(["generate-sysconfig", "board.circuit.json"]), 1); - assert.match(f.stderr.join("\n"), /U1.*CC2340R52E0RGER/); - assert.match(f.stderr.join("\n"), /pin 4[\s\S]*pinAttributes/); + assert.match( + f.stderr.join("\n"), + /- U1 pin 4 \(ENABLE\): GPIO direction is missing/, + ); assert.doesNotMatch( f.stderr.join("\n"), /request file is missing|source_component_id|source_port_id|\bat \S+|throw new Error|convert\.mjs:\d/, ); assert.doesNotMatch(f.stderr.join("\n"), /\(mcu,|\(output,/); - assert.match(f.stderr.join("\n"), /isInput: true or isOutput: true/); assert.equal(existsSync(join(f.cwd, "board.syscfg")), false); }); @@ -236,13 +237,8 @@ test("a TSX pin failure prints actionable labels without the converter stack", a ); assert.equal(await f.run(["generate-sysconfig", "board.circuit.tsx"]), 1); const message = f.stderr.join("\n"); - assert.match(message, /U1 \(CC2340R52E0RGER\)/); - assert.match(message, /U1 pin 4 \(DIO11\)/); - assert.match(message, /U1 pin 6 \(DIO13\)/); - assert.match( - message, - /Set exactly one of isInput: true or isOutput: true in U1's TSX pinAttributes/, - ); + assert.match(message, /- U1 pin 4 \(DIO11\): GPIO direction is missing/); + assert.match(message, /- U1 pin 6 \(DIO13\): GPIO direction is missing/); assert.doesNotMatch( message, /source_component_\d|source_port_\d|\bat \S+|throw new Error/, diff --git a/tests/cli/sysconfig.test.mjs b/tests/cli/sysconfig.test.mjs index fc525f7..3ebc514 100644 --- a/tests/cli/sysconfig.test.mjs +++ b/tests/cli/sysconfig.test.mjs @@ -321,8 +321,10 @@ test("missing pin functions are reported without requiring a firmware request fi assert.equal(await f.run(["generate-sysconfig", "index.circuit.tsx"]), 1); assert.ok(existsSync(join(f.cwd, "dist/index/circuit.json"))); const message = f.stderr.join("\n"); - assert.match(message, /Unresolved CC2340 pin configuration/); - assert.match(message, /pinAttributes/); + assert.match( + message, + /- U1_MCU pin 9 \(DISP_PWR_N\): GPIO direction is missing/, + ); assert.doesNotMatch( message, /source_component_\d|source_port_\d|throw new Error|\bat \S+/, From e021a0ac01d76ec9214b89c0457d7e195c9304e4 Mon Sep 17 00:00:00 2001 From: AnasSarkiz Date: Tue, 6 Oct 2026 22:41:19 +0200 Subject: [PATCH 4/4] Align SysConfig README error descriptions --- README.md | 9 ++++++--- npm/README.md | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e9c3203..4f2ec4c 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,12 @@ and their exported `source_port` flags. It does not read or require sibling Use tscircuit 0.0.2745 or newer, which exports these attributes as `is_output`, `is_input`, `is_using_internal_pullup`, and `is_configured_for_i2c_sda` / `is_configured_for_i2c_scl`. Capability flags such as `isGpio` alone do not select a pin function. Connected -pins with missing or unsupported functions produce an error identifying the -MCU name/part number, physical pin numbers/labels and required TSX attributes, -without generated record IDs or a converter stack trace. Missing MCU port +pins with missing or unsupported functions produce an error. Missing-direction +errors contain one short line per pin with the component name, physical pin +number, label and problem, for example +`- U1 pin 4 (DIO11): GPIO direction is missing`. The CLI adds its standard failure +prefix; these diagnostics omit manufacturer part numbers, TSX setup instructions, +generated record IDs and converter stack traces. Missing MCU port records or traces referencing absent source ports also fail before a new SysConfig file is written; no behavior is inferred from signal names. If more than one supported MCU is present, select one with `--component U1` diff --git a/npm/README.md b/npm/README.md index c8e98c6..6089467 100644 --- a/npm/README.md +++ b/npm/README.md @@ -58,9 +58,12 @@ ti check-sysconfig ./board.circuit.tsx Use tscircuit 0.0.2745 or newer for TSX export. For supported CC2340 circuits, GPIO/I2C choices come from existing MCU `pinAttributes` exported to Circuit JSON. No separate request JSON is required -or read implicitly. Missing connected-pin functions fail with physical pin and -signal labels and the required TSX attributes, without generated record IDs -or a converter stack trace. Missing MCU port records +or read implicitly. Missing connected-pin functions fail. Missing-direction +errors contain one short line per pin with the component name, physical pin +number, label and problem, for example +`- U1 pin 4 (DIO11): GPIO direction is missing`. The CLI adds its standard failure +prefix; these diagnostics omit manufacturer part numbers, TSX setup instructions, +generated record IDs and converter stack traces. Missing MCU port records or connected source-port records also fail before a new `.syscfg` is written. Use `--component U1` when selecting between multiple MCUs. Connected 32768 Hz two-terminal crystals on MCU pins 14/15 select the external