refactor: move device types definition into flash

This commit is contained in:
Li Jie
2025-09-07 10:06:01 +08:00
parent 1c2aea10f0
commit c0afe199c2
6 changed files with 118 additions and 92 deletions

View File

@@ -84,11 +84,11 @@ func determineFlashFormat(crossCompile *crosscompile.Export) string {
return ""
}
flashMethod := crossCompile.Flash.Method
flashMethod := crossCompile.Device.Flash.Method
switch flashMethod {
case "command", "":
// Extract format from flash command tokens
flashCommand := crossCompile.Flash.Command
flashCommand := crossCompile.Device.Flash.Command
switch {
case strings.Contains(flashCommand, "{hex}"):
return ".hex"
@@ -106,10 +106,10 @@ func determineFlashFormat(crossCompile *crosscompile.Export) string {
return ""
}
case "msd":
if crossCompile.MSD.FirmwareName == "" {
if crossCompile.Device.MSD.FirmwareName == "" {
return ""
}
return filepath.Ext(crossCompile.MSD.FirmwareName)
return filepath.Ext(crossCompile.Device.MSD.FirmwareName)
case "openocd":
return ".hex"
case "bmp":