Skip to content

Commit 8aa5d06

Browse files
committed
Update to 2.2.0 and use filepath.Join
1 parent 85504eb commit 8aa5d06

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

main.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ import (
1414
"strings"
1515
"time"
1616

17-
"github.com/kardianos/osext"
18-
"github.com/mattn/go-shellwords"
17+
shellwords "github.com/mattn/go-shellwords"
1918
)
2019

2120
var (
2221
verbose = flag.Bool("v", false, "Show verbose logging")
2322
quiet = flag.Bool("q", true, "Show quiet logging")
2423
force = flag.Bool("f", false, "Force firmware update")
2524
copier = flag.Bool("c", false, "Copy bin_file to bin_save")
26-
core = flag.String("core", "", "Core version")
25+
core = flag.String("core", "", "Firmware location")
2726
from = flag.String("from", "", "Original file location")
2827
to = flag.String("to", "", "Save file location")
2928
dfu_path = flag.String("dfu", "", "Location of dfu-util binaries")
@@ -35,7 +34,7 @@ var (
3534
rtos_compliance_offset = flag.Int("rtos_fw_pos", 0, "RTOS FW ID offset")
3635
)
3736

38-
const Version = "2.1.0"
37+
const Version = "2.2.0"
3938

4039
const dfu_flags = "-d,8087:0ABA"
4140
const rtos_firmware = "quark.bin"
@@ -71,7 +70,7 @@ func main_load() {
7170
*ble_compliance_string = strings.Replace(*ble_compliance_string, "\"", "", -1)
7271
*rtos_compliance_string = strings.Replace(*rtos_compliance_string, "\"", "", -1)
7372

74-
dfu := *dfu_path + "/dfu-util"
73+
dfu := filepath.Join(*dfu_path, "dfu-util")
7574
dfu = filepath.ToSlash(dfu)
7675

7776
PrintlnVerbose("Serial Port: " + *com_port)
@@ -202,13 +201,12 @@ func main_load() {
202201
}
203202
}
204203

205-
executablePath, _ := osext.ExecutableFolder()
206-
firmwarePath := executablePath + "/firmwares/" + *core + "/"
204+
firmwarePath := *core
207205

208206
if needUpdateBLE || *force == true {
209207

210208
// flash current BLE firmware to partition 8
211-
dfu_ble_flash_command := []string{dfu, dfu_flags, "-D", firmwarePath + ble_firmware, "--alt", "8"}
209+
dfu_ble_flash_command := []string{dfu, dfu_flags, "-D", filepath.Join(firmwarePath, ble_firmware), "--alt", "8"}
212210

213211
fmt.Println("ATTENTION: BLE firmware is being flashed")
214212
fmt.Println("DO NOT DISCONNECT THE BOARD")
@@ -223,7 +221,7 @@ func main_load() {
223221
if needUpdateRTOS || *force == true {
224222

225223
// flash current RTOS firmware to partition 2
226-
dfu_rtos_flash_command := []string{dfu, dfu_flags, "-D", firmwarePath + rtos_firmware, "--alt", "2"}
224+
dfu_rtos_flash_command := []string{dfu, dfu_flags, "-D", filepath.Join(firmwarePath, rtos_firmware), "--alt", "2"}
227225

228226
fmt.Println("ATTENTION: RTOS firmware is being flashed")
229227
fmt.Println("DO NOT DISCONNECT THE BOARD")

0 commit comments

Comments
 (0)