mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
compiler: support output file using UF2 bootloader format
Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
committed by
Ayke van Laethem
parent
2c03192691
commit
2a1dd98661
@@ -266,6 +266,13 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if outext == ".uf2" {
|
||||
// Get UF2 from the .elf file.
|
||||
tmppath = filepath.Join(dir, "main"+outext)
|
||||
err := ConvertELFFileToUF2File(executable, tmppath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return action(tmppath)
|
||||
}
|
||||
@@ -321,6 +328,8 @@ func Flash(pkgName, target, port string, config *BuildConfig) error {
|
||||
fileExt = ".elf"
|
||||
case strings.Contains(spec.Flasher, "{bin}"):
|
||||
fileExt = ".bin"
|
||||
case strings.Contains(spec.Flasher, "{uf2}"):
|
||||
fileExt = ".uf2"
|
||||
default:
|
||||
return errors.New("invalid target file - did you forget the {hex} token in the 'flash' section?")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user