Skip to content

feat(arduino): flash verified Hana Cloud firmware in-app - #1

Merged
owjs3901 merged 23 commits into
dev-five-git:mainfrom
wingwogus:feat/arduino-firmware-installer
Aug 24, 2026
Merged

feat(arduino): flash verified Hana Cloud firmware in-app#1
owjs3901 merged 23 commits into
dev-five-git:mainfrom
wingwogus:feat/arduino-firmware-installer

Conversation

@wingwogus

@wingwogus wingwogus commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 최초 보드 식별은 시리얼 포트를 열거나 handshake를 보내지 않고 USB VID/PID를 Hana Cloud registry.json과 대조합니다.
  • 사용자가 설치를 명시적으로 확정한 뒤 dev-five-git/hana-cloud의 보드 manifest와 컴파일된 Intel HEX를 내려받아 SHA-256, 크기, schema, board id, FQBN을 검증합니다.
  • 별도 Arduino CLI 없이 앱 내 STK500v1 uploader가 Arduino Uno R3에 펌웨어를 기록합니다.

Safety and cross-platform fixes

  • ATmega328P 서명을 chip erase 전에 확인해 다른 MCU를 지우지 않습니다.
  • 32,256-byte 애플리케이션 영역을 벗어난 HEX와 중복 주소를 거부합니다.
  • sparse/cross-boundary HEX를 128-byte 물리 페이지로 정렬하고 0xFF로 채워 각 페이지를 한 번만 기록합니다.
  • Windows 컴파일 오류를 제거하고 avrdude 방식 DTR/RTS reset pulse를 적용했습니다.
  • macOS의 /dev/cu.* 필터를 macOS에만 한정해 Linux /dev/ttyACM*, /dev/ttyUSB*가 정상 인식됩니다.
  • Windows drive-qualified registry path를 거부해 Hana Cloud cache root 밖 접근을 막습니다.
  • 최초 온보딩 동안 runtime handshake worker를 보류하고, 설치 완료 후 정상 연결을 시작합니다.

Verification

  • cargo test --workspace: 180 unit + 34 integration tests passed
  • cargo clippy --workspace --all-targets -- -D warnings: passed
  • cargo fmt --all -- --check: passed
  • bun test: 70 passed
  • bun run typecheck: passed
  • bun run build: desktop/admin production builds passed
  • 현재 Hana Cloud arduino-uno-r3.hex: declared/actual size 11,211 bytes and SHA-256 b177f39bd3dcbbb817b853ba594796d69644e6ce407456f0ce0005b35bd149f1 verified
  • Independent re-review: no remaining Critical/Important findings

wingwogus and others added 23 commits August 23, 2026 22:38
Serialize firmware events as camelCase deviceId and reset the Uno at 1200 baud so avrdude talks to the bootloader instead of the running sketch.
A second 1200-baud pulse before avrdude made the bootloader miss the sync window. Keep the port free and let Arduino CLI reset the board once.
avrdude occasionally misses the 8-second bootloader window and reports programmer is not responding even though the bundled CLI uploads fine standalone. Retry the upload up to three times, rediscovering the port between attempts.
Closing the settings window (including onboarding finish) now restores the floating overlay, so a first-run user lands directly in scanning instead of a blank desktop.
Waiting/connecting/reconnecting states no longer rewrite the overlay status line, so the four scan cells never shift while the switch link is being established. Interval adaptation notices (e.g. 최근 반응이 빨라져) keep their seat.
설치 흐름을 hana-registry 조회 → hex 다운로드·검증 → 자체 플래싱으로
전환한다. 번들 arduino-cli 사이드카와 개발기 절대경로 스케치 픽스처는
제거된다.

- registry.rs: 레지스트리 클라이언트. 호스트 고정·리다이렉트 금지,
  용량 제한, 5초 타임아웃, SHA-256 검증 후 last-known-good 캐시.
  VID/PID는 u16 라운드트립 비교, descriptor 별칭은 NFKC 정규화 계약
  (레지스트리 테스트 벡터 통과) 적용.
- flasher.rs: Intel HEX 파서와 STK500v1(optiboot) 업로더. 청크마다 word
  주소를 증가시키는 주소 커서, 헤더 합 wrapping 체크섬, ATmega328P
  서명 검증. 전체 세션을 가짜 시리얼로 프레임 단위 테스트.
- firmware.rs: VID/PID 필터 제거(등록 판단은 레지스트리), Generic CDC
  product 폴백으로 알려진 보드명 복원, Verify 단계 부팅 재시도 윈도우,
  downloadFailed 에러 코드 추가.
- arduino.rs: installer_lease_alive 플래그로 살아있는 임대만 중복
  거부 — Setup 모드에서 설치 시작이 거부되던 회귀 수정.
- tauri.conf.json: externalBin 제거, binaries/ 삭제.

실기기 검증: Uno R3에서 빈 스케치 → 설치 → HANBEON_UNO_V1 핸드셰이크
및 스위치 입력 73건 정상 처리 확인.
Cargo.toml은 reqwest(app_registry)와 ureq(registry 보드 펌웨어)를 병행
하고, lib.rs는 양쪽 모듈을 모두 등록한다.

asFirmwareState는 구버전 snake_case device_id 입력도 받되 정규화 후
camelCase만 남긴다(소비자 단일 계약). 병합 후 Rust 170 테스트, TS
38 테스트 통과, clippy·typecheck 클린.
@owjs3901 owjs3901 changed the title feat(arduino): in-app firmware installer with bundled Arduino CLI feat(arduino): flash verified Hana Cloud firmware in-app Aug 24, 2026
@owjs3901
owjs3901 merged commit e8dbf96 into dev-five-git:main Aug 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants