Files
firmware-flasher/DB720Flasher/Profile.cs
insulee 69f4d4754f Initial commit: 펌웨어 플래시 도구 (WPF) + 기존 PowerShell 키트
- DB720Flasher: WPF .NET 9 GUI 플래셔
  - 멀티모델 프로파일(flash.json + 빌트인 DB720/DB402S/DB400S/DB400Q/DB300eM)
  - 포트 자동감지(JTAG 우선, 유령 포트 자동 회피), esptool v5 동봉
- flash_app.ps1 / flash_full.ps1 / list_ports.ps1: 기존 PowerShell 키트
- profiles/: 모델별 flash.json 템플릿
- firmware/flash.json: DB720 모델 설정 (서명 실펌웨어 .bin 은 repo 제외)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 16:10:40 +09:00

52 lines
2.7 KiB
C#

namespace DB720Flasher;
/// <summary>flash.json 의 한 영역 — 어떤 파일을 flash 어느 주소에 쓰는지.</summary>
public sealed class FwRegion
{
public string? File { get; set; } // 보조 파일명 (app=true 면 비움)
public bool App { get; set; } // 앱 영역 표시
public string Offset { get; set; } = "0x0";
public string Kind { get; set; } = "support"; // bootloader | support | app
}
/// <summary>
/// 모델 프로파일 — 칩·offset·플래시 방식을 한 곳에 담는다.
/// firmware 폴더의 flash.json 으로 덮어쓰거나, 빌트인을 그대로 쓴다.
/// </summary>
public sealed class FlashProfile
{
public string Name { get; set; } = "Custom";
public string Chip { get; set; } = "esp32"; // esp32 | esp32s3 | esp32p4 | ...
public int Baud { get; set; } = 921600;
public bool NoStub { get; set; } // DB720(SDM)=true
public bool PerRegion { get; set; } // DB720=true(영역별 개별 호출), 클래식=false(한 번에)
public int ConnectAttempts { get; set; } = 10;
public string? FlashSize { get; set; } // DB720="16MB"; null=자동(스텁)
public string? FlashMode { get; set; } // DB720="dio"
public string? FlashFreq { get; set; } // DB720="80m"
public string Before { get; set; } = "default-reset";
public string After { get; set; } = "hard-reset";
public bool AppOnlyErasesOtadata { get; set; } // DB720=true
public string OtadataOffset { get; set; } = "0x11000";
public string OtadataSize { get; set; } = "0x2000";
public List<FwRegion> Regions { get; set; } = new();
public string? FlashPortHint { get; set; } // "303A:1001" — 자동선택 우선
public string? ConsolePortHint { get; set; } // "10C4:EA60" — 경고만(막지 않음)
public string? DownloadModeHint { get; set; } // 다운로드 모드 진입 안내
public string? Notes { get; set; }
public bool FromFile { get; set; } // 폴더 flash.json 출처면 true(런타임)
public FwRegion? AppRegion => Regions.FirstOrDefault(r => r.App);
public FwRegion? Bootloader => Regions.FirstOrDefault(r => r.Kind == "bootloader");
public bool HasBootloader => Bootloader?.File is not null;
public IEnumerable<FwRegion> SupportRegions => Regions.Where(r => !r.App && r.File is not null);
public string AppOffset => AppRegion?.Offset ?? "0x20000";
public string Summary =>
$"{Chip} · {(NoStub ? "no-stub" : "stub")} · {Baud}" +
(FlashPortHint is not null ? $" · 포트 {FlashPortHint}" : "");
public override string ToString() => Name;
}