small script fixes

This commit is contained in:
Conor Patrick 2018-12-08 23:28:43 -05:00
parent 5dd3355bd8
commit 09778c7c51
4 changed files with 11 additions and 13 deletions

View File

@ -177,6 +177,8 @@ void heartbeat()
{
state = !state;
}
#ifdef LED_WINK_VALUE
if (wink_time)
{
if (millis() - winkt1 > 120)
@ -194,6 +196,7 @@ void heartbeat()
}
}
else
#endif
{
if (but)
led_rgb(((val * r)<<8) | ((val*b) << 16) | (val*g));
@ -423,10 +426,9 @@ led_rgb(0x001040);
delay(50);
#if SKIP_BUTTON_CHECK_FAST
done:
return 1;
#endif
fail:
return 0;

View File

@ -132,11 +132,6 @@ class Programmer():
self.exchange(SoloBootloader.done,0,sig)
def wink(self,):
"""
If solo is configured as solo hacker or something similar,
this command will tell the token to boot directly to the bootloader
so it can be reprogrammed
"""
self.send_data_hid(CTAPHID.WINK,b'')
def enter_solo_bootloader(self,):

View File

@ -21,11 +21,12 @@ def get_firmware_object(sk_name, hex_file):
fw = open(hex_file,'r').read()
fw = base64.b64encode(fw.encode())
fw = to_websafe(fw.decode())
ih = IntelHex()
ih.fromfile(hex_file, format='hex')
# start of firmware and the size of the flash region allocated for it.
# TODO put this somewhere else.
START = ih.segments()[0][0]
END = ((0x08000000 + ((128-19)*2024))-8)
END = ((0x08000000 + ((128-19)*2048))-8)
ih = IntelHex(hex_file)
segs = ih.segments()
@ -56,7 +57,7 @@ if __name__ == '__main__':
if len(sys.argv) != 4:
print('usage: %s <signing-key.pem> <app.hex> <output.json>' % sys.argv[0])
msg = get_firmware_object(sys.argv[1],sys.argv[2])
print('Saving signed firmware to firmware.json')
print('Saving signed firmware to', sys.argv[3])
wfile = open(sys.argv[3],'wb+')
wfile.write(json.dumps(msg).encode())
wfile.close()

View File

@ -1426,8 +1426,8 @@ async function run_tests() {
async function test_bootloader()
{
var start = 0x8000;
var size = 186 * 1024 - 8;
var start = 10 * 2048;
var size = 198 * 1024 - 8;
var num_pages = 64;
var p = await dev.is_bootloader();