Port the blhost-unix.sh firmware update script of the right keyboard half to ShellJS resulting in update-master-firmware.js
This commit is contained in:
@@ -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
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="uhk-right-debug-srec/uhk-right.srec"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="uhk-right-debug-srec/uhk-right.srec"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="blhost-unix.sh"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="../../../scripts/update-master-firmware.js"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
|
||||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.1939339834.1692217331.1297236062"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.1939339834.1692217331.1297236062"/>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="uhk-right-release-srec/uhk-right.srec"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="uhk-right-release-srec/uhk-right.srec"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="blhost-unix.sh"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="../../../scripts/update-master-firmware.js"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
|
||||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.1939339834.1692217331"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.1939339834.1692217331"/>
|
||||||
27
scripts/update-master-firmware.js
Executable file
27
scripts/update-master-firmware.js
Executable file
@@ -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 <firmware-image${extension}>`)
|
||||||
|
.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');
|
||||||
Reference in New Issue
Block a user