all: use internal objcopy implementation

This lessens the dependency on binutils (e.g. arm-none-eabi-objcopy).
This commit is contained in:
Ayke van Laethem
2019-02-23 19:41:30 +01:00
committed by Ron Evans
parent 3538ba943c
commit 4f932b6e66
6 changed files with 90 additions and 19 deletions
+3 -10
View File
@@ -259,19 +259,12 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
}
}
// Get an Intel .hex file or .bin file from the .elf file.
if outext == ".hex" || outext == ".bin" {
// Get an Intel .hex file or .bin file from the .elf file.
tmppath = filepath.Join(dir, "main"+outext)
format := map[string]string{
".hex": "ihex",
".bin": "binary",
}[outext]
cmd := exec.Command(spec.Objcopy, "-O", format, executable, tmppath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
err := Objcopy(executable, tmppath)
if err != nil {
return &commandError{"failed to extract " + format + " from", executable, err}
return err
}
}
return action(tmppath)