From 564bd50306b1a75b5223c2b511cf52265a2cf695 Mon Sep 17 00:00:00 2001 From: Aria00pp <123830753+Aria00pp@users.noreply.github.com> Date: Tue, 2 Jun 2026 13:28:13 +0330 Subject: [PATCH 1/2] Add Arduino sketch compile support --- .github/workflows/checks.yml | 61 ++++ README.md | 16 +- docs/ARDUINO_CLI.md | 8 + docs/PACKAGING.md | 9 +- docs/customer_handoff.md | 19 +- docs/testing.md | 70 +++- gui/portable_avr_control_studio.py | 330 +++++++++++++++++- release/BUILD_VERIFICATION.md | 19 +- release/FINAL_DELIVERY_SEQUENCE.md | 2 +- release/README.md | 2 +- release/candidates/RC-0.1.md | 6 +- .../checklists/release_readiness_checklist.md | 16 +- release/scripts/assemble_customer_package.py | 5 + release/templates/customer_zip_README.md | 16 +- release/templates/maintainer_release_notes.md | 2 +- 15 files changed, 536 insertions(+), 45 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index eeac67a..bd20658 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -22,8 +22,15 @@ jobs: from pathlib import Path from tempfile import TemporaryDirectory from gui.portable_avr_control_studio import ( + ARDUINO_CLI_MISSING_MESSAGE, + CUSTOM_SKETCH_PROTOCOL_WARNING, + SketchCompileValidationError, UploadValidationError, + build_arduino_compile_command, + find_arduino_cli_tool, parse_serial_line, + prepare_sketch_source, + validate_sketch_compile_request, validate_upload_request, ) @@ -74,6 +81,55 @@ jobs: assert 'avrdude was not found' in str(exc) else: raise AssertionError('expected missing avrdude validation failure') + + cli_tools = root / 'tools' / 'arduino-cli' + cli_tools.mkdir(parents=True) + cli_exe = cli_tools / 'arduino-cli.exe' + cli_exe.write_text('dummy compiler', encoding='utf-8') + cli = find_arduino_cli_tool(root, path_env='') + assert cli is not None and cli.source == 'bundled' + + workspace = root / 'workspace' + valid_ino = root / 'Blink.ino' + valid_ino.write_text('void setup() {}\nvoid loop() {}\n', encoding='utf-8') + prepared = prepare_sketch_source(str(valid_ino), workspace) + assert prepared.copied_source + assert prepared.sketch_folder.name == 'Blink' + assert (prepared.sketch_folder / 'Blink.ino').is_file() + + sketch_folder = root / 'CustomerSketch' + sketch_folder.mkdir() + (sketch_folder / 'CustomerSketch.ino').write_text('void setup() {}\nvoid loop() {}\n', encoding='utf-8') + prepared_folder = prepare_sketch_source(str(sketch_folder), workspace) + assert prepared_folder.sketch_folder == sketch_folder + + cmd = build_arduino_compile_command(cli, prepared_folder.sketch_folder, root / 'out') + assert cmd == [str(cli_exe), 'compile', '--fqbn', 'arduino:avr:uno', '--output-dir', str(root / 'out'), str(sketch_folder)] + + compile_cmd, compile_tool, compile_prepared = validate_sketch_compile_request(str(sketch_folder), root, workspace, path_env='') + assert compile_tool.source == 'bundled' + assert compile_prepared.sketch_folder == sketch_folder + assert '--fqbn' in compile_cmd and 'arduino:avr:uno' in compile_cmd + + bad_source = root / 'not-a-sketch.txt' + bad_source.write_text('nope', encoding='utf-8') + try: + prepare_sketch_source(str(bad_source), workspace) + except SketchCompileValidationError as exc: + assert 'ends with .ino' in str(exc) + else: + raise AssertionError('expected non-.ino source rejection') + + cli_exe.unlink() + try: + validate_sketch_compile_request(str(sketch_folder), root, workspace, path_env='') + except SketchCompileValidationError as exc: + assert str(exc) == ARDUINO_CLI_MISSING_MESSAGE + else: + raise AssertionError('expected missing Arduino CLI validation failure') + + assert 'Uploading a custom sketch replaces the built-in Portable AVR firmware' in CUSTOM_SKETCH_PROTOCOL_WARNING + assert 'Settings / Status / EEPROM controls only work' in CUSTOM_SKETCH_PROTOCOL_WARNING PY - name: Compile release assembly script @@ -87,6 +143,7 @@ jobs: rm -rf \ release/artifacts/windows/PortableAVRControlStudio.exe \ release/artifacts/windows/tools/avrdude \ + release/artifacts/windows/tools/arduino-cli \ release/artifacts/firmware/PortableAVRControlStudio.ino.hex \ release/customer_package/PortableAVRControlStudio-customer-handoff \ release/customer_package/PortableAVRControlStudio-customer-handoff.zip @@ -99,6 +156,8 @@ jobs: printf 'dummy avrdude exe for CI package assembly smoke test\n' > release/artifacts/windows/tools/avrdude/avrdude.exe printf 'dummy avrdude config for CI package assembly smoke test\n' > release/artifacts/windows/tools/avrdude/avrdude.conf printf 'dummy support dll for CI package assembly smoke test\n' > release/artifacts/windows/tools/avrdude/libusb0.dll + mkdir -p release/artifacts/windows/tools/arduino-cli + printf 'dummy arduino-cli exe for optional CI package assembly smoke test\n' > release/artifacts/windows/tools/arduino-cli/arduino-cli.exe python release/scripts/assemble_customer_package.py @@ -115,10 +174,12 @@ jobs: test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/avrdude.exe test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/avrdude.conf test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/libusb0.dll + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/arduino-cli/arduino-cli.exe git check-ignore \ release/artifacts/windows/PortableAVRControlStudio.exe \ release/artifacts/windows/tools/avrdude/avrdude.exe \ + release/artifacts/windows/tools/arduino-cli/arduino-cli.exe \ release/artifacts/firmware/PortableAVRControlStudio.ino.hex \ release/customer_package/PortableAVRControlStudio-customer-handoff \ release/customer_package/PortableAVRControlStudio-customer-handoff.zip diff --git a/README.md b/README.md index 42978af..f82e553 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,17 @@ Customer-facing runtime settings are listed in [`docs/product_spec.md`](docs/pro Hardware profiles in `docs/profiles/` document expected wiring, output polarity, sensor assumptions, and limitations. Hardware profiles do **not** auto-detect unknown hardware. Driver boards, inverted outputs, sensor circuits, or additional peripherals may require both a matching profile and matching firmware changes. -## Firmware upload status +## Firmware upload and sketch compile status -The Firmware tab uploads prepared `.hex` firmware artifacts to Arduino Uno / ATmega328P boards using bundled `tools/avrdude/` files beside the app, or `avrdude` on `PATH` as a fallback. It does not compile raw `.ino` source code inside the app. Upload success only means the `avrdude` firmware transfer command completed; it does not validate physical wiring, relay loads, sensors, power, enclosure safety, or customer hardware installation. +The Firmware tab keeps the prepared `.hex` upload workflow for Arduino Uno / ATmega328P boards using bundled `tools/avrdude/` files beside the app, or `avrdude` on `PATH` as a fallback. + +The same tab also includes **Compile Arduino Sketch for Uno** for prepared `.ino` files or Arduino Sketch folders. Sketch compilation is limited to the Arduino Uno / ATmega328P target (`arduino:avr:uno`) and requires Arduino CLI either bundled beside the app under `tools/arduino-cli/` or installed as `arduino-cli` on `PATH`. If Arduino CLI is missing, the app reports: “Arduino CLI was not found. Use a package that includes tools/arduino-cli/ or install Arduino CLI before compiling sketches.” + +Sketches that use only Arduino core features are supported directly after Arduino CLI has the `arduino:avr` core available. Sketches that use external libraries require those libraries to already be available to Arduino CLI, or to be installed intentionally by a maintainer/user with Arduino CLI. The app does not automatically repair bad code, guess missing libraries, or install random third-party libraries based on compiler errors. Compiler stdout/stderr is streamed to the Logs tab so missing-library and syntax errors are visible without crashing the GUI. + +Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. If the custom sketch only prints Serial text, the app may show logs, but Settings and Live Monitor may not work as designed. + +Compile success only means Arduino CLI reported a generated HEX. Upload success only means the `avrdude` firmware transfer command completed; neither result validates physical wiring, relay loads, sensors, power, enclosure safety, or customer hardware installation. ## Firmware compile checks @@ -131,7 +139,9 @@ arduino-cli core install arduino:avr arduino-cli compile --fqbn arduino:avr:uno --output-dir release/artifacts/firmware firmware/PortableAVRControlStudio ``` -The expected prepared firmware artifact is `release/artifacts/firmware/PortableAVRControlStudio.ino.hex`. Customer-provided source code must be reviewed and compiled into a `.hex` artifact before handoff; customers do not paste raw code into the app. Release packages should include `PortableAVRControlStudio.ino.hex` beside the EXE and `tools/avrdude/` with the Windows uploader files staged by the release workflow. +The expected prepared firmware artifact is `release/artifacts/firmware/PortableAVRControlStudio.ino.hex`. Release packages should include `PortableAVRControlStudio.ino.hex` beside the EXE and `tools/avrdude/` with the Windows uploader files staged by the release workflow. + +For customer-side `.ino` / Sketch folder compile support, stage Arduino CLI for Windows under `release/artifacts/windows/tools/arduino-cli/` when practical so it is copied into the final package under `tools/arduino-cli/`. If that folder is not staged, package assembly still succeeds, but compile support requires `arduino-cli` to be installed on the customer PC `PATH`. Do not commit generated EXE, HEX, Arduino CLI tools, avrdude tools, libraries, build folders, or ZIP files. ## Draft status and hardware-test limitation diff --git a/docs/ARDUINO_CLI.md b/docs/ARDUINO_CLI.md index 4c4eeae..844ac10 100644 --- a/docs/ARDUINO_CLI.md +++ b/docs/ARDUINO_CLI.md @@ -29,3 +29,11 @@ arduino-cli compile --fqbn arduino:avr:nano firmware/PortableAVRControlStudio The GitHub Actions workflow in `.github/workflows/checks.yml` runs the required Uno compile using `arduino/setup-arduino-cli`. The Nano command is optional documentation only and is not required for merge. These checks verify that the sketch compiles for the Arduino Uno AVR target. They do not prove relay/buzzer wiring, driver polarity, sensor calibration, EEPROM behavior on a specific board, or physical safety. Do not claim physical hardware testing until it has been performed on the target hardware profile. + +## App-based customer sketch compilation + +Portable AVR Control Studio can compile prepared `.ino` files or Arduino Sketch folders from the Firmware tab only for Arduino Uno / ATmega328P (`arduino:avr:uno`). The app discovers Arduino CLI under `tools/arduino-cli/` beside the app first, then falls back to `arduino-cli` on `PATH`. + +Sketches using only Arduino core features are supported directly after the `arduino:avr` core is available. Sketches using external libraries require those libraries to be installed or otherwise available to Arduino CLI. The app does not automatically repair source code, infer missing libraries, or install random third-party libraries from compiler output. + +Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. Compile success means Arduino CLI generated a HEX; it is not physical hardware validation. diff --git a/docs/PACKAGING.md b/docs/PACKAGING.md index 1f55d9d..ee4a959 100644 --- a/docs/PACKAGING.md +++ b/docs/PACKAGING.md @@ -51,10 +51,15 @@ The script copies these items into `release/customer_package/PortableAVRControlS 7. `docs\testing.md` 8. `docs\profiles\arduino_uno_avr.json` 9. `release/artifacts/windows/tools/avrdude/` staged as `tools/avrdude/` +10. Optional `release/artifacts/windows/tools/arduino-cli/` staged as `tools/arduino-cli/` when Arduino CLI is bundled for customer-side sketch compilation The assembly script fails if `release/artifacts/windows/tools/avrdude/` does not include `avrdude.exe` and `avrdude.conf`. The release workflow stages those files from the Arduino AVR toolchain and copies required support files from the same Windows `bin` folder. These uploader files are generated release artifacts only and must not be committed to git. -The firmware upload tab uploads prepared `.hex` artifacts to Arduino Uno using bundled or configured `avrdude`. It does not compile raw `.ino` source code. Upload success only means the firmware transfer command completed; it does not validate physical wiring, relay loads, sensors, power, or enclosure safety. +Arduino CLI bundling is optional in this PR. To make customer-side `.ino` / Sketch folder compile support self-contained, stage `arduino-cli.exe` and any required Arduino CLI support/config files under `release/artifacts/windows/tools/arduino-cli/` before running `release/scripts/assemble_customer_package.py`; the script copies the whole folder into the customer package. If that folder is absent, the script does not fail, and compile support requires `arduino-cli` to be installed on the customer PC `PATH`. + +The firmware tab uploads prepared `.hex` artifacts to Arduino Uno using bundled or configured `avrdude`. It can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P (`arduino:avr:uno`) when Arduino CLI is bundled or on `PATH`. External libraries must already be available to Arduino CLI; the app does not automatically repair source code, guess missing libraries, or install random third-party libraries from compiler output. Compile success only means Arduino CLI generated a HEX, and upload success only means the firmware transfer command completed; neither result validates physical wiring, relay loads, sensors, power, or enclosure safety. + +Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. If the custom sketch only prints Serial text, the app may show logs, but Settings and Live Monitor may not work as designed. ## Arduino Uno firmware HEX artifact @@ -73,7 +78,7 @@ arduino-cli core install arduino:avr arduino-cli compile --fqbn arduino:avr:uno --output-dir release/artifacts/firmware firmware/PortableAVRControlStudio ``` -The expected primary HEX output is `release/artifacts/firmware/PortableAVRControlStudio.ino.hex`. Treat this as a prepared artifact for the app upload workflow. Customer-provided source code must be reviewed and compiled into a `.hex` artifact before customer handoff; the app does not compile raw `.ino` source code. +The expected primary HEX output is `release/artifacts/firmware/PortableAVRControlStudio.ino.hex`. Treat this as a prepared artifact for the app upload workflow. The app's sketch compiler is intended for prepared customer sketches that compile with Arduino CLI for Uno; it is not a substitute for source review or hardware validation. ## Developer customer ZIP checklist diff --git a/docs/customer_handoff.md b/docs/customer_handoff.md index d0b9175..1b3ab76 100644 --- a/docs/customer_handoff.md +++ b/docs/customer_handoff.md @@ -9,10 +9,11 @@ A prepared customer ZIP should contain: - `PortableAVRControlStudio.exe` — Windows desktop app. - `PortableAVRControlStudio.ino.hex` — prepared Arduino Uno firmware artifact, if firmware delivery is included. - `tools/avrdude/` — bundled Windows uploader files used by the Firmware tab when included in the release package. +- `tools/arduino-cli/` — optional bundled Arduino CLI files used for `.ino` / Sketch folder compile support when included in the release package. - `docs/` — protocol, product settings, testing notes, and hardware profile documents. - `docs/profiles/arduino_uno_avr.json` — the default documented wiring/profile for Arduino Uno. -The Firmware tab can upload the prepared `.hex` file when the package includes `tools/avrdude/` or when `avrdude` is available on `PATH`. It does not compile raw source code and upload success is not physical hardware validation. +The Firmware tab can upload the prepared `.hex` file when the package includes `tools/avrdude/` or when `avrdude` is available on `PATH`. It can compile prepared `.ino` files and Arduino Sketch folders for Arduino Uno / ATmega328P only when Arduino CLI is bundled under `tools/arduino-cli/` or installed on `PATH`. Compile success and upload success are tool results only; they are not physical hardware validation. ## How to run the Windows app @@ -92,11 +93,19 @@ Saving to EEPROM stores accepted settings so they can survive reset or power los EEPROM persistence still requires validation on the target physical board before production deployment. -## Firmware artifact and upload boundary +## Firmware artifact, sketch compile, and upload boundary -The release package may include `PortableAVRControlStudio.ino.hex` at the customer package root as a prepared Arduino Uno / ATmega328P AVR firmware artifact. Customers do not paste raw code into the app, and the app does not compile raw `.ino` source code. Customer-provided source code must be reviewed and compiled into a `.hex` artifact before it is selected in the app. +The release package may include `PortableAVRControlStudio.ino.hex` at the customer package root as a prepared Arduino Uno / ATmega328P AVR firmware artifact. Customers can select that prepared `.hex` file and upload it without compiling source. -When the customer package includes `tools/avrdude/`, the Firmware tab can upload a prepared `.hex` file to an Arduino Uno using the bundled uploader, or a configured `avrdude` on `PATH` if bundled files are missing. Upload requires an Arduino Uno, a USB data cable, the correct COM port, and a compatible Arduino bootloader. Upload success only means the firmware transfer command completed; it is not physical hardware validation of wiring, relay loads, sensors, power, or enclosure safety. +The Firmware tab also includes **Compile Arduino Sketch for Uno**. It accepts an existing `.ino` file or an Arduino Sketch folder containing at least one `.ino`, compiles only for `arduino:avr:uno`, and places the generated `.hex` into the firmware path field when compilation succeeds. If a standalone `.ino` is not already inside a matching Arduino sketch folder, the app copies it into a temporary sketch folder and does not modify the original source file. + +Sketch compile support requires Arduino CLI. The app looks for bundled Arduino CLI under `tools/arduino-cli/` first, then falls back to `arduino-cli` on `PATH`. If Arduino CLI is unavailable, the app reports: “Arduino CLI was not found. Use a package that includes tools/arduino-cli/ or install Arduino CLI before compiling sketches.” Sketches using only Arduino core features are supported directly after the `arduino:avr` core is available. Sketches using external libraries require those libraries to be available to Arduino CLI; the app does not automatically fix code, guess missing libraries, or install third-party libraries from compiler output. + +When the customer package includes `tools/avrdude/`, the Firmware tab can upload either a prepared `.hex` file or a generated `.hex` file to an Arduino Uno using the bundled uploader, or a configured `avrdude` on `PATH` if bundled files are missing. Upload requires an Arduino Uno, a USB data cable, the correct COM port, and a compatible Arduino bootloader. + +Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. If the custom sketch only prints Serial text, the app may show logs, but Settings and Live Monitor may not work as designed. + +Compile success only means Arduino CLI reported a generated HEX. Upload success only means the firmware transfer command completed; neither result is physical hardware validation of wiring, relay loads, sensors, power, or enclosure safety. ## What still requires physical hardware validation @@ -107,7 +116,7 @@ Before production/customer deployment, validate these items on the actual hardwa - Relay driver wiring, relay output polarity, and load safety. - Buzzer wiring and active-high/active-low polarity. - EEPROM save/load behavior on the selected board. -- Firmware upload process, if upload is offered to customers. +- Firmware upload process and optional sketch compile workflow, if offered to customers. - Power supply, enclosure, cable strain relief, and any field-installation safety requirements. No physical hardware testing is claimed by this repository unless separate human-provided test evidence is attached and reviewed. diff --git a/docs/testing.md b/docs/testing.md index 2b72182..689bf5e 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -2,14 +2,27 @@ ## Automated checks in this repository -GitHub Actions runs `.github/workflows/checks.yml` with: +GitHub Actions runs `.github/workflows/checks.yml` with Python syntax checks, parser/uploader/sketch helper smoke checks, release package assembly smoke checks, and an Arduino Uno firmware compile job. + +The Python smoke job covers serial parsing, prepared `.hex` upload validation, Arduino CLI discovery, sketch compile command construction, `.ino` file acceptance, Sketch folder acceptance, non-`.ino` source rejection, the missing-Arduino-CLI user-facing error, and the custom sketch protocol warning text. It does not run a real customer sketch compile in the regular Python job. ```bash python -m py_compile gui/portable_avr_control_studio.py python - <<'PY' from pathlib import Path from tempfile import TemporaryDirectory -from gui.portable_avr_control_studio import UploadValidationError, parse_serial_line, validate_upload_request +from gui.portable_avr_control_studio import ( + ARDUINO_CLI_MISSING_MESSAGE, + CUSTOM_SKETCH_PROTOCOL_WARNING, + SketchCompileValidationError, + UploadValidationError, + build_arduino_compile_command, + find_arduino_cli_tool, + parse_serial_line, + prepare_sketch_source, + validate_sketch_compile_request, + validate_upload_request, +) assert parse_serial_line('OK,PING\n').kind == 'OK' assert parse_serial_line('ERR,BAD,message\n').kind == 'ERR' assert parse_serial_line('CONFIG,DEVICE_NAME=Unit,SENSOR_VREF_MV=5000\n').fields['SENSOR_VREF_MV'] == '5000' @@ -36,10 +49,51 @@ with TemporaryDirectory() as temp: pass else: raise AssertionError('expected firmware upload validation failure') + + cli_tools = root / 'tools' / 'arduino-cli' + cli_tools.mkdir(parents=True) + cli_exe = cli_tools / 'arduino-cli.exe' + cli_exe.write_text('dummy compiler', encoding='utf-8') + cli = find_arduino_cli_tool(root, path_env='') + assert cli is not None and cli.source == 'bundled' + + workspace = root / 'workspace' + valid_ino = root / 'Blink.ino' + valid_ino.write_text('void setup() {}\nvoid loop() {}\n', encoding='utf-8') + prepared = prepare_sketch_source(str(valid_ino), workspace) + assert prepared.copied_source and (prepared.sketch_folder / 'Blink.ino').is_file() + + sketch_folder = root / 'CustomerSketch' + sketch_folder.mkdir() + (sketch_folder / 'CustomerSketch.ino').write_text('void setup() {}\nvoid loop() {}\n', encoding='utf-8') + prepared_folder = prepare_sketch_source(str(sketch_folder), workspace) + assert prepared_folder.sketch_folder == sketch_folder + cmd = build_arduino_compile_command(cli, sketch_folder, root / 'out') + assert cmd == [str(cli_exe), 'compile', '--fqbn', 'arduino:avr:uno', '--output-dir', str(root / 'out'), str(sketch_folder)] + + validate_sketch_compile_request(str(sketch_folder), root, workspace, path_env='') + bad_source = root / 'not-a-sketch.txt' + bad_source.write_text('nope', encoding='utf-8') + try: + prepare_sketch_source(str(bad_source), workspace) + except SketchCompileValidationError as exc: + assert 'ends with .ino' in str(exc) + else: + raise AssertionError('expected non-.ino source rejection') + + cli_exe.unlink() + try: + validate_sketch_compile_request(str(sketch_folder), root, workspace, path_env='') + except SketchCompileValidationError as exc: + assert str(exc) == ARDUINO_CLI_MISSING_MESSAGE + else: + raise AssertionError('expected missing Arduino CLI validation failure') + + assert 'Uploading a custom sketch replaces the built-in Portable AVR firmware' in CUSTOM_SKETCH_PROTOCOL_WARNING PY ``` -The workflow also attempts an Arduino CLI compile for the Uno target: +The AVR job installs Arduino CLI, installs the AVR core, and attempts an Arduino CLI compile for the built-in Uno firmware target: ```bash arduino-cli core update-index @@ -47,7 +101,7 @@ arduino-cli core install arduino:avr arduino-cli compile --fqbn arduino:avr:uno firmware/PortableAVRControlStudio ``` -If Arduino CLI or network setup is unavailable in an execution environment, run the same commands locally before removing draft status. +If Arduino CLI or network setup is unavailable in an execution environment, run the same commands locally before removing draft status. This is compile evidence only; it is not physical hardware validation. ## Local checks @@ -63,6 +117,14 @@ PY arduino-cli compile --fqbn arduino:avr:uno firmware/PortableAVRControlStudio ``` +## Customer sketch compile boundary + +The app can compile prepared `.ino` files and Arduino Sketch folders only for Arduino Uno / ATmega328P (`arduino:avr:uno`) when Arduino CLI is bundled under `tools/arduino-cli/` or installed on `PATH`. Regular PR CI should not run real customer sketch compilation unless the test environment is intentionally configured for Arduino CLI and the `arduino:avr` core. + +Sketches using only Arduino core features are supported directly after the AVR core is available. Sketches using external libraries require those libraries to be available to Arduino CLI. Missing external libraries should be diagnosed from visible compiler logs; the app does not automatically repair code or install guessed libraries. + +Uploading a custom sketch replaces the built-in Portable AVR firmware. Settings / Status / EEPROM controls only work after a custom upload if that sketch implements the Portable AVR serial protocol. Compile success and upload success are tool results only and are not physical hardware validation. + ## Physical hardware testing No physical hardware test is claimed by this repository. Physical validation must be performed against the final board, wiring, relay/buzzer drivers, power supply, enclosure, and selected hardware profile before customer deployment. diff --git a/gui/portable_avr_control_studio.py b/gui/portable_avr_control_studio.py index c09e86e..63b7863 100644 --- a/gui/portable_avr_control_studio.py +++ b/gui/portable_avr_control_studio.py @@ -9,9 +9,11 @@ import datetime as _dt import json import queue +import re import shutil import subprocess import sys +import tempfile import threading import time from dataclasses import dataclass, field @@ -94,6 +96,10 @@ class UploadValidationError(ValueError): """User-facing validation error for prepared HEX firmware uploads.""" +class SketchCompileValidationError(ValueError): + """User-facing validation error for Arduino sketch compilation.""" + + @dataclass(frozen=True) class AvrdudeTool: executable: Path | str @@ -101,6 +107,33 @@ class AvrdudeTool: source: str +@dataclass(frozen=True) +class ArduinoCliTool: + executable: Path | str + source: str + + +@dataclass(frozen=True) +class PreparedSketch: + source: Path + sketch_folder: Path + output_dir: Path + temporary_root: Optional[Path] + copied_source: bool + + +ARDUINO_UNO_FQBN = "arduino:avr:uno" +ARDUINO_CLI_MISSING_MESSAGE = ( + "Arduino CLI was not found. Use a package that includes tools/arduino-cli/ " + "or install Arduino CLI before compiling sketches." +) +CUSTOM_SKETCH_PROTOCOL_WARNING = ( + "Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, " + "Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. " + "If the custom sketch only prints Serial text, the app may show logs, but Settings and Live Monitor may not work as designed." +) + + def find_avrdude_tool(app_root: Path, path_env: Optional[str] = None) -> Optional[AvrdudeTool]: """Find bundled avrdude first, then fall back to avrdude on PATH.""" bundled_dir = app_root / "tools" / "avrdude" @@ -122,6 +155,20 @@ def find_avrdude_tool(app_root: Path, path_env: Optional[str] = None) -> Optiona return None +def find_arduino_cli_tool(app_root: Path, path_env: Optional[str] = None) -> Optional[ArduinoCliTool]: + """Find bundled Arduino CLI first, then fall back to arduino-cli on PATH.""" + bundled_dir = app_root / "tools" / "arduino-cli" + for exe_name in ("arduino-cli.exe", "arduino-cli"): + candidate = bundled_dir / exe_name + if candidate.is_file(): + return ArduinoCliTool(candidate, "bundled") + + found = shutil.which("arduino-cli", path=path_env) + if found: + return ArduinoCliTool(Path(found), "PATH") + return None + + def build_avrdude_upload_command(tool: AvrdudeTool, port: str, hex_file: Path) -> List[str]: """Build an Arduino Uno / ATmega328P avrdude upload command without executing it.""" cmd = [str(tool.executable)] @@ -140,6 +187,94 @@ def build_avrdude_upload_command(tool: AvrdudeTool, port: str, hex_file: Path) - return cmd +def build_arduino_core_list_command(tool: ArduinoCliTool) -> List[str]: + return [str(tool.executable), "core", "list"] + + +def build_arduino_core_install_command(tool: ArduinoCliTool) -> List[str]: + return [str(tool.executable), "core", "install", "arduino:avr"] + + +def build_arduino_compile_command(tool: ArduinoCliTool, sketch_folder: Path, output_dir: Path) -> List[str]: + """Build an Arduino Uno / ATmega328P sketch compile command without executing it.""" + return [ + str(tool.executable), + "compile", + "--fqbn", + ARDUINO_UNO_FQBN, + "--output-dir", + str(output_dir), + str(sketch_folder), + ] + + +def _safe_sketch_name(name: str) -> str: + sanitized = re.sub(r"[^A-Za-z0-9_]+", "_", name).strip("_") + if not sanitized: + sanitized = "Sketch" + if sanitized[0].isdigit(): + sanitized = f"Sketch_{sanitized}" + return sanitized + + +def prepare_sketch_source(source_path: str, workspace_root: Path, output_dir: Optional[Path] = None) -> PreparedSketch: + """Validate a .ino file or sketch folder and prepare a safe compile input folder.""" + source = Path(source_path).expanduser().resolve() + if not source.exists(): + raise SketchCompileValidationError("Select an existing .ino file or Arduino Sketch folder before compiling.") + + def ready_output_dir() -> Path: + workspace_root.mkdir(parents=True, exist_ok=True) + if output_dir is None: + return Path(tempfile.mkdtemp(prefix="uno-hex-", dir=workspace_root)) + output_dir.mkdir(parents=True, exist_ok=True) + return output_dir + + if source.is_file(): + if source.suffix.lower() != ".ino": + raise SketchCompileValidationError("Select a source file that ends with .ino, or select an Arduino Sketch folder.") + prepared_output_dir = ready_output_dir() + if source.parent.name == source.stem: + return PreparedSketch(source, source.parent, prepared_output_dir, None, False) + + safe_name = _safe_sketch_name(source.stem) + temporary_root = Path(tempfile.mkdtemp(prefix=f"{safe_name}-", dir=workspace_root)) + sketch_folder = temporary_root / safe_name + sketch_folder.mkdir(parents=True) + shutil.copy2(source, sketch_folder / f"{safe_name}.ino") + return PreparedSketch(source, sketch_folder, prepared_output_dir, temporary_root, True) + + if source.is_dir(): + ino_files = sorted(source.glob("*.ino")) + if not ino_files: + raise SketchCompileValidationError("Select a Sketch folder that contains at least one .ino file.") + return PreparedSketch(source, source, ready_output_dir(), None, False) + + raise SketchCompileValidationError("Select a regular .ino file or Arduino Sketch folder before compiling.") + + +def validate_sketch_compile_request( + source_path: str, + app_root: Path, + workspace_root: Path, + output_dir: Optional[Path] = None, + path_env: Optional[str] = None, +) -> Tuple[List[str], ArduinoCliTool, PreparedSketch]: + tool = find_arduino_cli_tool(app_root, path_env=path_env) + if tool is None: + raise SketchCompileValidationError(ARDUINO_CLI_MISSING_MESSAGE) + prepared = prepare_sketch_source(source_path, workspace_root, output_dir=output_dir) + return build_arduino_compile_command(tool, prepared.sketch_folder, prepared.output_dir), tool, prepared + + +def locate_generated_hex(output_dir: Path) -> Optional[Path]: + hex_files = sorted(path for path in output_dir.rglob("*.hex") if path.is_file()) + if not hex_files: + return None + non_bootloader = [path for path in hex_files if ".with_bootloader." not in path.name] + return non_bootloader[0] if non_bootloader else hex_files[0] + + def validate_upload_request( port: str, hex_path: str, @@ -400,7 +535,10 @@ def __init__(self) -> None: self.demo_mode = tk.BooleanVar(value=True) bundled_firmware = self._bundled_firmware_path() self.hex_path = tk.StringVar(value=str(bundled_firmware) if bundled_firmware.is_file() else "") + self.sketch_path = tk.StringVar(value="") + self.sketch_output_dir = tk.StringVar(value="") self.upload_running = False + self.compile_running = False self.port_var = tk.StringVar(value="") self.command_var = tk.StringVar(value="PING") self.transport: object = DemoTransport(self._queue_line, self._log) @@ -471,13 +609,17 @@ def _tab_firmware(self) -> None: frame, text=( "The app uploads prepared .hex firmware artifacts to Arduino Uno using bundled or configured avrdude. " - "The app does not compile raw .ino source code. Upload success only means the firmware transfer command completed. " + "It can also compile .ino files or Sketch folders for Arduino Uno / ATmega328P when Arduino CLI is available. " + "Compile and upload success only mean the tools reported completion. " "Upload success does not validate physical wiring, relay loads, sensors, power, or enclosure safety." ), wraplength=920, ).grid(row=0, column=0, sticky="w") - chooser = ttk.Frame(frame) - chooser.grid(row=1, column=0, sticky="ew", pady=10) + uploader = ttk.LabelFrame(frame, text="Upload prepared HEX", padding=10) + uploader.grid(row=1, column=0, sticky="ew", pady=10) + uploader.columnconfigure(0, weight=1) + chooser = ttk.Frame(uploader) + chooser.grid(row=0, column=0, sticky="ew") ttk.Entry(chooser, textvariable=self.hex_path, width=70).pack(side="left", fill="x", expand=True) ttk.Button(chooser, text="Browse .hex", command=self._browse_hex).pack(side="left", padx=6) ttk.Button(chooser, text="Use bundled firmware", command=self._use_bundled_firmware).pack(side="left", padx=6) @@ -487,7 +629,35 @@ def _tab_firmware(self) -> None: command=self._upload_firmware_to_uno, ) self.upload_button.pack(side="left") - ttk.Button(frame, text="Read Board Info", command=lambda: self._send("INFO")).grid(row=2, column=0, sticky="w", pady=4) + + compiler = ttk.LabelFrame(frame, text="Compile Arduino Sketch for Uno", padding=10) + compiler.grid(row=2, column=0, sticky="ew", pady=10) + compiler.columnconfigure(1, weight=1) + ttk.Label(compiler, text="Sketch source:").grid(row=0, column=0, sticky="w", pady=4) + ttk.Entry(compiler, textvariable=self.sketch_path, width=78).grid(row=0, column=1, sticky="ew", padx=6, pady=4) + ttk.Button(compiler, text="Select .ino file", command=self._browse_ino).grid(row=0, column=2, sticky="e", padx=4) + ttk.Button(compiler, text="Select Sketch folder", command=self._browse_sketch_folder).grid(row=0, column=3, sticky="e", padx=4) + ttk.Label(compiler, text="Output folder:").grid(row=1, column=0, sticky="w", pady=4) + ttk.Entry(compiler, textvariable=self.sketch_output_dir, width=78).grid(row=1, column=1, sticky="ew", padx=6, pady=4) + ttk.Label( + compiler, + text="Optional. Leave blank to use a generated temporary output folder for the compiled HEX.", + wraplength=420, + ).grid(row=1, column=2, columnspan=2, sticky="w", pady=4) + button_row = ttk.Frame(compiler) + button_row.grid(row=2, column=0, columnspan=4, sticky="w", pady=(8, 4)) + self.compile_button = ttk.Button(button_row, text="Compile Sketch for Arduino Uno", command=lambda: self._compile_sketch(False)) + self.compile_button.pack(side="left", padx=(0, 6)) + self.compile_upload_button = ttk.Button(button_row, text="Compile + Upload", command=lambda: self._compile_sketch(True)) + self.compile_upload_button.pack(side="left", padx=6) + ttk.Label( + compiler, + text=CUSTOM_SKETCH_PROTOCOL_WARNING, + wraplength=900, + foreground="#8a5a00", + ).grid(row=3, column=0, columnspan=4, sticky="w", pady=(8, 0)) + + ttk.Button(frame, text="Read Board Info", command=lambda: self._send("INFO")).grid(row=3, column=0, sticky="w", pady=4) def _tab_settings(self) -> None: frame = self._new_tab("Settings") @@ -773,6 +943,16 @@ def _browse_hex(self) -> None: if path: self.hex_path.set(path) + def _browse_ino(self) -> None: + path = filedialog.askopenfilename(title="Select Arduino .ino sketch", filetypes=[("Arduino sketch", "*.ino"), ("All files", "*.*")]) + if path: + self.sketch_path.set(path) + + def _browse_sketch_folder(self) -> None: + path = filedialog.askdirectory(title="Select Arduino Sketch folder") + if path: + self.sketch_path.set(path) + def _use_bundled_firmware(self) -> None: bundled = self._bundled_firmware_path() if bundled.is_file(): @@ -799,8 +979,7 @@ def _upload_firmware_to_uno(self) -> None: self._disconnect() self.upload_running = True - if hasattr(self, "upload_button"): - self.upload_button.configure(state="disabled") + self._set_firmware_buttons_state("disabled") self.status_vars["connection"].set("Uploading firmware to Arduino Uno...") self._log(f"Starting Arduino Uno firmware upload using {tool.source} avrdude.") self._log(f"Firmware artifact: {firmware}") @@ -808,6 +987,141 @@ def _upload_firmware_to_uno(self) -> None: thread = threading.Thread(target=self._run_upload_process, args=(cmd,), name="uno-firmware-upload", daemon=True) thread.start() + def _compile_workspace_root(self) -> Path: + return Path(tempfile.gettempdir()) / "PortableAVRControlStudio" / "arduino-sketch-builds" + + def _compile_sketch(self, upload_after_compile: bool) -> None: + if self.compile_running or self.upload_running: + return + output_dir = Path(self.sketch_output_dir.get()).expanduser() if self.sketch_output_dir.get().strip() else None + try: + cmd, tool, prepared = validate_sketch_compile_request( + self.sketch_path.get(), + application_root(), + self._compile_workspace_root(), + output_dir=output_dir, + ) + except SketchCompileValidationError as exc: + self._log(f"Sketch compile validation failed: {exc}") + messagebox.showwarning("Sketch compile not ready", str(exc)) + return + + self.compile_running = True + self._set_firmware_buttons_state("disabled") + self.status_vars["connection"].set("Compiling Arduino Uno sketch...") + self._log(f"Starting Arduino Uno sketch compile using {tool.source} Arduino CLI.") + self._log(f"Sketch source: {prepared.source}") + self._log(f"Sketch folder: {prepared.sketch_folder}") + if prepared.copied_source: + self._log("Selected .ino was copied into a temporary Arduino sketch folder; the original source was not modified.") + self._log(f"Compile output folder: {prepared.output_dir}") + self._log("Compile command: " + " ".join(cmd)) + self.sketch_output_dir.set(str(prepared.output_dir)) + thread = threading.Thread( + target=self._run_compile_process, + args=(tool, cmd, prepared.output_dir, upload_after_compile), + name="uno-sketch-compile", + daemon=True, + ) + thread.start() + + def _run_compile_process( + self, + tool: ArduinoCliTool, + compile_cmd: List[str], + output_dir: Path, + upload_after_compile: bool, + ) -> None: + if not self._ensure_arduino_avr_core(tool): + message = "Sketch compile failed. See Logs for compiler output." + self.after(0, lambda message=message: self._finish_compile(False, message, None, upload_after_compile)) + return + + returncode = self._run_logged_process(compile_cmd, "Sketch compile") + if returncode != 0: + message = "Sketch compile failed. See Logs for compiler output." + self.after(0, lambda message=message: self._finish_compile(False, message, None, upload_after_compile)) + return + + generated_hex = locate_generated_hex(output_dir) + if generated_hex is None: + message = "Sketch compile failed. Arduino CLI completed but no generated .hex file was found. See Logs for details." + self.after(0, lambda message=message: self._finish_compile(False, message, None, upload_after_compile)) + return + + message = "Sketch compiled successfully. Generated HEX is ready for upload." + self.after(0, lambda message=message, generated_hex=generated_hex: self._finish_compile(True, message, generated_hex, upload_after_compile)) + + def _ensure_arduino_avr_core(self, tool: ArduinoCliTool) -> bool: + core_list_cmd = build_arduino_core_list_command(tool) + self._threadsafe_log("Arduino core check command: " + " ".join(core_list_cmd)) + list_output: List[str] = [] + returncode = -1 + try: + process = subprocess.Popen( + core_list_cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + shell=False, + bufsize=1, + ) + assert process.stdout is not None + for line in process.stdout: + stripped = line.rstrip() + list_output.append(stripped) + self._threadsafe_log(stripped) + returncode = process.wait() + except Exception as exc: + self._threadsafe_log(f"Arduino core check failed to start or run: {exc}") + + if returncode == 0 and any("arduino:avr" in line for line in list_output): + return True + + install_cmd = build_arduino_core_install_command(tool) + self._threadsafe_log("Arduino AVR core is not listed; attempting required core install for arduino:avr.") + self._threadsafe_log("Arduino core install command: " + " ".join(install_cmd)) + return self._run_logged_process(install_cmd, "Arduino AVR core install") == 0 + + def _run_logged_process(self, cmd: List[str], label: str) -> int: + try: + process = subprocess.Popen( + cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + shell=False, + bufsize=1, + ) + assert process.stdout is not None + for line in process.stdout: + self._threadsafe_log(line.rstrip()) + return process.wait() + except Exception as exc: + self._threadsafe_log(f"{label} failed to start or run: {exc}") + return -1 + + def _finish_compile(self, success: bool, message: str, generated_hex: Optional[Path], upload_after_compile: bool) -> None: + self.compile_running = False + self._set_firmware_buttons_state("normal") + if success and generated_hex is not None: + self.hex_path.set(str(generated_hex)) + self._log(f"Generated HEX selected for upload: {generated_hex}") + self._log(message) + if success: + self.status_vars["connection"].set("Sketch compile completed") + messagebox.showinfo("Sketch compile completed", message) + if upload_after_compile: + self._upload_firmware_to_uno() + else: + self.status_vars["connection"].set("Sketch compile failed") + messagebox.showerror("Sketch compile failed", message) + + def _set_firmware_buttons_state(self, state: str) -> None: + for name in ("upload_button", "compile_button", "compile_upload_button"): + if hasattr(self, name): + getattr(self, name).configure(state=state) + def _run_upload_process(self, cmd: List[str]) -> None: returncode = -1 try: @@ -844,8 +1158,8 @@ def _threadsafe_log(self, message: str) -> None: def _finish_upload(self, success: bool, message: str) -> None: self.upload_running = False - if hasattr(self, "upload_button"): - self.upload_button.configure(state="normal") + if not self.compile_running: + self._set_firmware_buttons_state("normal") self._log(message) if success: self.status_vars["connection"].set("Firmware upload completed") diff --git a/release/BUILD_VERIFICATION.md b/release/BUILD_VERIFICATION.md index e9a2b36..9bcaefd 100644 --- a/release/BUILD_VERIFICATION.md +++ b/release/BUILD_VERIFICATION.md @@ -31,7 +31,7 @@ To run it from GitHub: The workflow publishes downloadable GitHub Actions artifacts from the completed run: -- `portable-avr-control-studio-windows-exe` containing `PortableAVRControlStudio.exe` and staged `tools/avrdude/` uploader files. +- `portable-avr-control-studio-windows-exe` containing `PortableAVRControlStudio.exe`, staged `tools/avrdude/` uploader files, and optional staged `tools/arduino-cli/` compiler files when bundled. - `portable-avr-control-studio-uno-firmware` containing `PortableAVRControlStudio.ino.hex` and any related Arduino CLI firmware output files. - `portable-avr-control-studio-customer-package` containing `PortableAVRControlStudio-customer-handoff.zip` and `SHA256SUMS.txt`. - `portable-avr-control-studio-sha256-checksums` containing `SHA256SUMS.txt` for the EXE, HEX, customer ZIP, and staged uploader files where practical. The customer ZIP checksum also covers the bundled uploader tools in the final package. @@ -59,16 +59,18 @@ powershell -ExecutionPolicy Bypass -File .\release\scripts\build_windows_exe.ps1 The script installs or updates the Python packaging dependencies it needs, then runs PyInstaller against `gui\portable_avr_control_studio.py`. -Expected output files from the workflow include the EXE plus bundled uploader staging files: +Expected output files from the workflow include the EXE plus bundled uploader staging files. If Arduino CLI is bundled for customer-side `.ino` / Sketch folder compile support, stage it under `release\artifacts\windows\tools\arduino-cli\` as generated release tooling: ```text release\artifacts\windows\PortableAVRControlStudio.exe release\artifacts\windows\tools\avrdude\avrdude.exe release\artifacts\windows\tools\avrdude\avrdude.conf release\artifacts\windows\tools\avrdude\...required DLLs/support files... +release\artifacts\windows\tools\arduino-cli\arduino-cli.exe # optional +release\artifacts\windows\tools\arduino-cli\...support/config files... # optional ``` -The manual release workflow installs Arduino CLI and the `arduino:avr` core, locates the Arduino AVR `avrdude` tool, and stages the Windows uploader files under `release\artifacts\windows\tools\avrdude`. Do not commit those staged uploader files. +The manual release workflow installs Arduino CLI and the `arduino:avr` core, locates the Arduino AVR `avrdude` tool, and stages the Windows uploader files under `release\artifacts\windows\tools\avrdude`. If practical, stage Arduino CLI under `release\artifacts\windows\tools\arduino-cli` so the customer package can compile prepared sketches without relying on PATH. Do not commit staged uploader or Arduino CLI files. Verify the EXE exists: @@ -138,6 +140,9 @@ release/customer_package/PortableAVRControlStudio-customer-handoff/ avrdude.exe avrdude.conf ...required DLLs/support files... + arduino-cli/ # optional; present only when bundled + arduino-cli.exe + ...support/config files... docs/ customer_handoff.md PROTOCOL.md @@ -155,6 +160,8 @@ test -f release/customer_package/PortableAVRControlStudio-customer-handoff/Porta test -f release/customer_package/PortableAVRControlStudio-customer-handoff/README.md test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/avrdude.exe test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/avrdude.conf +# Optional when Arduino CLI is bundled for customer-side sketch compilation: +# test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/arduino-cli/arduino-cli.exe test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/customer_handoff.md test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/PROTOCOL.md test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/product_spec.md @@ -180,11 +187,11 @@ git status --short --ignored release/artifacts release/customer_package Expected behavior: - Tracked `.gitkeep` files may appear only if intentionally changed. -- Generated files under `release/artifacts/windows/`, `release/artifacts/firmware/`, `release/artifacts/checksums/`, and `release/customer_package/` should be ignored. -- Do not commit generated `.exe`, `.hex`, `.zip`, or checksum artifacts. +- Generated files under `release/artifacts/windows/`, including `tools/avrdude/` and optional `tools/arduino-cli/`, `release/artifacts/firmware/`, `release/artifacts/checksums/`, and `release/customer_package/` should be ignored. +- Do not commit generated `.exe`, `.hex`, `.zip`, checksum artifacts, uploader tools, Arduino CLI tools, libraries, or build folders. ## 6. Release-claim boundaries - Document software checks separately from physical Arduino Uno hardware validation. - Do not claim physical hardware testing unless a human maintainer provides evidence for the exact board, wiring, power, enclosure, and hardware profile. -- The app upload action transfers prepared `.hex` artifacts only; it does not compile raw `.ino` source code. Upload success only means the uploader command completed and is not physical hardware validation. +- The app uploads prepared `.hex` artifacts and can compile prepared `.ino` files or Arduino Sketch folders only for Arduino Uno / ATmega328P through Arduino CLI (`arduino:avr:uno`). If Arduino CLI is not bundled under `tools/arduino-cli/`, compile support requires `arduino-cli` on the customer PC `PATH`. External libraries must already be available to Arduino CLI; the app does not automatically repair code or install guessed libraries. Uploading a custom sketch replaces the built-in Portable AVR firmware, so Settings / Status / EEPROM controls require that sketch to implement the Portable AVR serial protocol. Compile and upload success are tool results only and are not physical hardware validation. diff --git a/release/FINAL_DELIVERY_SEQUENCE.md b/release/FINAL_DELIVERY_SEQUENCE.md index a785942..ce0bed5 100644 --- a/release/FINAL_DELIVERY_SEQUENCE.md +++ b/release/FINAL_DELIVERY_SEQUENCE.md @@ -67,7 +67,7 @@ Before sending the ZIP: - Review all customer-facing text for unsupported claims. - Confirm demo mode is described as simulation only. - Confirm unknown hardware is handled through documented profiles, not automatic detection. -- Confirm the package describes upload as a prepared `.hex` transfer only, not raw `.ino` compilation or physical hardware validation. +- Confirm the package describes upload as a prepared `.hex` transfer workflow and sketch compilation as Arduino CLI-based Uno-only support, not automatic code/library repair or physical hardware validation. - Confirm no generated EXE, HEX, or ZIP files are committed to git. Send the customer ZIP only after this claim review is complete. diff --git a/release/README.md b/release/README.md index f5ed5e7..c5a8c4f 100644 --- a/release/README.md +++ b/release/README.md @@ -65,6 +65,6 @@ Record release evidence in `release/templates/maintainer_release_notes.md` and k ## Important release boundaries - The primary firmware artifact is for Arduino Uno / ATmega328P AVR using `arduino:avr:uno`. -- Firmware upload is a prepared `.hex` artifact workflow for Arduino Uno using bundled or configured `avrdude`; it does not compile raw `.ino` source code, and upload success is not physical hardware validation. +- Firmware upload remains a prepared `.hex` artifact workflow for Arduino Uno using bundled or configured `avrdude`. The app can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P through Arduino CLI when `tools/arduino-cli/` is bundled or `arduino-cli` is on PATH. Compile and upload success are tool results only and are not physical hardware validation. - Demo mode is simulation only. - This repository does not claim physical hardware validation. Record any future hardware evidence outside this draft package until it is reviewed and approved for customer release notes. diff --git a/release/candidates/RC-0.1.md b/release/candidates/RC-0.1.md index 27de872..bd545f9 100644 --- a/release/candidates/RC-0.1.md +++ b/release/candidates/RC-0.1.md @@ -10,7 +10,7 @@ - **Arduino Uno HEX build status:** TBD by maintainer after building with Arduino CLI for `arduino:avr:uno` - **Customer ZIP assembly status:** TBD by maintainer after package assembly and inventory review - **Physical hardware validation status:** Not performed unless evidence is later attached -- **Upload status:** Prepared `.hex` upload to Arduino Uno using bundled or configured `avrdude`; no raw `.ino` compilation or physical hardware validation claim +- **Upload/compile status:** Prepared `.hex` upload to Arduino Uno using bundled or configured `avrdude`; prepared `.ino` / Sketch folder compile for Arduino Uno / ATmega328P through Arduino CLI only; no physical hardware validation claim ## Manual release-build workflow note @@ -37,7 +37,7 @@ Maintainers must fill or attach the following evidence before sending the custom 2. Windows EXE build evidence, including host details, dependency versions, file size, and SHA-256 checksum. 3. Arduino Uno HEX build evidence, including Arduino CLI version, AVR core version, file size, and SHA-256 checksum. 4. Customer ZIP assembly evidence, including file size, SHA-256 checksum, and package inventory. -5. Claim review confirmation that demo mode is simulation only, firmware upload is a prepared `.hex` transfer workflow, raw `.ino` compilation is not supported, and no unsupported hardware validation claims are included. +5. Claim review confirmation that demo mode is simulation only, firmware upload keeps the prepared `.hex` transfer workflow, sketch compilation is Arduino CLI-based for Uno only, custom sketch protocol limits are documented, and no unsupported hardware validation claims are included. 6. Optional physical Arduino Uno validation evidence, if performed, tied to the exact board, wiring, firmware checksum, and hardware profile used. ## Release boundaries @@ -46,4 +46,4 @@ Maintainers must fill or attach the following evidence before sending the custom - This tracking document does not add product features. - Generated EXE, HEX, and ZIP files must not be committed. - Do not claim physical hardware testing unless maintainer-supplied evidence is attached and reviewed. -- Describe firmware upload as prepared `.hex` transfer to Arduino Uno only. Do not claim raw `.ino` compilation or physical hardware validation. +- Describe firmware upload as prepared `.hex` transfer to Arduino Uno and sketch compilation as Arduino CLI-based Uno-only support. Do not claim automatic code/library repair or physical hardware validation. diff --git a/release/checklists/release_readiness_checklist.md b/release/checklists/release_readiness_checklist.md index b95241d..ca81fed 100644 --- a/release/checklists/release_readiness_checklist.md +++ b/release/checklists/release_readiness_checklist.md @@ -9,7 +9,7 @@ Use this checklist for the first customer delivery of Portable AVR Control Studi - [ ] Delivery target is Arduino Uno / ATmega328P AVR using the documented `arduino:avr:uno` firmware build. - [ ] Included hardware profile is `docs/profiles/arduino_uno_avr.json` or another reviewed profile approved for the delivery. - [ ] Customer-facing runtime settings are aligned across firmware, GUI, README, protocol docs, and product docs. -- [ ] No generated `.exe`, `.hex`, or `.zip` artifacts are committed to git. +- [ ] No generated `.exe`, `.hex`, `.zip`, toolchain, library, build-folder, or customer package artifacts are committed to git. ## 1. CI checks @@ -22,7 +22,7 @@ Record CI evidence before producing the customer ZIP. python -m py_compile gui/portable_avr_control_studio.py ``` -- [ ] Confirm the parser smoke check from `docs/testing.md` passed. +- [ ] Confirm the parser, uploader, Arduino CLI discovery, sketch command construction, source validation, missing-Arduino-CLI, and protocol-warning smoke checks from `docs/testing.md` passed. - [ ] Confirm the CI Arduino Uno AVR compile check passed, or record why the check had to be reproduced locally. - [ ] Save CI links, logs, commit SHA, and pass/fail status in `release/templates/maintainer_release_notes.md`. - [ ] Update the RC-0.1 CI status in `release/candidates/RC-0.1.md`. @@ -66,7 +66,7 @@ Build the prepared firmware artifact with Arduino CLI for the Uno target. - [ ] Record Arduino CLI version, `arduino:avr` core version, build host OS, file size, and SHA-256 checksum. - [ ] Update the RC-0.1 Arduino Uno HEX build status in `release/candidates/RC-0.1.md`. -- [ ] Treat the HEX as a prepared firmware artifact. Confirm upload wording is limited to Arduino Uno prepared `.hex` transfer and does not claim raw `.ino` compilation or physical hardware validation. +- [ ] Treat the HEX as a prepared firmware artifact. Confirm upload wording preserves prepared `.hex` transfer and sketch compile wording is limited to Arduino Uno / ATmega328P through Arduino CLI; do not claim physical hardware validation. ## 4. Customer ZIP assembly @@ -93,9 +93,11 @@ Assemble the customer ZIP only after the CI, Windows EXE, and Arduino Uno HEX se - [ ] `docs/product_spec.md` - [ ] `docs/testing.md` - [ ] `docs/profiles/arduino_uno_avr.json` + - [ ] `tools/avrdude/avrdude.exe` and `tools/avrdude/avrdude.conf` + - [ ] Optional `tools/arduino-cli/arduino-cli.exe` only if Arduino CLI was staged for bundled sketch compile support - [ ] Record ZIP file size, SHA-256 checksum, and package inventory. - [ ] Update the RC-0.1 customer ZIP assembly status in `release/candidates/RC-0.1.md`. -- [ ] Confirm generated EXE, HEX, and ZIP outputs remain ignored by git and are not staged for commit. +- [ ] Confirm generated EXE, HEX, ZIP, avrdude, Arduino CLI, library, and build-folder outputs remain ignored by git and are not staged for commit. ## 5. Optional physical hardware validation @@ -103,7 +105,7 @@ This section is optional for the draft package and must remain separate from bui - [ ] If not performed, mark release notes as: `Not performed. No physical Arduino Uno hardware validation is claimed for this release candidate.` - [ ] If performed, attach human-provided evidence for the exact Arduino Uno / ATmega328P AVR board, firmware artifact checksum, hardware profile, wiring, relay/buzzer drivers, sensor input, power supply, enclosure assumptions, and test result. -- [ ] If hardware validation is not performed, customer-facing notes must continue to say that physical board, wiring, outputs, EEPROM behavior, upload process, and field installation safety are not yet physically validated by this package. +- [ ] If hardware validation is not performed, customer-facing notes must continue to say that physical board, wiring, outputs, EEPROM behavior, compile/upload process, and field installation safety are not yet physically validated by this package. ## 6. Final claim review before sending @@ -113,5 +115,7 @@ This section is optional for the draft package and must remain separate from bui - [ ] The customer ZIP README is short, customer-facing, and does not claim unsupported validation. - [ ] Demo mode is described as simulation only. - [ ] Unknown hardware is handled through documented profiles, not automatic detection claims. -- [ ] Firmware upload is described as a prepared-artifact workflow unless bundled uploader tooling has been tested. +- [ ] Custom sketch warnings are present: uploading custom sketches replaces the built-in firmware, and Settings / Status / EEPROM require the Portable AVR serial protocol. +- [ ] External library wording is conservative: libraries must be available to Arduino CLI, and the app does not automatically repair code or install guessed libraries. +- [ ] Firmware upload is described as a prepared-artifact workflow, and `.ino` / Sketch folder compile support is described as Arduino CLI-based Uno-only support. - [ ] Send the ZIP to the customer only after this claim review is complete. diff --git a/release/scripts/assemble_customer_package.py b/release/scripts/assemble_customer_package.py index 52681b1..4657aa1 100755 --- a/release/scripts/assemble_customer_package.py +++ b/release/scripts/assemble_customer_package.py @@ -17,6 +17,8 @@ UPLOADER_SOURCE_DIR = Path("release/artifacts/windows/tools/avrdude") UPLOADER_DEST_DIR = Path("tools/avrdude") +ARDUINO_CLI_SOURCE_DIR = Path("release/artifacts/windows/tools/arduino-cli") +ARDUINO_CLI_DEST_DIR = Path("tools/arduino-cli") REQUIRED_COPIES = ( ( @@ -92,6 +94,9 @@ def copy_required_files(repo_root: Path, package_dir: Path) -> None: shutil.copy2(repo_root / src, dest_path) shutil.copytree(repo_root / UPLOADER_SOURCE_DIR, package_dir / UPLOADER_DEST_DIR) + arduino_cli_dir = repo_root / ARDUINO_CLI_SOURCE_DIR + if arduino_cli_dir.is_dir(): + shutil.copytree(arduino_cli_dir, package_dir / ARDUINO_CLI_DEST_DIR) def create_zip(package_dir: Path) -> Path: diff --git a/release/templates/customer_zip_README.md b/release/templates/customer_zip_README.md index 9a350ce..b8e5243 100644 --- a/release/templates/customer_zip_README.md +++ b/release/templates/customer_zip_README.md @@ -2,7 +2,7 @@ ## What this package is -This ZIP contains a Windows desktop app and a prepared Arduino Uno / ATmega328P AVR firmware artifact for Portable AVR Control Studio. It is intended for a reviewed customer handoff using the included Arduino Uno hardware profile. +This ZIP contains a Windows desktop app and a prepared Arduino Uno / ATmega328P AVR firmware artifact for Portable AVR Control Studio. When Arduino CLI is bundled under `tools/arduino-cli/` or installed on the customer PC `PATH`, the app can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P. It is intended for a reviewed customer handoff using the included Arduino Uno hardware profile. ## How to start the app @@ -27,9 +27,13 @@ Demo mode is simulation only. It lets you view the screens and practice the work Unknown hardware is not automatically detected. Use only reviewed and documented hardware profiles. -## What the `.hex` file is +## What the `.hex` file and sketch compiler are -`PortableAVRControlStudio.ino.hex` is a prepared firmware artifact for Arduino Uno / ATmega328P AVR. The app uploads prepared `.hex` files; it does not compile raw `.ino` source code and you should not paste raw code into the app. Customer-provided source code must be reviewed and compiled into a `.hex` artifact before upload. +`PortableAVRControlStudio.ino.hex` is a prepared firmware artifact for Arduino Uno / ATmega328P AVR. The app still uploads prepared `.hex` files directly. + +The Firmware tab also has **Compile Arduino Sketch for Uno**. It accepts an existing `.ino` file or an Arduino Sketch folder and compiles only for Arduino Uno / ATmega328P (`arduino:avr:uno`) through Arduino CLI. The app looks for `tools/arduino-cli/` first and then `arduino-cli` on `PATH`. If Arduino CLI is missing, install it or use a package that includes `tools/arduino-cli/` before compiling sketches. + +Sketches using only Arduino core features are supported directly after Arduino CLI has the `arduino:avr` core. Sketches using external libraries require those libraries to be available to Arduino CLI. The app does not automatically repair code, guess missing libraries, or install third-party libraries from compiler output. ## How to upload prepared firmware @@ -40,7 +44,9 @@ Unknown hardware is not automatically detected. Use only reviewed and documented 5. Click **Upload Firmware to Arduino Uno**. 6. Watch the Logs tab for uploader output and the final success or failure message. -The upload action uses bundled `tools/avrdude/` files when they are present, with `avrdude` on `PATH` as a fallback. Upload requires an Arduino Uno / ATmega328P AVR board with a compatible bootloader. Upload success only means the firmware transfer command completed; it does not validate wiring, relay loads, sensors, power, enclosure safety, or other physical hardware conditions. +The upload action uses bundled `tools/avrdude/` files when they are present, with `avrdude` on `PATH` as a fallback. Upload requires an Arduino Uno / ATmega328P AVR board with a compatible bootloader. Compile success only means Arduino CLI reported a generated HEX, and upload success only means the firmware transfer command completed; neither result validates wiring, relay loads, sensors, power, enclosure safety, or other physical hardware conditions. + +Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. If the custom sketch only prints Serial text, the app may show logs, but Settings and Live Monitor may not work as designed. ## What is not yet physically validated @@ -51,7 +57,7 @@ Unless your supplier provides separate written evidence, this package does not c - Relay driver wiring, output polarity, and load safety. - Buzzer wiring and polarity. - EEPROM save/load behavior on the selected physical board. -- Firmware upload procedure on customer hardware. +- Firmware upload procedure and optional sketch compile workflow on customer hardware. - Power supply, enclosure, cable strain relief, or field-installation safety. For more detail, see `docs/customer_handoff.md`. diff --git a/release/templates/maintainer_release_notes.md b/release/templates/maintainer_release_notes.md index ef176e9..d2fa24f 100644 --- a/release/templates/maintainer_release_notes.md +++ b/release/templates/maintainer_release_notes.md @@ -113,7 +113,7 @@ Physical test evidence summary: - [ ] Customer-facing notes distinguish software build checks from physical hardware validation. - [ ] No claim of physical hardware testing is made unless evidence is attached above. -- [ ] Firmware upload is described as prepared `.hex` transfer only, not raw `.ino` compilation or physical hardware validation. +- [ ] Firmware upload is described as a prepared `.hex` transfer workflow, and sketch compilation is described as Arduino CLI-based Uno-only support without automatic code/library repair or physical hardware validation. - [ ] Generated EXE, HEX, and ZIP artifacts are not committed to git. - [ ] The ZIP `README.md` is staged from `release/templates/customer_zip_README.md` and avoids unsupported claims. - [ ] The customer ZIP is not sent until this claim review is complete. From 13063d2baba1370df6a7619b27bb9c65b1ce713e Mon Sep 17 00:00:00 2001 From: Aria00pp <123830753+Aria00pp@users.noreply.github.com> Date: Tue, 2 Jun 2026 13:38:52 +0330 Subject: [PATCH 2/2] Bundle Arduino CLI in release workflow --- .github/workflows/release-build.yml | 27 ++++++++++++++++++++++++ README.md | 2 +- docs/PACKAGING.md | 4 ++-- docs/customer_handoff.md | 6 +++--- release/BUILD_VERIFICATION.md | 17 ++++++--------- release/README.md | 2 +- release/templates/customer_zip_README.md | 4 ++-- 7 files changed, 43 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index d7dc2f6..e0fb280 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -40,6 +40,29 @@ jobs: } Get-Item $exe | Select-Object FullName,Length,LastWriteTime + - name: Stage Windows Arduino CLI compiler files + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $stage = 'release\artifacts\windows\tools\arduino-cli' + New-Item -ItemType Directory -Force -Path $stage | Out-Null + + $command = Get-Command arduino-cli -ErrorAction Stop + $source = $command.Source + if (-not (Test-Path $source -PathType Leaf)) { + throw "Could not locate arduino-cli executable from Get-Command result: $source" + } + + $stagedExe = Join-Path $stage 'arduino-cli.exe' + Copy-Item -Path $source -Destination $stagedExe -Force + if (-not (Test-Path $stagedExe -PathType Leaf)) { + throw "Staged Arduino CLI is missing: $stagedExe" + } + + Write-Host "Staged Arduino CLI from $source to $stagedExe" + & $stagedExe version + Get-Item $stagedExe | Select-Object FullName,Length,LastWriteTime + - name: Stage Windows avrdude uploader files shell: pwsh run: | @@ -88,6 +111,7 @@ jobs: path: | release/artifacts/windows/PortableAVRControlStudio.exe release/artifacts/windows/tools/avrdude/** + release/artifacts/windows/tools/arduino-cli/** if-no-files-found: error uno-firmware-hex: @@ -154,6 +178,7 @@ jobs: test -f release/artifacts/windows/PortableAVRControlStudio.exe test -f release/artifacts/windows/tools/avrdude/avrdude.exe test -f release/artifacts/windows/tools/avrdude/avrdude.conf + test -f release/artifacts/windows/tools/arduino-cli/arduino-cli.exe test -f release/artifacts/firmware/PortableAVRControlStudio.ino.hex - name: Assemble customer ZIP @@ -163,6 +188,7 @@ jobs: run: | set -euo pipefail test -f release/customer_package/PortableAVRControlStudio-customer-handoff.zip + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/arduino-cli/arduino-cli.exe ls -la release/customer_package - name: Generate SHA-256 checksums @@ -175,6 +201,7 @@ jobs: release/artifacts/firmware/PortableAVRControlStudio.ino.hex \ release/customer_package/PortableAVRControlStudio-customer-handoff.zip find release/artifacts/windows/tools/avrdude -type f -print0 | sort -z | xargs -0 sha256sum + find release/artifacts/windows/tools/arduino-cli -type f -print0 | sort -z | xargs -0 sha256sum } > release/artifacts/checksums/SHA256SUMS.txt cat release/artifacts/checksums/SHA256SUMS.txt diff --git a/README.md b/README.md index f82e553..31ff935 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ arduino-cli compile --fqbn arduino:avr:uno --output-dir release/artifacts/firmwa The expected prepared firmware artifact is `release/artifacts/firmware/PortableAVRControlStudio.ino.hex`. Release packages should include `PortableAVRControlStudio.ino.hex` beside the EXE and `tools/avrdude/` with the Windows uploader files staged by the release workflow. -For customer-side `.ino` / Sketch folder compile support, stage Arduino CLI for Windows under `release/artifacts/windows/tools/arduino-cli/` when practical so it is copied into the final package under `tools/arduino-cli/`. If that folder is not staged, package assembly still succeeds, but compile support requires `arduino-cli` to be installed on the customer PC `PATH`. Do not commit generated EXE, HEX, Arduino CLI tools, avrdude tools, libraries, build folders, or ZIP files. +The official Release Build workflow stages Arduino CLI for Windows under `release/artifacts/windows/tools/arduino-cli/` and the final customer package includes it under `tools/arduino-cli/`. If a custom/manual package does not include `tools/arduino-cli/`, package assembly still succeeds, but compile support falls back to `arduino-cli` installed on the customer PC `PATH`. Do not commit generated EXE, HEX, Arduino CLI tools, avrdude tools, libraries, build folders, or ZIP files. ## Draft status and hardware-test limitation diff --git a/docs/PACKAGING.md b/docs/PACKAGING.md index ee4a959..d4bac6a 100644 --- a/docs/PACKAGING.md +++ b/docs/PACKAGING.md @@ -51,11 +51,11 @@ The script copies these items into `release/customer_package/PortableAVRControlS 7. `docs\testing.md` 8. `docs\profiles\arduino_uno_avr.json` 9. `release/artifacts/windows/tools/avrdude/` staged as `tools/avrdude/` -10. Optional `release/artifacts/windows/tools/arduino-cli/` staged as `tools/arduino-cli/` when Arduino CLI is bundled for customer-side sketch compilation +10. `release/artifacts/windows/tools/arduino-cli/` staged as `tools/arduino-cli/` by the official Release Build workflow for customer-side sketch compilation The assembly script fails if `release/artifacts/windows/tools/avrdude/` does not include `avrdude.exe` and `avrdude.conf`. The release workflow stages those files from the Arduino AVR toolchain and copies required support files from the same Windows `bin` folder. These uploader files are generated release artifacts only and must not be committed to git. -Arduino CLI bundling is optional in this PR. To make customer-side `.ino` / Sketch folder compile support self-contained, stage `arduino-cli.exe` and any required Arduino CLI support/config files under `release/artifacts/windows/tools/arduino-cli/` before running `release/scripts/assemble_customer_package.py`; the script copies the whole folder into the customer package. If that folder is absent, the script does not fail, and compile support requires `arduino-cli` to be installed on the customer PC `PATH`. +The official Release Build workflow stages `arduino-cli.exe` under `release/artifacts/windows/tools/arduino-cli/` before running `release/scripts/assemble_customer_package.py`, so the normal customer ZIP includes `tools/arduino-cli/arduino-cli.exe`. For custom/manual packages, the assembly script still treats that folder as optional; if it is absent, compile support falls back to `arduino-cli` installed on the customer PC `PATH`. The firmware tab uploads prepared `.hex` artifacts to Arduino Uno using bundled or configured `avrdude`. It can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P (`arduino:avr:uno`) when Arduino CLI is bundled or on `PATH`. External libraries must already be available to Arduino CLI; the app does not automatically repair source code, guess missing libraries, or install random third-party libraries from compiler output. Compile success only means Arduino CLI generated a HEX, and upload success only means the firmware transfer command completed; neither result validates physical wiring, relay loads, sensors, power, or enclosure safety. diff --git a/docs/customer_handoff.md b/docs/customer_handoff.md index 1b3ab76..b3b31db 100644 --- a/docs/customer_handoff.md +++ b/docs/customer_handoff.md @@ -9,11 +9,11 @@ A prepared customer ZIP should contain: - `PortableAVRControlStudio.exe` — Windows desktop app. - `PortableAVRControlStudio.ino.hex` — prepared Arduino Uno firmware artifact, if firmware delivery is included. - `tools/avrdude/` — bundled Windows uploader files used by the Firmware tab when included in the release package. -- `tools/arduino-cli/` — optional bundled Arduino CLI files used for `.ino` / Sketch folder compile support when included in the release package. +- `tools/arduino-cli/` — bundled Arduino CLI files used for `.ino` / Sketch folder compile support in the official Release Build package. - `docs/` — protocol, product settings, testing notes, and hardware profile documents. - `docs/profiles/arduino_uno_avr.json` — the default documented wiring/profile for Arduino Uno. -The Firmware tab can upload the prepared `.hex` file when the package includes `tools/avrdude/` or when `avrdude` is available on `PATH`. It can compile prepared `.ino` files and Arduino Sketch folders for Arduino Uno / ATmega328P only when Arduino CLI is bundled under `tools/arduino-cli/` or installed on `PATH`. Compile success and upload success are tool results only; they are not physical hardware validation. +The Firmware tab can upload the prepared `.hex` file when the package includes `tools/avrdude/` or when `avrdude` is available on `PATH`. The official Release Build package includes Arduino CLI under `tools/arduino-cli/`; custom/manual packages without that folder can compile prepared `.ino` files and Arduino Sketch folders for Arduino Uno / ATmega328P only when Arduino CLI is installed on `PATH`. Compile success and upload success are tool results only; they are not physical hardware validation. ## How to run the Windows app @@ -99,7 +99,7 @@ The release package may include `PortableAVRControlStudio.ino.hex` at the custom The Firmware tab also includes **Compile Arduino Sketch for Uno**. It accepts an existing `.ino` file or an Arduino Sketch folder containing at least one `.ino`, compiles only for `arduino:avr:uno`, and places the generated `.hex` into the firmware path field when compilation succeeds. If a standalone `.ino` is not already inside a matching Arduino sketch folder, the app copies it into a temporary sketch folder and does not modify the original source file. -Sketch compile support requires Arduino CLI. The app looks for bundled Arduino CLI under `tools/arduino-cli/` first, then falls back to `arduino-cli` on `PATH`. If Arduino CLI is unavailable, the app reports: “Arduino CLI was not found. Use a package that includes tools/arduino-cli/ or install Arduino CLI before compiling sketches.” Sketches using only Arduino core features are supported directly after the `arduino:avr` core is available. Sketches using external libraries require those libraries to be available to Arduino CLI; the app does not automatically fix code, guess missing libraries, or install third-party libraries from compiler output. +Sketch compile support requires Arduino CLI. The official Release Build package includes bundled Arduino CLI under `tools/arduino-cli/`; the app looks there first, then falls back to `arduino-cli` on `PATH`. If Arduino CLI is unavailable, the app reports: “Arduino CLI was not found. Use a package that includes tools/arduino-cli/ or install Arduino CLI before compiling sketches.” Sketches using only Arduino core features are supported directly after the `arduino:avr` core is available. Sketches using external libraries require those libraries to be available to Arduino CLI; the app does not automatically fix code, guess missing libraries, or install third-party libraries from compiler output. When the customer package includes `tools/avrdude/`, the Firmware tab can upload either a prepared `.hex` file or a generated `.hex` file to an Arduino Uno using the bundled uploader, or a configured `avrdude` on `PATH` if bundled files are missing. Upload requires an Arduino Uno, a USB data cable, the correct COM port, and a compatible Arduino bootloader. diff --git a/release/BUILD_VERIFICATION.md b/release/BUILD_VERIFICATION.md index 9bcaefd..2466f15 100644 --- a/release/BUILD_VERIFICATION.md +++ b/release/BUILD_VERIFICATION.md @@ -31,7 +31,7 @@ To run it from GitHub: The workflow publishes downloadable GitHub Actions artifacts from the completed run: -- `portable-avr-control-studio-windows-exe` containing `PortableAVRControlStudio.exe`, staged `tools/avrdude/` uploader files, and optional staged `tools/arduino-cli/` compiler files when bundled. +- `portable-avr-control-studio-windows-exe` containing `PortableAVRControlStudio.exe`, staged `tools/avrdude/` uploader files, and staged `tools/arduino-cli/` compiler files. - `portable-avr-control-studio-uno-firmware` containing `PortableAVRControlStudio.ino.hex` and any related Arduino CLI firmware output files. - `portable-avr-control-studio-customer-package` containing `PortableAVRControlStudio-customer-handoff.zip` and `SHA256SUMS.txt`. - `portable-avr-control-studio-sha256-checksums` containing `SHA256SUMS.txt` for the EXE, HEX, customer ZIP, and staged uploader files where practical. The customer ZIP checksum also covers the bundled uploader tools in the final package. @@ -59,18 +59,17 @@ powershell -ExecutionPolicy Bypass -File .\release\scripts\build_windows_exe.ps1 The script installs or updates the Python packaging dependencies it needs, then runs PyInstaller against `gui\portable_avr_control_studio.py`. -Expected output files from the workflow include the EXE plus bundled uploader staging files. If Arduino CLI is bundled for customer-side `.ino` / Sketch folder compile support, stage it under `release\artifacts\windows\tools\arduino-cli\` as generated release tooling: +Expected output files from the workflow include the EXE, bundled uploader staging files, and bundled Arduino CLI staging files for customer-side `.ino` / Sketch folder compile support: ```text release\artifacts\windows\PortableAVRControlStudio.exe release\artifacts\windows\tools\avrdude\avrdude.exe release\artifacts\windows\tools\avrdude\avrdude.conf release\artifacts\windows\tools\avrdude\...required DLLs/support files... -release\artifacts\windows\tools\arduino-cli\arduino-cli.exe # optional -release\artifacts\windows\tools\arduino-cli\...support/config files... # optional +release\artifacts\windows\tools\arduino-cli\arduino-cli.exe ``` -The manual release workflow installs Arduino CLI and the `arduino:avr` core, locates the Arduino AVR `avrdude` tool, and stages the Windows uploader files under `release\artifacts\windows\tools\avrdude`. If practical, stage Arduino CLI under `release\artifacts\windows\tools\arduino-cli` so the customer package can compile prepared sketches without relying on PATH. Do not commit staged uploader or Arduino CLI files. +The manual release workflow installs Arduino CLI and the `arduino:avr` core, stages `arduino-cli.exe` under `release\artifacts\windows\tools\arduino-cli`, locates the Arduino AVR `avrdude` tool, and stages the Windows uploader files under `release\artifacts\windows\tools\avrdude`. Do not commit staged uploader or Arduino CLI files. Verify the EXE exists: @@ -140,9 +139,8 @@ release/customer_package/PortableAVRControlStudio-customer-handoff/ avrdude.exe avrdude.conf ...required DLLs/support files... - arduino-cli/ # optional; present only when bundled + arduino-cli/ arduino-cli.exe - ...support/config files... docs/ customer_handoff.md PROTOCOL.md @@ -160,8 +158,7 @@ test -f release/customer_package/PortableAVRControlStudio-customer-handoff/Porta test -f release/customer_package/PortableAVRControlStudio-customer-handoff/README.md test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/avrdude.exe test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/avrdude/avrdude.conf -# Optional when Arduino CLI is bundled for customer-side sketch compilation: -# test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/arduino-cli/arduino-cli.exe +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/tools/arduino-cli/arduino-cli.exe test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/customer_handoff.md test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/PROTOCOL.md test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/product_spec.md @@ -187,7 +184,7 @@ git status --short --ignored release/artifacts release/customer_package Expected behavior: - Tracked `.gitkeep` files may appear only if intentionally changed. -- Generated files under `release/artifacts/windows/`, including `tools/avrdude/` and optional `tools/arduino-cli/`, `release/artifacts/firmware/`, `release/artifacts/checksums/`, and `release/customer_package/` should be ignored. +- Generated files under `release/artifacts/windows/`, including `tools/avrdude/` and `tools/arduino-cli/`, `release/artifacts/firmware/`, `release/artifacts/checksums/`, and `release/customer_package/` should be ignored. - Do not commit generated `.exe`, `.hex`, `.zip`, checksum artifacts, uploader tools, Arduino CLI tools, libraries, or build folders. ## 6. Release-claim boundaries diff --git a/release/README.md b/release/README.md index c5a8c4f..290513b 100644 --- a/release/README.md +++ b/release/README.md @@ -65,6 +65,6 @@ Record release evidence in `release/templates/maintainer_release_notes.md` and k ## Important release boundaries - The primary firmware artifact is for Arduino Uno / ATmega328P AVR using `arduino:avr:uno`. -- Firmware upload remains a prepared `.hex` artifact workflow for Arduino Uno using bundled or configured `avrdude`. The app can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P through Arduino CLI when `tools/arduino-cli/` is bundled or `arduino-cli` is on PATH. Compile and upload success are tool results only and are not physical hardware validation. +- Firmware upload remains a prepared `.hex` artifact workflow for Arduino Uno using bundled or configured `avrdude`. The official Release Build package bundles `tools/arduino-cli/arduino-cli.exe` so the app can compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P through Arduino CLI; custom/manual packages without that folder fall back to `arduino-cli` on PATH. Compile and upload success are tool results only and are not physical hardware validation. - Demo mode is simulation only. - This repository does not claim physical hardware validation. Record any future hardware evidence outside this draft package until it is reviewed and approved for customer release notes. diff --git a/release/templates/customer_zip_README.md b/release/templates/customer_zip_README.md index b8e5243..8f90495 100644 --- a/release/templates/customer_zip_README.md +++ b/release/templates/customer_zip_README.md @@ -2,7 +2,7 @@ ## What this package is -This ZIP contains a Windows desktop app and a prepared Arduino Uno / ATmega328P AVR firmware artifact for Portable AVR Control Studio. When Arduino CLI is bundled under `tools/arduino-cli/` or installed on the customer PC `PATH`, the app can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P. It is intended for a reviewed customer handoff using the included Arduino Uno hardware profile. +This ZIP contains a Windows desktop app and a prepared Arduino Uno / ATmega328P AVR firmware artifact for Portable AVR Control Studio. The official Release Build package includes Arduino CLI under `tools/arduino-cli/`, so the app can also compile prepared `.ino` files or Arduino Sketch folders for Arduino Uno / ATmega328P; custom/manual packages without that folder fall back to Arduino CLI on the customer PC `PATH`. It is intended for a reviewed customer handoff using the included Arduino Uno hardware profile. ## How to start the app @@ -31,7 +31,7 @@ Unknown hardware is not automatically detected. Use only reviewed and documented `PortableAVRControlStudio.ino.hex` is a prepared firmware artifact for Arduino Uno / ATmega328P AVR. The app still uploads prepared `.hex` files directly. -The Firmware tab also has **Compile Arduino Sketch for Uno**. It accepts an existing `.ino` file or an Arduino Sketch folder and compiles only for Arduino Uno / ATmega328P (`arduino:avr:uno`) through Arduino CLI. The app looks for `tools/arduino-cli/` first and then `arduino-cli` on `PATH`. If Arduino CLI is missing, install it or use a package that includes `tools/arduino-cli/` before compiling sketches. +The Firmware tab also has **Compile Arduino Sketch for Uno**. It accepts an existing `.ino` file or an Arduino Sketch folder and compiles only for Arduino Uno / ATmega328P (`arduino:avr:uno`) through Arduino CLI. The official package includes `tools/arduino-cli/`; the app looks there first and then falls back to `arduino-cli` on `PATH`. If Arduino CLI is missing, install it or use a package that includes `tools/arduino-cli/` before compiling sketches. Sketches using only Arduino core features are supported directly after Arduino CLI has the `arduino:avr` core. Sketches using external libraries require those libraries to be available to Arduino CLI. The app does not automatically repair code, guess missing libraries, or install third-party libraries from compiler output.