25 lines
452 B
Go
25 lines
452 B
Go
package picotool
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
)
|
|
|
|
func Load(uf2Path string) error {
|
|
cmd := exec.Command("picotool", "load", "-f", uf2Path)
|
|
out, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return fmt.Errorf("picotool load: %w\n%s", err, out)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Reboot() error {
|
|
cmd := exec.Command("picotool", "reboot")
|
|
out, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return fmt.Errorf("picotool reboot: %w\n%s", err, out)
|
|
}
|
|
return nil
|
|
}
|