small improvements

This commit is contained in:
Conor Patrick
2019-01-02 20:59:37 -05:00
parent 8e8d74c5ad
commit b8a27eadca
6 changed files with 88 additions and 30 deletions

View File

@@ -12,17 +12,17 @@ all-locked:
$(MAKE) -f application.mk -j8 solo.hex EXTRA_DEFINES='-DFLASH_ROP=2'
debugboot-app:
$(MAKE) -f application.mk -j8 solo.hex DEBUG=1 \
$(MAKE) -f application.mk -j8 solo.hex DEBUG=2 \
LDSCRIPT=linker/stm32l4xx_extra.ld EXTRA_DEFINES='-DAPPLICATION_START_PAGE=16 -DSOLO_HACKER'
debugboot-boot:
$(MAKE) -f bootloader.mk -j8 bootloader.hex DEBUG=1 \
LDSCRIPT=linker/bootloader_stm32l4xx_extra.ld EXTRA_DEFINES='-DAPPLICATION_START_PAGE=16 -DSOLO_HACKER'
boot:
$(MAKE) -f bootloader.mk -j8 bootloader.hex DEBUG=$(DEBUG)
boot-sig-checking:
$(MAKE) -f bootloader.mk -j8 bootloader.hex
boot-hacker:
boot-no-sig:
$(MAKE) -f bootloader.mk -j8 bootloader.hex EXTRA_DEFINES='-DSOLO_HACKER'
clean:

View File

@@ -1,21 +1,21 @@
/*
* Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
*
*
* This file is part of Solo.
*
*
* Solo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Solo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with Solo. If not, see <https://www.gnu.org/licenses/>
*
*
* This code is available under licenses for commercial use.
* Please contact SoloKeys for more information.
*/
@@ -114,10 +114,10 @@ int main(int argc, char * argv[])
}
else
{
printf1(TAG_RED,"Not authorized to boot (%08x == %08lx)\r\n", AUTH_WORD_ADDR, *(uint32_t*)AUTH_WORD_ADDR);
}
start_bootloader:
usbhid_init();
printf1(TAG_GEN,"init usb\n");
@@ -155,7 +155,7 @@ int main(int argc, char * argv[])
device_reboot();
}
#ifdef SOLO_HACKER
// Boot ST bootloader if button is held for 2s
// Boot ST bootloader if button is held for 5s
if (!device_is_button_pressed())
{
stboot_time = millis();

View File

@@ -1,21 +1,21 @@
#
# Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
#
#
# This file is part of Solo.
#
#
# Solo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# Solo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with Solo. If not, see <https://www.gnu.org/licenses/>
#
#
# This code is available under licenses for commercial use.
# Please contact SoloKeys for more information.
#
@@ -59,6 +59,14 @@ for i in range(2, len(args)-1):
print('merging %s with ' % (args[1]), args[i])
first.merge(IntelHex( args[i] ), overlap = 'replace')
first [ flash_addr(APPLICATION_END_PAGE-1) ] = 0x41
first [ flash_addr(APPLICATION_END_PAGE-1)+1 ] = 0x41
first[AUTH_WORD_ADDR-4] = 0
first[AUTH_WORD_ADDR-1] = 0
first[AUTH_WORD_ADDR-2] = 0
first[AUTH_WORD_ADDR-3] = 0
first[AUTH_WORD_ADDR] = 0
first[AUTH_WORD_ADDR+1] = 0
first[AUTH_WORD_ADDR+2] = 0
@@ -69,6 +77,7 @@ first[AUTH_WORD_ADDR+5] = 0xff
first[AUTH_WORD_ADDR+6] = 0xff
first[AUTH_WORD_ADDR+7] = 0xff
if secret_attestation_key is not None:
key = unhexlify(secret_attestation_key)

View File

@@ -124,6 +124,22 @@ void usb_init(void);
void usbhid_init()
{
usb_init();
#if DEBUG_LEVEL>1
wait_for_usb_tether();
#endif
}
void wait_for_usb_tether()
{
while (USBD_OK != CDC_Transmit_FS("tethered\r\n", 10) )
;
while (USBD_OK != CDC_Transmit_FS("tethered\r\n", 10) )
;
delay(10);
while (USBD_OK != CDC_Transmit_FS("tethered\r\n", 10) )
;
}
int usbhid_recv(uint8_t * msg)

View File

@@ -210,7 +210,6 @@ void usb_init()
USBD_Composite_Set_Classes(&USBD_HID, &USBD_CDC);
// USBD_Composite_Set_Classes(&USBD_CDC, &USBD_CDC);
in_endpoint_to_class[HID_EPIN_ADDR & 0x7F] = 0;
out_endpoint_to_class[HID_EPOUT_ADDR & 0x7F] = 0;