Merge branch 'master' into license-change
This commit is contained in:
@@ -2,30 +2,33 @@ ifndef DEBUG
|
||||
DEBUG=0
|
||||
endif
|
||||
|
||||
APPMAKE=build/application.mk
|
||||
BOOTMAKE=build/application.mk
|
||||
|
||||
merge_hex=python ../../tools/solotool.py mergehex
|
||||
|
||||
all:
|
||||
$(MAKE) -f application.mk -j8 solo.hex PREFIX=$(PREFIX) DEBUG=$(DEBUG) EXTRA_DEFINES='-DFLASH_ROP=1'
|
||||
$(MAKE) -f $(APPMAKE) -j8 solo.hex PREFIX=$(PREFIX) DEBUG=$(DEBUG) EXTRA_DEFINES='-DFLASH_ROP=1'
|
||||
|
||||
all-hacker:
|
||||
$(MAKE) -f application.mk -j8 solo.hex PREFIX=$(PREFIX) DEBUG=$(DEBUG) EXTRA_DEFINES='-DSOLO_HACKER -DFLASH_ROP=0'
|
||||
$(MAKE) -f $(APPMAKE) -j8 solo.hex PREFIX=$(PREFIX) DEBUG=$(DEBUG) EXTRA_DEFINES='-DSOLO_HACKER -DFLASH_ROP=0'
|
||||
|
||||
all-locked:
|
||||
$(MAKE) -f application.mk -j8 solo.hex PREFIX=$(PREFIX) EXTRA_DEFINES='-DFLASH_ROP=2'
|
||||
$(MAKE) -f $(APPMAKE) -j8 solo.hex PREFIX=$(PREFIX) EXTRA_DEFINES='-DFLASH_ROP=2'
|
||||
|
||||
debugboot-app:
|
||||
$(MAKE) -f application.mk -j8 solo.hex DEBUG=2 PREFIX=$(PREFIX)\
|
||||
$(MAKE) -f $(APPMAKE) -j8 solo.hex DEBUG=2 PREFIX=$(PREFIX)\
|
||||
LDSCRIPT=linker/stm32l4xx_extra.ld EXTRA_DEFINES='-DAPPLICATION_START_PAGE=16 -DSOLO_HACKER'
|
||||
|
||||
debugboot-boot:
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex PREFIX=$(PREFIX) DEBUG=1 \
|
||||
$(MAKE) -f $(BOOTMAKE) -j8 bootloader.hex PREFIX=$(PREFIX) DEBUG=1 \
|
||||
LDSCRIPT=linker/bootloader_stm32l4xx_extra.ld EXTRA_DEFINES='-DAPPLICATION_START_PAGE=16 -DSOLO_HACKER'
|
||||
|
||||
boot-sig-checking:
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex PREFIX=$(PREFIX) DEBUG=0
|
||||
$(MAKE) -f $(BOOTMAKE) -j8 bootloader.hex PREFIX=$(PREFIX) DEBUG=0
|
||||
|
||||
boot-no-sig:
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex PREFIX=$(PREFIX) EXTRA_DEFINES='-DSOLO_HACKER' DEBUG=0
|
||||
$(MAKE) -f $(BOOTMAKE) -j8 bootloader.hex PREFIX=$(PREFIX) EXTRA_DEFINES='-DSOLO_HACKER' DEBUG=0
|
||||
|
||||
build-release-locked: clean2 boot-sig-checking clean all-locked
|
||||
$(merge_hex) solo.hex bootloader.hex all.hex
|
||||
@@ -38,12 +41,12 @@ build-hacker: clean2 boot-no-sig clean all-hacker
|
||||
$(merge_hex) solo.hex bootloader.hex all.hex
|
||||
|
||||
clean:
|
||||
$(MAKE) -f application.mk clean
|
||||
$(MAKE) -f bootloader.mk clean
|
||||
$(MAKE) -f $(APPMAKE) clean
|
||||
$(MAKE) -f $(BOOTMAKE) clean
|
||||
clean2:
|
||||
rm -f solo.hex bootloader.hex all.hex
|
||||
$(MAKE) -f application.mk clean
|
||||
$(MAKE) -f bootloader.mk clean
|
||||
$(MAKE) -f $(APPMAKE) clean
|
||||
$(MAKE) -f $(BOOTMAKE) clean
|
||||
|
||||
|
||||
flash: solo.hex bootloader.hex
|
||||
|
@@ -4,6 +4,7 @@
|
||||
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
// copied, modified, or distributed except according to those terms.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -176,8 +177,12 @@ int bootloader_bridge(int klen, uint8_t * keyh)
|
||||
case BootVersion:
|
||||
has_erased = 0;
|
||||
printf1(TAG_BOOT, "BootVersion.\r\n");
|
||||
version = BOOT_VERSION_MAJ;
|
||||
u2f_response_writeback(&version,1);
|
||||
version = BOOT_VERSION_MIN;
|
||||
u2f_response_writeback(&version,1);
|
||||
version = BOOT_VERSION_PATCH;
|
||||
u2f_response_writeback(&version,1);
|
||||
return 0;
|
||||
break;
|
||||
case BootReboot:
|
||||
printf1(TAG_BOOT, "BootReboot.\r\n");
|
||||
|
@@ -4,9 +4,11 @@
|
||||
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
// copied, modified, or distributed except according to those terms.
|
||||
|
||||
#ifndef _APP_H_
|
||||
#define _APP_H_
|
||||
#include <stdint.h>
|
||||
#include "version.h"
|
||||
|
||||
#define DEBUG_UART USART1
|
||||
|
||||
@@ -50,6 +52,8 @@
|
||||
#define SKIP_BUTTON_CHECK_WITH_DELAY 0
|
||||
#define SKIP_BUTTON_CHECK_FAST 1
|
||||
|
||||
#define SOLO_PRODUCT_NAME "Solo Bootloader " VERSION
|
||||
|
||||
void printing_init();
|
||||
void hw_init(void);
|
||||
|
||||
|
@@ -1,7 +1,4 @@
|
||||
CC=$(PREFIX)arm-none-eabi-gcc
|
||||
CP=$(PREFIX)arm-none-eabi-objcopy
|
||||
SZ=$(PREFIX)arm-none-eabi-size
|
||||
AR=$(PREFIX)arm-none-eabi-ar
|
||||
include build/common.mk
|
||||
|
||||
# ST related
|
||||
SRC = src/main.c src/init.c src/redirect.c src/flash.c src/rng.c src/led.c src/device.c
|
||||
@@ -13,6 +10,7 @@ SRC += $(wildcard lib/*.c) $(wildcard lib/usbd/*.c)
|
||||
SRC += ../../fido2/util.c ../../fido2/u2f.c ../../fido2/test_power.c
|
||||
SRC += ../../fido2/stubs.c ../../fido2/log.c ../../fido2/ctaphid.c ../../fido2/ctap.c
|
||||
SRC += ../../fido2/ctap_parse.c ../../fido2/main.c
|
||||
SRC += ../../fido2/extensions/extensions.c ../../fido2/extensions/solo.c
|
||||
|
||||
# Crypto libs
|
||||
SRC += ../../crypto/sha256/sha256.c ../../crypto/micro-ecc/uECC.c ../../crypto/tiny-AES-c/aes.c
|
||||
@@ -45,7 +43,7 @@ endif
|
||||
DEFINES = -DDEBUG_LEVEL=$(DEBUG) -D$(CHIP) -DAES256=1 -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"app.h\" $(EXTRA_DEFINES)
|
||||
# DEFINES += -DTEST_SOLO_STM32 -DTEST -DTEST_FIFO=1
|
||||
|
||||
CFLAGS=$(INC) -c $(DEFINES) -Wall -fdata-sections -ffunction-sections $(HW) -g
|
||||
CFLAGS=$(INC) -c $(DEFINES) -Wall -fdata-sections -ffunction-sections $(HW) -g $(VERSION_FLAGS)
|
||||
LDFLAGS_LIB=$(HW) $(SEARCH) -specs=nano.specs -specs=nosys.specs -Wl,--gc-sections -u _printf_float -lnosys
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -Wl,-Bstatic -ltinycbor
|
||||
|
@@ -1,7 +1,4 @@
|
||||
CC=$(PREFIX)arm-none-eabi-gcc
|
||||
CP=$(PREFIX)arm-none-eabi-objcopy
|
||||
SZ=$(PREFIX)arm-none-eabi-size
|
||||
AR=$(PREFIX)arm-none-eabi-ar
|
||||
include build/common.mk
|
||||
|
||||
# ST related
|
||||
SRC = bootloader/main.c bootloader/bootloader.c
|
||||
@@ -44,9 +41,9 @@ endif
|
||||
DEFINES = -DDEBUG_LEVEL=$(DEBUG) -D$(CHIP) -DAES256=1 -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"bootloader.h\" $(EXTRA_DEFINES)
|
||||
# DEFINES += -DTEST_SOLO_STM32 -DTEST -DTEST_FIFO=1
|
||||
|
||||
CFLAGS=$(INC) -c $(DEFINES) -Wall -fdata-sections -ffunction-sections $(HW) -g
|
||||
CFLAGS=$(INC) -c $(DEFINES) -Wall -fdata-sections -ffunction-sections $(HW) -g $(VERSION_FLAGS)
|
||||
LDFLAGS_LIB=$(HW) $(SEARCH) -specs=nano.specs -specs=nosys.specs -Wl,--gc-sections -lnosys
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -Wl,-Bstatic
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -Wl,-Bstatic
|
||||
|
||||
|
||||
.PRECIOUS: %.o
|
19
targets/stm32l432/build/common.mk
Normal file
19
targets/stm32l432/build/common.mk
Normal file
@@ -0,0 +1,19 @@
|
||||
CC=$(PREFIX)arm-none-eabi-gcc
|
||||
CP=$(PREFIX)arm-none-eabi-objcopy
|
||||
SZ=$(PREFIX)arm-none-eabi-size
|
||||
AR=$(PREFIX)arm-none-eabi-ar
|
||||
|
||||
VERSION=$(shell git describe --abbrev=0 )
|
||||
VERSION_FULL=$(shell git describe)
|
||||
VERSION_MAJ=$(shell python -c 'print("$(VERSION)".split(".")[0])')
|
||||
VERSION_MIN=$(shell python -c 'print("$(VERSION)".split(".")[1])')
|
||||
VERSION_PAT=$(shell python -c 'print("$(VERSION)".split(".")[2])')
|
||||
|
||||
VERSION_FLAGS= -DSOLO_VERSION_MAJ=$(VERSION_MAJ) -DSOLO_VERSION_MIN=$(VERSION_MIN) \
|
||||
-DSOLO_VERSION_PATCH=$(VERSION_PAT) -DVERSION=\"$(VERSION_FULL)\"
|
||||
|
||||
_all:
|
||||
echo $(VERSION_FULL)
|
||||
echo $(VERSION_MAJ)
|
||||
echo $(VERSION_MIN)
|
||||
echo $(VERSION_PAT)
|
@@ -53,19 +53,10 @@
|
||||
#define USBD_VID 0x0483
|
||||
#define USBD_PID 0xA2CA
|
||||
#define USBD_LANGID_STRING 0x409
|
||||
#ifndef SOLO_HACKER
|
||||
#define USBD_MANUFACTURER_STRING "Solo Keys"
|
||||
#define USBD_PRODUCT_FS_STRING "Solo"
|
||||
#ifndef USBD_SERIAL_NUM
|
||||
#define USBD_MANUFACTURER_STRING "SoloKeys"
|
||||
#define USBD_PRODUCT_FS_STRING SOLO_PRODUCT_NAME
|
||||
#define USBD_SERIAL_NUM "0123456789ABCDEF"
|
||||
#endif
|
||||
#else
|
||||
#define USBD_MANUFACTURER_STRING "Solo Keys"
|
||||
#define USBD_PRODUCT_FS_STRING "Solo HACKER (Unlocked)"
|
||||
#ifndef USBD_SERIAL_NUM
|
||||
#define USBD_SERIAL_NUM "0123456789ABCDEF"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t *USBD_HID_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t *USBD_HID_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef _APP_H_
|
||||
#define _APP_H_
|
||||
#include <stdint.h>
|
||||
#include "version.h"
|
||||
|
||||
#define DEBUG_UART USART1
|
||||
|
||||
@@ -21,7 +22,7 @@
|
||||
|
||||
//#define USING_DEV_BOARD
|
||||
|
||||
//#define ENABLE_U2F_EXTENSIONS
|
||||
#define ENABLE_U2F_EXTENSIONS
|
||||
|
||||
#define ENABLE_U2F
|
||||
|
||||
@@ -29,6 +30,13 @@
|
||||
// #define DISABLE_CTAPHID_WINK
|
||||
// #define DISABLE_CTAPHID_CBOR
|
||||
|
||||
|
||||
#if defined(SOLO_HACKER)
|
||||
#define SOLO_PRODUCT_NAME "Solo Hacker " VERSION
|
||||
#else
|
||||
#define SOLO_PRODUCT_NAME "Solo " VERSION
|
||||
#endif
|
||||
|
||||
void printing_init();
|
||||
void hw_init(void);
|
||||
|
||||
|
21
targets/stm32l432/src/version.h
Normal file
21
targets/stm32l432/src/version.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _VERSION_H_
|
||||
#define _VERSION_H_
|
||||
|
||||
|
||||
#ifndef SOLO_VERSION_MAJ
|
||||
|
||||
#define SOLO_VERSION_MAJ 0
|
||||
#define SOLO_VERSION_MIN 0
|
||||
#define SOLO_VERSION_PATCH 0
|
||||
|
||||
#endif
|
||||
|
||||
#define __STR_HELPER(x) #x
|
||||
#define __STR(x) __STR_HELPER(x)
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION __STR(SOLO_VERSION_MAJ) "." __STR(SOLO_VERSION_MIN) "." __STR(SOLO_VERSION_PATCH)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user