Skip to content

Commit 18f9272

Browse files
konkersMassimiliano Pippi
authored and
Massimiliano Pippi
committed
Only copy elf file if it exists. (#420)
Some boards do not produce elf file intermediate (i.e those that use build.preferred_export_format=axf or the like). This changes the logic so that it's not an error for and elf file to be missing.
1 parent 4c32595 commit 18f9272

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: commands/compile/compile.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
209209

210210
// Copy .elf file to sketch directory
211211
srcElf := paths.New(outputPath[:len(outputPath)-3] + "elf")
212-
dstElf := exportPath.Join(exportFile + ".elf")
213-
logrus.WithField("from", srcElf).WithField("to", dstElf).Debug("copying sketch build output")
214-
if err = srcElf.CopyTo(dstElf); err != nil {
215-
return nil, fmt.Errorf("copying elf file: %s", err)
212+
if srcElf.Exist() {
213+
dstElf := exportPath.Join(exportFile + ".elf")
214+
logrus.WithField("from", srcElf).WithField("to", dstElf).Debug("copying sketch build output")
215+
if err = srcElf.CopyTo(dstElf); err != nil {
216+
return nil, fmt.Errorf("copying elf file: %s", err)
217+
}
216218
}
217219

218220
logrus.Tracef("Compile %s for %s successful", sketch.Name, fqbnIn)

0 commit comments

Comments
 (0)