@@ -14,16 +14,15 @@ import (
14
14
"strings"
15
15
"time"
16
16
17
- "github.com/kardianos/osext"
18
- "github.com/mattn/go-shellwords"
17
+ shellwords "github.com/mattn/go-shellwords"
19
18
)
20
19
21
20
var (
22
21
verbose = flag .Bool ("v" , false , "Show verbose logging" )
23
22
quiet = flag .Bool ("q" , true , "Show quiet logging" )
24
23
force = flag .Bool ("f" , false , "Force firmware update" )
25
24
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 " )
27
26
from = flag .String ("from" , "" , "Original file location" )
28
27
to = flag .String ("to" , "" , "Save file location" )
29
28
dfu_path = flag .String ("dfu" , "" , "Location of dfu-util binaries" )
35
34
rtos_compliance_offset = flag .Int ("rtos_fw_pos" , 0 , "RTOS FW ID offset" )
36
35
)
37
36
38
- const Version = "2.1 .0"
37
+ const Version = "2.2 .0"
39
38
40
39
const dfu_flags = "-d,8087:0ABA"
41
40
const rtos_firmware = "quark.bin"
@@ -71,7 +70,7 @@ func main_load() {
71
70
* ble_compliance_string = strings .Replace (* ble_compliance_string , "\" " , "" , - 1 )
72
71
* rtos_compliance_string = strings .Replace (* rtos_compliance_string , "\" " , "" , - 1 )
73
72
74
- dfu := * dfu_path + "/ dfu-util"
73
+ dfu := filepath . Join ( * dfu_path , " dfu-util")
75
74
dfu = filepath .ToSlash (dfu )
76
75
77
76
PrintlnVerbose ("Serial Port: " + * com_port )
@@ -202,13 +201,12 @@ func main_load() {
202
201
}
203
202
}
204
203
205
- executablePath , _ := osext .ExecutableFolder ()
206
- firmwarePath := executablePath + "/firmwares/" + * core + "/"
204
+ firmwarePath := * core
207
205
208
206
if needUpdateBLE || * force == true {
209
207
210
208
// 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" }
212
210
213
211
fmt .Println ("ATTENTION: BLE firmware is being flashed" )
214
212
fmt .Println ("DO NOT DISCONNECT THE BOARD" )
@@ -223,7 +221,7 @@ func main_load() {
223
221
if needUpdateRTOS || * force == true {
224
222
225
223
// 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" }
227
225
228
226
fmt .Println ("ATTENTION: RTOS firmware is being flashed" )
229
227
fmt .Println ("DO NOT DISCONNECT THE BOARD" )
0 commit comments