export flash, openocd, msd

This commit is contained in:
Li Jie
2025-09-06 16:21:15 +08:00
parent 1033452e8f
commit da9865104f
4 changed files with 61 additions and 8 deletions

View File

@@ -35,10 +35,14 @@ type Config struct {
UF2FamilyID string `json:"uf2-family-id"`
// Flash and deployment configuration
FlashCommand string `json:"flash-command"`
FlashMethod string `json:"flash-method"`
FlashMethod string `json:"flash-method"` // values: command, openocd, msd
FlashCommand string `json:"flash-command"` // used when FlashMethod == "command"
Flash1200BpsReset string `json:"flash-1200-bps-reset"`
// Serial configuration
Serial string `json:"serial"` // Serial communication type (e.g., "usb")
SerialPort []string `json:"serial-port"` // Serial port identifiers (e.g., vendor:product IDs)
// Mass storage device configuration
MSDVolumeName []string `json:"msd-volume-name"`
MSDFirmwareName string `json:"msd-firmware-name"`

View File

@@ -167,6 +167,9 @@ func (l *Loader) mergeConfig(dst, src *Config) {
if src.Flash1200BpsReset != "" {
dst.Flash1200BpsReset = src.Flash1200BpsReset
}
if src.Serial != "" {
dst.Serial = src.Serial
}
if src.MSDFirmwareName != "" {
dst.MSDFirmwareName = src.MSDFirmwareName
}
@@ -202,6 +205,9 @@ func (l *Loader) mergeConfig(dst, src *Config) {
if len(src.ExtraFiles) > 0 {
dst.ExtraFiles = append(dst.ExtraFiles, src.ExtraFiles...)
}
if len(src.SerialPort) > 0 {
dst.SerialPort = append(dst.SerialPort, src.SerialPort...)
}
if len(src.MSDVolumeName) > 0 {
dst.MSDVolumeName = append(dst.MSDVolumeName, src.MSDVolumeName...)
}