diff --git a/right/build/kds/blhost-unix.sh b/right/build/kds/blhost-unix.sh deleted file mode 100755 index b8b1f1f..0000000 --- a/right/build/kds/blhost-unix.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -set -e # fail the script if a command fails - -PATH=$PATH:/usr/local/bin # This should make node and npm accessible on OSX. -firmware_image=`pwd`/$1 -usb_dir=../../../lib/agent/packages/usb -usb_binding=$usb_dir/node_modules/node-hid/build/Release/HID.node - -case "$(uname -s)" in - Linux) - blhost_path=linux/amd64 - ;; - Darwin) - blhost_path=mac - ;; - *) - echo 'Your operating system is not supported.' - exit 1 - ;; -esac - -blhost="../../../lib/bootloader/bin/Tools/blhost/$blhost_path/blhost --usb 0x1d50,0x6120" - -set -x # echo on - -if [ ! -f $usb_binding ]; then - echo 'You have to make jump-to-bootloader.js work by executing `npm i` in ${UhkFirmwareDirectory}/lib/agent' - exit 1 -fi - -$usb_dir/reenumerate.js bootloader -$blhost flash-security-disable 0403020108070605 -$blhost flash-erase-region 0xc000 475136 -$blhost flash-image $firmware_image -$blhost reset diff --git a/right/build/kds/uhk-right debug blhost.launch b/right/build/kds/uhk-right debug kboot.launch similarity index 98% rename from right/build/kds/uhk-right debug blhost.launch rename to right/build/kds/uhk-right debug kboot.launch index 35097b7..9f00036 100644 --- a/right/build/kds/uhk-right debug blhost.launch +++ b/right/build/kds/uhk-right debug kboot.launch @@ -19,7 +19,7 @@ - + diff --git a/right/build/kds/uhk-right release blhost.launch b/right/build/kds/uhk-right release kboot.launch similarity index 98% rename from right/build/kds/uhk-right release blhost.launch rename to right/build/kds/uhk-right release kboot.launch index 1a4c05e..d10f9c0 100644 --- a/right/build/kds/uhk-right release blhost.launch +++ b/right/build/kds/uhk-right release kboot.launch @@ -19,7 +19,7 @@ - + diff --git a/scripts/update-master-firmware.js b/scripts/update-master-firmware.js new file mode 100755 index 0000000..2ea81d2 --- /dev/null +++ b/scripts/update-master-firmware.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node +const program = require('commander'); +require('shelljs/global'); +require('./shared') + +const extension = '.srec'; +config.fatal = true; + +program + .usage(`update-master-firmware `) + .parse(process.argv) + +const firmwareImage = program.args[0]; +const usbDir = '../../../lib/agent/packages/usb'; +const blhost = getBlhostCmd(0x6120); + +checkFirmwareImage(firmwareImage, extension); + +config.verbose = true; +exec(`${usbDir}/reenumerate.js bootloader`); +exec(`${blhost} flash-security-disable 0403020108070605`); +exec(`${blhost} flash-erase-region 0xc000 475136`); +exec(`${blhost} flash-image ${firmwareImage}`); +exec(`${blhost} reset`); +config.verbose = false; + +echo('Firmware updated successfully');