port to token hardware
This commit is contained in:
12
Makefile
12
Makefile
@@ -9,6 +9,9 @@
|
||||
|
||||
platform=2
|
||||
|
||||
EFM32_DEBUGGER= -s 440083537 --device EFM32JG1B200F128GM32
|
||||
#EFM32_DEBUGGER= -s 440121060 #dev board
|
||||
|
||||
src = $(wildcard pc/*.c) $(wildcard fido2/*.c) $(wildcard crypto/sha256/*.c) crypto/tiny-AES-c/aes.c
|
||||
obj = $(src:.c=.o) uECC.o
|
||||
|
||||
@@ -37,11 +40,16 @@ efm32com:
|
||||
cd '.\efm32\GNU ARM v7.2.1 - Debug' && $(MAKE) all
|
||||
efm32prog:
|
||||
cd '.\efm32\GNU ARM v7.2.1 - Debug' && $(MAKE) all
|
||||
commander flash '.\efm32\GNU ARM v7.2.1 - Debug\EFM32.hex' -s 440121060
|
||||
commander flash '.\efm32\GNU ARM v7.2.1 - Debug\EFM32.hex' $(EFM32_DEBUGGER) -p "0x1E7FC:0x00000000:4"
|
||||
efm32read:
|
||||
cd '.\efm32\GNU ARM v7.2.1 - Debug' && $(MAKE) all
|
||||
commander swo read $(EFM32_DEBUGGER)
|
||||
|
||||
|
||||
|
||||
efm32bootprog:
|
||||
cd '.\efm32boot\GNU ARM v7.2.1 - Debug' && $(MAKE) all
|
||||
commander flash '.\efm32boot\GNU ARM v7.2.1 - Debug\efm32boot.hex' -s 440121060
|
||||
commander flash '.\efm32boot\GNU ARM v7.2.1 - Debug\efm32boot.hex' $(EFM32_DEBUGGER) --masserase
|
||||
|
||||
$(name): $(obj)
|
||||
$(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS)
|
||||
|
File diff suppressed because one or more lines are too long
@@ -35,5 +35,15 @@
|
||||
<type>2</type>
|
||||
<location>C:/Users/conor/Desktop/u2f-one/fido2/</location>
|
||||
</link>
|
||||
<link>
|
||||
<name>CMSIS/EFM32JG1B/startup_gcc_efm32jg1b.s</name>
|
||||
<type>1</type>
|
||||
<locationURI>STUDIO_SDK_LOC/platform/Device/SiliconLabs/EFM32JG1B/Source/GCC/startup_efm32jg1b.S</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>CMSIS/EFM32JG1B/system_efm32jg1b.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>STUDIO_SDK_LOC/platform/Device/SiliconLabs/EFM32JG1B/Source/system_efm32jg1b.c</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
107
efm32/EFM32_EFM32JG1B200F128GM32.hwconf
Normal file
107
efm32/EFM32_EFM32JG1B200F128GM32.hwconf
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="ASCII"?>
|
||||
<device:XMLDevice xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:device="http://www.silabs.com/ss/hwconfig/document/device.ecore" name="EFM32JG1B200F128GM32" partId="mcu.arm.efm32.jg1.efm32jg1b200f128gm32" contextId="%DEFAULT%">
|
||||
<mode name="DefaultMode">
|
||||
<property object="ADC0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="CMU" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="CMU" propertyId="clocksettings.hfrcosettings.hfrcofrequency" value="38 MHz"/>
|
||||
<property object="CMU" propertyId="clocksettings.lfclocksettings.ulfrcorequired" value="Yes"/>
|
||||
<property object="CRYOTIMER" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="CRYOTIMER" propertyId="cryotimer.clocking.clocksourceforcryotimer" value="ULFRCO"/>
|
||||
<property object="CRYOTIMER" propertyId="cryotimer.clocking.eventafterevery" value="1 cycle"/>
|
||||
<property object="CRYPTO" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="DefaultMode" propertyId="mode.diagramLocation" value="100, 100"/>
|
||||
<property object="EMU" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="EMU" propertyId="emu.powerconfiguration.externalpowercircuitwiring" value="Not wired for DCDC"/>
|
||||
<property object="GPIO" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="PA0" propertyId="ports.settings.pinmode" value="Input"/>
|
||||
<property object="PA1" propertyId="ports.settings.pinmode" value="Input"/>
|
||||
<property object="PB11" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PB11" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PB11" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PB11" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PB11" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PB12" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PB12" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PB12" propertyId="ports.settings.pinmode" value="Input pull"/>
|
||||
<property object="PB12" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PB12" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PB13" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PB13" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PB13" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PB13" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PB13" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PB15" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PB15" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PB15" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PB15" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PB15" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD10" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD10" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD10" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PD10" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD10" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD11" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD11" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD11" propertyId="ports.settings.pinmode" value="Input pull"/>
|
||||
<property object="PD11" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD11" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD12" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD12" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD12" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PD12" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD12" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD13" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD13" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD13" propertyId="ports.settings.pinmode" value="Input pull"/>
|
||||
<property object="PD13" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD13" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD14" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD14" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD14" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PD14" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD14" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD15" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD15" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD15" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PD15" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD15" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PD9" propertyId="ports.settings.dout" value="1"/>
|
||||
<property object="PD9" propertyId="ports.settings.filter" value="Enabled"/>
|
||||
<property object="PD9" propertyId="ports.settings.pinmode" value="Push-pull"/>
|
||||
<property object="PD9" propertyId="ports.settings.pulldirection" value="Pullup"/>
|
||||
<property object="PD9" propertyId="ports.settings.pullup" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.timer0.enable.cc0" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.timer0.enable.cc1" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.timer0.enable.cc2" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.timer0.location.timer0_cc0loc" value="18"/>
|
||||
<property object="PORTIO" propertyId="portio.timer0.location.timer0_cc1loc" value="16"/>
|
||||
<property object="PORTIO" propertyId="portio.timer0.location.timer0_cc2loc" value="20"/>
|
||||
<property object="PORTIO" propertyId="portio.usart0.enable.rx" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.usart0.enable.tx" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.usart0.location.usart0_txloc" value="20"/>
|
||||
<property object="PORTIO" propertyId="portio.usart1.enable.clk" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.usart1.enable.rx" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.usart1.enable.tx" value="Enabled"/>
|
||||
<property object="PORTIO" propertyId="portio.usart1.location.usart1_rxloc" value="6"/>
|
||||
<property object="PORTIO" propertyId="portio.usart1.location.usart1_txloc" value="8"/>
|
||||
<property object="TIMER0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="TIMER0" propertyId="timer.capturecomparech0.ccmode" value="PWM"/>
|
||||
<property object="TIMER0" propertyId="timer.capturecomparech0.countermatchoutputaction" value="Toggle on event"/>
|
||||
<property object="TIMER0" propertyId="timer.capturecomparech1.ccmode" value="PWM"/>
|
||||
<property object="TIMER0" propertyId="timer.capturecomparech1.countermatchoutputaction" value="Toggle on event"/>
|
||||
<property object="TIMER0" propertyId="timer.capturecomparech2.ccmode" value="PWM"/>
|
||||
<property object="TIMER0" propertyId="timer.capturecomparech2.countermatchoutputaction" value="Toggle on event"/>
|
||||
<property object="TIMER0" propertyId="timer.clocksettings.hfperprescaler" value="Divide by 512"/>
|
||||
<property object="USART0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="USART0" propertyId="usart.outputsettings.clockselect" value="Disabled"/>
|
||||
<property object="USART1" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="USART1" propertyId="usart.asynchronoussettings.baudrate" value="130000"/>
|
||||
<property object="USART1" propertyId="usart.mode.usartmode" value="Synchronous Mode (SPI / I2S)"/>
|
||||
<property object="USART1" propertyId="usart.outputsettings.clockselect" value="Disabled"/>
|
||||
<property object="USART1" propertyId="usart.synchronoussettings.baudrate" value="130000"/>
|
||||
</mode>
|
||||
<modeTransition>
|
||||
<property object="RESET → DefaultMode" propertyId="modeTransition.source" value="RESET"/>
|
||||
<property object="RESET → DefaultMode" propertyId="modeTransition.target" value="DefaultMode"/>
|
||||
</modeTransition>
|
||||
</device:XMLDevice>
|
@@ -10,9 +10,9 @@
|
||||
|
||||
#define DEBUG_LEVEL 1
|
||||
|
||||
#define PRINTING_USE_VCOM
|
||||
//#define PRINTING_USE_VCOM
|
||||
|
||||
#define USING_DEV_BOARD
|
||||
//#define USING_DEV_BOARD
|
||||
|
||||
//#define BRIDGE_TO_WALLET
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
void printing_init();
|
||||
|
||||
#define TEST
|
||||
#define TEST_POWER
|
||||
//#define TEST
|
||||
//#define TEST_POWER
|
||||
|
||||
// GPIO assignments
|
||||
#define NFC_DEV_SS gpioPortF,2
|
||||
|
||||
#define LED_INIT_VALUE 0x001000
|
||||
|
||||
#endif /* SRC_APP_H_ */
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "em_cryotimer.h"
|
||||
#include "em_crypto.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_timer.h"
|
||||
#include "em_usart.h"
|
||||
// [Library includes]$
|
||||
|
||||
@@ -38,6 +39,7 @@ extern void enter_DefaultMode_from_RESET(void) {
|
||||
ADC0_enter_DefaultMode_from_RESET();
|
||||
USART0_enter_DefaultMode_from_RESET();
|
||||
USART1_enter_DefaultMode_from_RESET();
|
||||
TIMER0_enter_DefaultMode_from_RESET();
|
||||
CRYOTIMER_enter_DefaultMode_from_RESET();
|
||||
PORTIO_enter_DefaultMode_from_RESET();
|
||||
// [Config Calls]$
|
||||
@@ -50,19 +52,8 @@ extern void enter_DefaultMode_from_RESET(void) {
|
||||
extern void EMU_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
// $[EMU Initialization]
|
||||
/* Initialize DCDC regulator */
|
||||
EMU_DCDCInit_TypeDef dcdcInit = EMU_DCDCINIT_DEFAULT;
|
||||
|
||||
dcdcInit.powerConfig = emuPowerConfig_DcdcToDvdd;
|
||||
dcdcInit.dcdcMode = emuDcdcMode_LowNoise;
|
||||
dcdcInit.mVout = 1800;
|
||||
dcdcInit.em01LoadCurrent_mA = 15;
|
||||
dcdcInit.em234LoadCurrent_uA = 10;
|
||||
dcdcInit.maxCurrent_mA = 200;
|
||||
dcdcInit.anaPeripheralPower = emuDcdcAnaPeripheralPower_DCDC;
|
||||
dcdcInit.reverseCurrentControl = 160;
|
||||
|
||||
EMU_DCDCInit(&dcdcInit);
|
||||
/* External power circuit not wired for DCDC; shut down regulator */
|
||||
EMU_DCDCPowerOff();
|
||||
/* Initialize EM2/EM3 mode */
|
||||
EMU_EM23Init_TypeDef em23Init = EMU_EM23INIT_DEFAULT;
|
||||
|
||||
@@ -102,7 +93,7 @@ extern void CMU_enter_DefaultMode_from_RESET(void) {
|
||||
CMU_HFXOInit(&hfxoInit);
|
||||
|
||||
/* Setting system HFRCO frequency */
|
||||
CMU_HFRCOFreqSet (cmuHFRCOFreq_4M0Hz);
|
||||
CMU_HFRCOFreqSet (cmuHFRCOFreq_38M0Hz);
|
||||
|
||||
/* Using HFRCO as high frequency clock, HFCLK */
|
||||
CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFRCO);
|
||||
@@ -133,6 +124,9 @@ extern void CMU_enter_DefaultMode_from_RESET(void) {
|
||||
/* Enable clock for CRYOTIMER */
|
||||
CMU_ClockEnable(cmuClock_CRYOTIMER, true);
|
||||
|
||||
/* Enable clock for TIMER0 */
|
||||
CMU_ClockEnable(cmuClock_TIMER0, true);
|
||||
|
||||
/* Enable clock for USART0 */
|
||||
CMU_ClockEnable(cmuClock_USART0, true);
|
||||
|
||||
@@ -279,23 +273,23 @@ extern void USART0_enter_DefaultMode_from_RESET(void) {
|
||||
// $[USART_InitIO]
|
||||
/* Disable CLK pin */
|
||||
USART0->ROUTELOC0 = (USART0->ROUTELOC0 & (~_USART_ROUTELOC0_CLKLOC_MASK))
|
||||
| USART_ROUTELOC0_CLKLOC_LOC0;
|
||||
| USART_ROUTELOC0_CLKLOC_LOC4;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN & (~USART_ROUTEPEN_CLKPEN);
|
||||
|
||||
/* Disable CS pin */
|
||||
USART0->ROUTELOC0 = (USART0->ROUTELOC0 & (~_USART_ROUTELOC0_CSLOC_MASK))
|
||||
| USART_ROUTELOC0_CSLOC_LOC0;
|
||||
| USART_ROUTELOC0_CSLOC_LOC3;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN & (~USART_ROUTEPEN_CSPEN);
|
||||
|
||||
/* Set up CTS pin */
|
||||
/* Disable CTS pin */
|
||||
USART0->ROUTELOC1 = (USART0->ROUTELOC1 & (~_USART_ROUTELOC1_CTSLOC_MASK))
|
||||
| USART_ROUTELOC1_CTSLOC_LOC30;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN | USART_ROUTEPEN_CTSPEN;
|
||||
| USART_ROUTELOC1_CTSLOC_LOC2;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN & (~USART_ROUTEPEN_CTSPEN);
|
||||
|
||||
/* Set up RTS pin */
|
||||
/* Disable RTS pin */
|
||||
USART0->ROUTELOC1 = (USART0->ROUTELOC1 & (~_USART_ROUTELOC1_RTSLOC_MASK))
|
||||
| USART_ROUTELOC1_RTSLOC_LOC30;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN | USART_ROUTEPEN_RTSPEN;
|
||||
| USART_ROUTELOC1_RTSLOC_LOC1;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN & (~USART_ROUTEPEN_RTSPEN);
|
||||
|
||||
/* Set up RX pin */
|
||||
USART0->ROUTELOC0 = (USART0->ROUTELOC0 & (~_USART_ROUTELOC0_RXLOC_MASK))
|
||||
@@ -304,7 +298,7 @@ extern void USART0_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
/* Set up TX pin */
|
||||
USART0->ROUTELOC0 = (USART0->ROUTELOC0 & (~_USART_ROUTELOC0_TXLOC_MASK))
|
||||
| USART_ROUTELOC0_TXLOC_LOC0;
|
||||
| USART_ROUTELOC0_TXLOC_LOC20;
|
||||
USART0->ROUTEPEN = USART0->ROUTEPEN | USART_ROUTEPEN_TXPEN;
|
||||
|
||||
// [USART_InitIO]$
|
||||
@@ -348,7 +342,7 @@ extern void USART1_enter_DefaultMode_from_RESET(void) {
|
||||
initsync.databits = usartDatabits8;
|
||||
initsync.master = 1;
|
||||
initsync.msbf = 1;
|
||||
initsync.clockMode = usartClockMode1;
|
||||
initsync.clockMode = usartClockMode0;
|
||||
#if defined( USART_INPUT_RXPRS ) && defined( USART_TRIGCTRL_AUTOTXTEN )
|
||||
initsync.prsRxEnable = 0;
|
||||
initsync.prsRxCh = 0;
|
||||
@@ -371,32 +365,32 @@ extern void USART1_enter_DefaultMode_from_RESET(void) {
|
||||
// $[USART_InitIO]
|
||||
/* Set up CLK pin */
|
||||
USART1->ROUTELOC0 = (USART1->ROUTELOC0 & (~_USART_ROUTELOC0_CLKLOC_MASK))
|
||||
| USART_ROUTELOC0_CLKLOC_LOC11;
|
||||
| USART_ROUTELOC0_CLKLOC_LOC4;
|
||||
USART1->ROUTEPEN = USART1->ROUTEPEN | USART_ROUTEPEN_CLKPEN;
|
||||
|
||||
/* Disable CS pin */
|
||||
USART1->ROUTELOC0 = (USART1->ROUTELOC0 & (~_USART_ROUTELOC0_CSLOC_MASK))
|
||||
| USART_ROUTELOC0_CSLOC_LOC0;
|
||||
| USART_ROUTELOC0_CSLOC_LOC3;
|
||||
USART1->ROUTEPEN = USART1->ROUTEPEN & (~USART_ROUTEPEN_CSPEN);
|
||||
|
||||
/* Disable CTS pin */
|
||||
USART1->ROUTELOC1 = (USART1->ROUTELOC1 & (~_USART_ROUTELOC1_CTSLOC_MASK))
|
||||
| USART_ROUTELOC1_CTSLOC_LOC0;
|
||||
| USART_ROUTELOC1_CTSLOC_LOC2;
|
||||
USART1->ROUTEPEN = USART1->ROUTEPEN & (~USART_ROUTEPEN_CTSPEN);
|
||||
|
||||
/* Disable RTS pin */
|
||||
USART1->ROUTELOC1 = (USART1->ROUTELOC1 & (~_USART_ROUTELOC1_RTSLOC_MASK))
|
||||
| USART_ROUTELOC1_RTSLOC_LOC0;
|
||||
| USART_ROUTELOC1_RTSLOC_LOC1;
|
||||
USART1->ROUTEPEN = USART1->ROUTEPEN & (~USART_ROUTEPEN_RTSPEN);
|
||||
|
||||
/* Set up RX pin */
|
||||
USART1->ROUTELOC0 = (USART1->ROUTELOC0 & (~_USART_ROUTELOC0_RXLOC_MASK))
|
||||
| USART_ROUTELOC0_RXLOC_LOC11;
|
||||
| USART_ROUTELOC0_RXLOC_LOC6;
|
||||
USART1->ROUTEPEN = USART1->ROUTEPEN | USART_ROUTEPEN_RXPEN;
|
||||
|
||||
/* Set up TX pin */
|
||||
USART1->ROUTELOC0 = (USART1->ROUTELOC0 & (~_USART_ROUTELOC0_TXLOC_MASK))
|
||||
| USART_ROUTELOC0_TXLOC_LOC11;
|
||||
| USART_ROUTELOC0_TXLOC_LOC8;
|
||||
USART1->ROUTEPEN = USART1->ROUTEPEN | USART_ROUTEPEN_TXPEN;
|
||||
|
||||
// [USART_InitIO]$
|
||||
@@ -477,21 +471,124 @@ extern void LDMA_enter_DefaultMode_from_RESET(void) {
|
||||
extern void TIMER0_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
// $[TIMER0 I/O setup]
|
||||
/* Set up CC0 */
|
||||
TIMER0->ROUTELOC0 = (TIMER0->ROUTELOC0 & (~_TIMER_ROUTELOC0_CC0LOC_MASK))
|
||||
| TIMER_ROUTELOC0_CC0LOC_LOC18;
|
||||
TIMER0->ROUTEPEN = TIMER0->ROUTEPEN | TIMER_ROUTEPEN_CC0PEN;
|
||||
/* Set up CC1 */
|
||||
TIMER0->ROUTELOC0 = (TIMER0->ROUTELOC0 & (~_TIMER_ROUTELOC0_CC1LOC_MASK))
|
||||
| TIMER_ROUTELOC0_CC1LOC_LOC16;
|
||||
TIMER0->ROUTEPEN = TIMER0->ROUTEPEN | TIMER_ROUTEPEN_CC1PEN;
|
||||
/* Set up CC2 */
|
||||
TIMER0->ROUTELOC0 = (TIMER0->ROUTELOC0 & (~_TIMER_ROUTELOC0_CC2LOC_MASK))
|
||||
| TIMER_ROUTELOC0_CC2LOC_LOC20;
|
||||
TIMER0->ROUTEPEN = TIMER0->ROUTEPEN | TIMER_ROUTEPEN_CC2PEN;
|
||||
/* Set up CDTI0 */
|
||||
TIMER0->ROUTELOC2 = (TIMER0->ROUTELOC2 & (~_TIMER_ROUTELOC2_CDTI0LOC_MASK))
|
||||
| TIMER_ROUTELOC2_CDTI0LOC_LOC3;
|
||||
TIMER0->ROUTEPEN = TIMER0->ROUTEPEN & (~TIMER_ROUTEPEN_CDTI0PEN);
|
||||
/* Set up CDTI1 */
|
||||
TIMER0->ROUTELOC2 = (TIMER0->ROUTELOC2 & (~_TIMER_ROUTELOC2_CDTI1LOC_MASK))
|
||||
| TIMER_ROUTELOC2_CDTI1LOC_LOC2;
|
||||
TIMER0->ROUTEPEN = TIMER0->ROUTEPEN & (~TIMER_ROUTEPEN_CDTI1PEN);
|
||||
/* Set up CDTI2 */
|
||||
TIMER0->ROUTELOC2 = (TIMER0->ROUTELOC2 & (~_TIMER_ROUTELOC2_CDTI2LOC_MASK))
|
||||
| TIMER_ROUTELOC2_CDTI2LOC_LOC1;
|
||||
TIMER0->ROUTEPEN = TIMER0->ROUTEPEN & (~TIMER_ROUTEPEN_CDTI2PEN);
|
||||
// [TIMER0 I/O setup]$
|
||||
|
||||
// $[TIMER0 initialization]
|
||||
TIMER_Init_TypeDef init = TIMER_INIT_DEFAULT;
|
||||
|
||||
init.enable = 1;
|
||||
init.debugRun = 0;
|
||||
init.dmaClrAct = 0;
|
||||
init.sync = 0;
|
||||
init.clkSel = timerClkSelHFPerClk;
|
||||
init.prescale = timerPrescale512;
|
||||
init.fallAction = timerInputActionNone;
|
||||
init.riseAction = timerInputActionNone;
|
||||
init.mode = timerModeUp;
|
||||
init.quadModeX4 = 0;
|
||||
init.oneShot = 0;
|
||||
init.count2x = 0;
|
||||
init.ati = 0;
|
||||
TIMER_Init(TIMER0, &init);
|
||||
// [TIMER0 initialization]$
|
||||
|
||||
// $[TIMER0 CC0 init]
|
||||
TIMER_InitCC_TypeDef initCC0 = TIMER_INITCC_DEFAULT;
|
||||
|
||||
initCC0.prsInput = false;
|
||||
initCC0.prsSel = timerPRSSELCh0;
|
||||
initCC0.edge = timerEdgeRising;
|
||||
initCC0.mode = timerCCModePWM;
|
||||
initCC0.eventCtrl = timerEventEveryEdge;
|
||||
initCC0.filter = 0;
|
||||
initCC0.cofoa = timerOutputActionNone;
|
||||
initCC0.cufoa = timerOutputActionNone;
|
||||
initCC0.cmoa = timerOutputActionToggle;
|
||||
initCC0.coist = 0;
|
||||
initCC0.outInvert = 0;
|
||||
TIMER_InitCC(TIMER0, 0, &initCC0);
|
||||
// [TIMER0 CC0 init]$
|
||||
|
||||
// $[TIMER0 CC1 init]
|
||||
TIMER_InitCC_TypeDef initCC1 = TIMER_INITCC_DEFAULT;
|
||||
|
||||
initCC1.prsInput = false;
|
||||
initCC1.prsSel = timerPRSSELCh0;
|
||||
initCC1.edge = timerEdgeRising;
|
||||
initCC1.mode = timerCCModePWM;
|
||||
initCC1.eventCtrl = timerEventEveryEdge;
|
||||
initCC1.filter = 0;
|
||||
initCC1.cofoa = timerOutputActionNone;
|
||||
initCC1.cufoa = timerOutputActionNone;
|
||||
initCC1.cmoa = timerOutputActionToggle;
|
||||
initCC1.coist = 0;
|
||||
initCC1.outInvert = 0;
|
||||
TIMER_InitCC(TIMER0, 1, &initCC1);
|
||||
// [TIMER0 CC1 init]$
|
||||
|
||||
// $[TIMER0 CC2 init]
|
||||
TIMER_InitCC_TypeDef initCC2 = TIMER_INITCC_DEFAULT;
|
||||
|
||||
initCC2.prsInput = false;
|
||||
initCC2.prsSel = timerPRSSELCh0;
|
||||
initCC2.edge = timerEdgeRising;
|
||||
initCC2.mode = timerCCModePWM;
|
||||
initCC2.eventCtrl = timerEventEveryEdge;
|
||||
initCC2.filter = 0;
|
||||
initCC2.cofoa = timerOutputActionNone;
|
||||
initCC2.cufoa = timerOutputActionNone;
|
||||
initCC2.cmoa = timerOutputActionToggle;
|
||||
initCC2.coist = 0;
|
||||
initCC2.outInvert = 0;
|
||||
TIMER_InitCC(TIMER0, 2, &initCC2);
|
||||
// [TIMER0 CC2 init]$
|
||||
|
||||
// $[TIMER0 DTI init]
|
||||
TIMER_InitDTI_TypeDef initDTI = TIMER_INITDTI_DEFAULT;
|
||||
|
||||
initDTI.enable = 0;
|
||||
initDTI.activeLowOut = 0;
|
||||
initDTI.invertComplementaryOut = 0;
|
||||
initDTI.autoRestart = 0;
|
||||
initDTI.enablePrsSource = 0;
|
||||
initDTI.prsSel = timerPRSSELCh0;
|
||||
initDTI.prescale = timerPrescale1;
|
||||
initDTI.riseTime = 1;
|
||||
initDTI.fallTime = 1;
|
||||
initDTI.enableFaultSourceCoreLockup = 1;
|
||||
initDTI.enableFaultSourceDebugger = 1;
|
||||
initDTI.faultSourcePrsSel0 = 0;
|
||||
initDTI.faultSourcePrsSel0 = timerPRSSELCh0;
|
||||
initDTI.faultSourcePrsSel1 = 0;
|
||||
initDTI.faultSourcePrsSel1 = timerPRSSELCh0;
|
||||
initDTI.faultAction = timerDtiFaultActionInactive;
|
||||
initDTI.outputsEnableMask = 0 | TIMER_DTOGEN_DTOGCC0EN
|
||||
| TIMER_DTOGEN_DTOGCC1EN | TIMER_DTOGEN_DTOGCC2EN;
|
||||
TIMER_InitDTI(TIMER0, &initDTI);
|
||||
// [TIMER0 DTI init]$
|
||||
|
||||
}
|
||||
@@ -596,51 +693,51 @@ extern void PORTIO_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
// $[Port A Configuration]
|
||||
|
||||
/* Pin PA0 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortA, 0, gpioModePushPull, 0);
|
||||
/* Pin PA0 is configured to Input enabled */
|
||||
GPIO_PinModeSet(gpioPortA, 0, gpioModeInput, 0);
|
||||
|
||||
/* Pin PA1 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortA, 1, gpioModeInputPull, 1);
|
||||
|
||||
/* Pin PA3 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortA, 3, gpioModePushPull, 0);
|
||||
|
||||
/* Pin PA4 is configured to Open-drain with pull-up and filter */
|
||||
GPIO_PinModeSet(gpioPortA, 4, gpioModeWiredAndPullUpFilter, 1);
|
||||
|
||||
/* Pin PA5 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortA, 5, gpioModePushPull, 1);
|
||||
/* Pin PA1 is configured to Input enabled */
|
||||
GPIO_PinModeSet(gpioPortA, 1, gpioModeInput, 0);
|
||||
// [Port A Configuration]$
|
||||
|
||||
// $[Port B Configuration]
|
||||
|
||||
/* Pin PB11 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortB, 11, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PB12 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortB, 12, gpioModeInputPull, 1);
|
||||
|
||||
/* Pin PB13 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortB, 13, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PB15 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortB, 15, gpioModePushPull, 1);
|
||||
// [Port B Configuration]$
|
||||
|
||||
// $[Port C Configuration]
|
||||
|
||||
/* Pin PC6 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortC, 6, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PC7 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortC, 7, gpioModeInputPull, 1);
|
||||
|
||||
/* Pin PC8 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortC, 8, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PC9 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortC, 9, gpioModeInputPull, 1);
|
||||
|
||||
/* Pin PC10 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortC, 10, gpioModePushPull, 1);
|
||||
// [Port C Configuration]$
|
||||
|
||||
// $[Port D Configuration]
|
||||
|
||||
/* Pin PD9 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortD, 9, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PD10 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortD, 10, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PD11 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortD, 11, gpioModeInputPull, 1);
|
||||
|
||||
/* Pin PD12 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortD, 12, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PD13 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortD, 13, gpioModeInputPull, 1);
|
||||
|
||||
/* Pin PD14 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortD, 14, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PD15 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortD, 15, gpioModePushPull, 1);
|
||||
// [Port D Configuration]$
|
||||
@@ -649,21 +746,6 @@ extern void PORTIO_enter_DefaultMode_from_RESET(void) {
|
||||
// [Port E Configuration]$
|
||||
|
||||
// $[Port F Configuration]
|
||||
|
||||
/* Pin PF2 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortF, 2, gpioModePushPull, 1);
|
||||
|
||||
/* Pin PF3 is configured to Open-drain with pull-up and filter */
|
||||
GPIO_PinModeSet(gpioPortF, 3, gpioModeWiredAndPullUpFilter, 1);
|
||||
|
||||
/* Pin PF4 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortF, 4, gpioModePushPull, 0);
|
||||
|
||||
/* Pin PF5 is configured to Push-pull */
|
||||
GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, 0);
|
||||
|
||||
/* Pin PF6 is configured to Input enabled with pull-up */
|
||||
GPIO_PinModeSet(gpioPortF, 6, gpioModeInputPull, 1);
|
||||
// [Port F Configuration]$
|
||||
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "em_cmu.h"
|
||||
#include "em_msc.h"
|
||||
#include "em_i2c.h"
|
||||
#include "em_timer.h"
|
||||
|
||||
#include "InitDevice.h"
|
||||
#include "cbor.h"
|
||||
@@ -26,6 +27,8 @@
|
||||
#include "crypto.h"
|
||||
#include "nfc.h"
|
||||
|
||||
#ifdef USING_DEV_BOARD
|
||||
|
||||
#define MSG_AVAIL_PIN gpioPortC,9
|
||||
#define RDY_PIN gpioPortC,10
|
||||
#define RW_PIN gpioPortD,11
|
||||
@@ -33,19 +36,34 @@
|
||||
#define LED1_PIN gpioPortF,4
|
||||
#define LED2_PIN gpioPortF,5
|
||||
|
||||
#else
|
||||
|
||||
#define MSG_AVAIL_PIN gpioPortA,1
|
||||
#define RDY_PIN gpioPortA,0
|
||||
#define RW_PIN gpioPortD,15
|
||||
#define RESET_PIN gpioPortB,15
|
||||
#define LED1_PIN gpioPortD,9
|
||||
#define LED2_PIN gpioPortD,10
|
||||
#define LED3_PIN gpioPortD,14
|
||||
#define BUTTON_PIN gpioPortD,13
|
||||
|
||||
#endif
|
||||
|
||||
#define PAGE_SIZE 2048
|
||||
#define PAGES 128
|
||||
#define COUNTER_PAGE 125
|
||||
#define STATE1_PAGE 126
|
||||
#define STATE2_PAGE 127
|
||||
#define PAGES 64
|
||||
#define COUNTER_PAGE (PAGES - 3)
|
||||
#define STATE1_PAGE (PAGES - 2)
|
||||
#define STATE2_PAGE (PAGES - 1)
|
||||
|
||||
#define APPLICATION_START_ADDR 0x8000
|
||||
#define APPLICATION_START_PAGE (0x8000/PAGE_SIZE)
|
||||
#define APPLICATION_START_ADDR 0x4000
|
||||
#define APPLICATION_START_PAGE (0x4000/PAGE_SIZE)
|
||||
|
||||
#define APPLICATION_END_ADDR (PAGE_SIZE*(PAGES - 3)-4) // NOT included in application
|
||||
#define APPLICATION_END_PAGE ((PAGES - 3)) // 125 is NOT included in application
|
||||
|
||||
#define AUTH_WORD_ADDR (PAGE_SIZE*(PAGES - 3)-4)
|
||||
|
||||
#define APPLICATION_END_ADDR (PAGE_SIZE*125-4) // NOT included in application
|
||||
#define APPLICATION_END_PAGE (125) // 125 is NOT included in application
|
||||
|
||||
#define AUTH_WORD_ADDR (PAGE_SIZE*125-4)
|
||||
|
||||
static void init_atomic_counter()
|
||||
{
|
||||
@@ -105,6 +123,27 @@ uint32_t ctap_atomic_count(int sel)
|
||||
return count;
|
||||
}
|
||||
|
||||
static uint32_t _color;
|
||||
uint32_t get_RBG()
|
||||
{
|
||||
return _color;
|
||||
}
|
||||
|
||||
void RGB(uint32_t hex)
|
||||
{
|
||||
uint16_t r = 256 - ((hex & 0xff0000) >> 16);
|
||||
uint16_t g = 256 - ((hex & 0xff00) >> 8);
|
||||
uint16_t b = 256 - ((hex & 0xff) >> 0);
|
||||
|
||||
TIMER_CompareBufSet(TIMER0, 0, g); // green
|
||||
TIMER_CompareBufSet(TIMER0, 1, r); // red
|
||||
TIMER_CompareBufSet(TIMER0, 2, b); // blue
|
||||
_color = hex;
|
||||
}
|
||||
|
||||
|
||||
#define IS_BUTTON_PRESSED() (GPIO_PinInGet(BUTTON_PIN) == 0)
|
||||
|
||||
// Verify the user
|
||||
// return 1 if user is verified, 0 if not
|
||||
int ctap_user_verification(uint8_t arg)
|
||||
@@ -116,6 +155,30 @@ int ctap_user_verification(uint8_t arg)
|
||||
// Return 1 for user is present, 0 user not present
|
||||
int ctap_user_presence_test()
|
||||
{
|
||||
uint32_t t1 = millis();
|
||||
RGB(0x304010);
|
||||
while (IS_BUTTON_PRESSED())
|
||||
{
|
||||
if (t1 + 5000 < millis())
|
||||
return 0;
|
||||
}
|
||||
|
||||
t1 = millis();
|
||||
|
||||
do
|
||||
{
|
||||
if (t1 + 5000 < millis())
|
||||
return 0;
|
||||
if (! IS_BUTTON_PRESSED())
|
||||
continue;
|
||||
delay(1);
|
||||
}
|
||||
while (! IS_BUTTON_PRESSED());
|
||||
|
||||
RGB(0x001040);
|
||||
|
||||
delay(50);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -129,14 +192,60 @@ void ctaphid_write_block(uint8_t * data)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef IS_BOOTLOADER // two different colors between bootloader and app
|
||||
void heartbeat()
|
||||
{
|
||||
GPIO_PinOutToggle(LED1_PIN);
|
||||
GPIO_PinOutToggle(LED2_PIN);
|
||||
nfc_test();
|
||||
// printf("heartbeat %d %d\r\n", beat++,CRYOTIMER->CNT);
|
||||
}
|
||||
static int state = 0;
|
||||
static uint32_t val = (LED_INIT_VALUE >> 8) & 0xff;
|
||||
int but = IS_BUTTON_PRESSED();
|
||||
|
||||
|
||||
if (state)
|
||||
{
|
||||
val--;
|
||||
}
|
||||
else
|
||||
{
|
||||
val++;
|
||||
}
|
||||
|
||||
if (val > 30 || val < 1)
|
||||
{
|
||||
state = !state;
|
||||
}
|
||||
|
||||
// if (but) RGB(val * 2);
|
||||
// else
|
||||
RGB((val << 16) | (val*2 << 8));
|
||||
|
||||
}
|
||||
#else
|
||||
void heartbeat()
|
||||
{
|
||||
static int state = 0;
|
||||
static uint32_t val = (LED_INIT_VALUE >> 8) & 0xff;
|
||||
int but = IS_BUTTON_PRESSED();
|
||||
|
||||
|
||||
if (state)
|
||||
{
|
||||
val--;
|
||||
}
|
||||
else
|
||||
{
|
||||
val++;
|
||||
}
|
||||
|
||||
if (val > 30 || val < 1)
|
||||
{
|
||||
state = !state;
|
||||
}
|
||||
|
||||
if (but) RGB(val * 2);
|
||||
else RGB(val << 8);
|
||||
|
||||
}
|
||||
#endif
|
||||
uint32_t millis()
|
||||
{
|
||||
return CRYOTIMER->CNT;
|
||||
@@ -186,9 +295,9 @@ int usbhid_recv(uint8_t * msg)
|
||||
wait_for_efm8_busy();
|
||||
|
||||
|
||||
// msgs_to_recv--;
|
||||
// printf(">> ");
|
||||
// dump_hex(msg,64);
|
||||
// // msgs_to_recv--;
|
||||
// printf(">> ");
|
||||
// dump_hex(msg,64);
|
||||
return 64;
|
||||
}
|
||||
|
||||
@@ -209,6 +318,8 @@ void usbhid_send(uint8_t * msg)
|
||||
USART_SpiTransfer(USART1, *msg++);
|
||||
}
|
||||
wait_for_efm8_busy();
|
||||
|
||||
delay(10);
|
||||
// uint32_t t2 = millis();
|
||||
// printf("wait time: %u\n", (uint32_t)(t2-t1));
|
||||
|
||||
@@ -334,11 +445,14 @@ void bootloader_init(void)
|
||||
// status LEDS
|
||||
GPIO_PinModeSet(LED1_PIN,
|
||||
gpioModePushPull,
|
||||
0);
|
||||
1); // red
|
||||
|
||||
GPIO_PinModeSet(LED2_PIN,
|
||||
gpioModePushPull,
|
||||
1);
|
||||
1); // green
|
||||
GPIO_PinModeSet(LED3_PIN,
|
||||
gpioModePushPull,
|
||||
1); // blue
|
||||
|
||||
// EFM8 RDY/BUSY
|
||||
GPIO_PinModeSet(RDY_PIN, gpioModeInput, 0);
|
||||
@@ -369,11 +483,14 @@ void device_init(void)
|
||||
// status LEDS
|
||||
GPIO_PinModeSet(LED1_PIN,
|
||||
gpioModePushPull,
|
||||
0);
|
||||
1); // red
|
||||
|
||||
GPIO_PinModeSet(LED2_PIN,
|
||||
gpioModePushPull,
|
||||
1);
|
||||
1); // green
|
||||
GPIO_PinModeSet(LED3_PIN,
|
||||
gpioModePushPull,
|
||||
1); // blue
|
||||
|
||||
// EFM8 RDY/BUSY
|
||||
GPIO_PinModeSet(RDY_PIN, gpioModeInput, 0);
|
||||
@@ -387,6 +504,9 @@ void device_init(void)
|
||||
// Reset EFM8
|
||||
GPIO_PinModeSet(RESET_PIN, gpioModePushPull, 1);
|
||||
|
||||
TIMER_TopSet(TIMER0, 255);
|
||||
|
||||
RGB(LED_INIT_VALUE);
|
||||
|
||||
printing_init();
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#define NFC_DEV_ADDR (0xa0|(0x0<<1))
|
||||
#define NFC_DEV_USART USART1
|
||||
|
||||
#ifndef IS_BOOTLOADER
|
||||
I2C_TransferReturn_TypeDef I2CSPM_Transfer(I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq)
|
||||
{
|
||||
I2C_TransferReturn_TypeDef ret;
|
||||
@@ -357,3 +357,5 @@ void nfc_test()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -27,7 +27,7 @@ void setupSWOForPrint(void)
|
||||
/* Enable Serial wire output pin */
|
||||
GPIO->ROUTEPEN |= GPIO_ROUTEPEN_SWVPEN;
|
||||
|
||||
/* Set location 0 */
|
||||
/* Set location 0 */
|
||||
GPIO->ROUTELOC0 = GPIO_ROUTELOC0_SWVLOC_LOC0;
|
||||
|
||||
/* Enable output on pin - GPIO Port F, Pin 2 */
|
||||
@@ -76,7 +76,9 @@ int RETARGET_ReadChar(void)
|
||||
|
||||
void printing_init()
|
||||
{
|
||||
#ifdef USING_DEV_BOARD
|
||||
// GPIO_PinModeSet(gpioPortA,5,gpioModePushPull,1); // VCOM enable
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -23,14 +23,14 @@
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule buildConfig.stockConfigId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.debug#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904" cppBuildConfig.builtinIncludes="studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/ studio:/sdk/hardware/kit/SLSTK3401A_EFM32PG/config/ studio:/sdk/platform/Device/SiliconLabs/EFM32PG1B/Include/ studio:/sdk/hardware/kit/common/bsp/ studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/ studio:/sdk/hardware/kit/SLSTK3401A_EFM32PG/config/ studio:/sdk/platform/Device/SiliconLabs/EFM32PG1B/Include/ studio:/sdk/hardware/kit/common/bsp/" cppBuildConfig.builtinLibraryFiles="" cppBuildConfig.builtinLibraryNames="" cppBuildConfig.builtinLibraryObjects="" cppBuildConfig.builtinLibraryPaths="" cppBuildConfig.builtinMacros="EFM32PG1B200F256GM48 EFM32PG1B200F256GM48" moduleId="com.silabs.ss.framework.ide.project.core.cpp" projectCommon.referencedModules="[{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.drivers\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.bsp\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":["CMSIS/EFM32PG1B/startup_gcc_efm32pg1b.s","CMSIS/EFM32PG1B/system_efm32pg1b.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.part\"/>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.CMSIS\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":["emlib/em_gpio.c","emlib/em_system.c","emlib/em_cmu.c","emlib/em_assert.c","emlib/em_emu.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.emlib\">\r\n <inclusions pattern=\"emlib/em_system.c\"/>\r\n <inclusions pattern=\"emlib/em_emu.c\"/>\r\n <inclusions pattern=\"emlib/em_cmu.c\"/>\r\n <inclusions pattern=\"emlib/em_device.c\"/>\r\n <inclusions pattern=\"emlib/em_chip.c\"/>\r\n <inclusions pattern=\"emlib/em_assert.c\"/>\r\n <inclusions pattern=\"emlib/em_gpio.c\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.board\"/>"}]" projectCommon.toolchainId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904"/>
|
||||
<storageModule buildConfig.stockConfigId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.debug#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904" cppBuildConfig.builtinIncludes="studio:/sdk/hardware/kit/common/bsp/ studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/Device/SiliconLabs/EFM32JG1B/Include/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/ studio:/sdk/hardware/kit/common/bsp/ studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/Device/SiliconLabs/EFM32JG1B/Include/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/" cppBuildConfig.builtinLibraryFiles="" cppBuildConfig.builtinLibraryNames="" cppBuildConfig.builtinLibraryObjects="" cppBuildConfig.builtinLibraryPaths="" cppBuildConfig.builtinMacros="EFM32JG1B200F128GM32 EFM32JG1B200F128GM32" moduleId="com.silabs.ss.framework.ide.project.core.cpp" projectCommon.boardIds="com.silabs.board.none:0.0.0" projectCommon.partId="mcu.arm.efm32.jg1.efm32jg1b200f128gm32" projectCommon.referencedModules="[{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.drivers\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.bsp\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":["CMSIS/EFM32JG1B/startup_gcc_efm32jg1b.s","CMSIS/EFM32JG1B/system_efm32jg1b.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.part\"/>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.CMSIS\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":["emlib/em_gpio.c","emlib/em_system.c","emlib/em_cmu.c","emlib/em_assert.c","emlib/em_emu.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.emlib\">\r\n <inclusions pattern=\"emlib/em_system.c\"/>\r\n <inclusions pattern=\"emlib/em_emu.c\"/>\r\n <inclusions pattern=\"emlib/em_cmu.c\"/>\r\n <inclusions pattern=\"emlib/em_device.c\"/>\r\n <inclusions pattern=\"emlib/em_chip.c\"/>\r\n <inclusions pattern=\"emlib/em_assert.c\"/>\r\n <inclusions pattern=\"emlib/em_gpio.c\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.board\"/>"}]" projectCommon.sdkId="com.silabs.sdk.stack.super:1.1.1._310456152" projectCommon.toolchainId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" description="" id="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.debug#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904" name="GNU ARM v7.2.1 - Debug" parent="com.silabs.ide.si32.gcc.cdt.managedbuild.config.gnu.exe">
|
||||
<folderInfo id="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.debug#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904." name="/" resourcePath="">
|
||||
<toolChain id="com.silabs.ide.si32.gcc.cdt.managedbuild.toolchain.exe.930698941" name="Si32 GNU ARM" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.toolchain.exe">
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.toolchain.debug.level.2037798819" name="Debug Level" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.toolchain.debug.level" value="com.silabs.ide.si32.gcc.cdt.managedbuild.toolchain.debug.level.default" valueType="enumerated"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.overrideflash.495029551" name="Override default flash options" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.overrideflash" value="true" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.flashlength.2021030475" name="LENGTH" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.flashlength" value="0x8000" valueType="string"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.flashlength.2021030475" name="LENGTH" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.flashlength" value="0x4000" valueType="string"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.overrideram.2020332041" name="Override default RAM options" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.overrideram" value="true" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.ramorigin.2081162957" name="ORIGIN" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.ramorigin" value="0x20000000" valueType="string"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.ramlength.1981650487" name="LENGTH" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.linker.ramlength" value="0x8000" valueType="string"/>
|
||||
@@ -40,25 +40,24 @@
|
||||
<option id="gnu.c.compiler.option.optimization.level.1400029735" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" value="gnu.c.optimization.level.size" valueType="enumerated"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.def.symbols.115820704" name="Defined symbols (-D)" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.def.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG=1"/>
|
||||
<listOptionValue builtIn="false" value="EFM32PG1B200F256GM48=1"/>
|
||||
<listOptionValue builtIn="false" value="EFM32JG1B200F128GM32=1"/>
|
||||
</option>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.debug.builtin.422869633" name="Always branch to builtin functions (-fno-builtin)" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.debug.builtin" value="true" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.debug.prolog.384018529" name="Generate debugger-friendly prologs (-mno-sched-prolog)" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.debug.prolog" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.749408413" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/drivers""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/CMSIS/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/emlib/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/SLSTK3401A_EFM32PG/config""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32PG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../efm32/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../fido2""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../tinycbor/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../crypto/sha256""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../crypto/micro-ecc""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../crypto/tiny-AES-c""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/drivers""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32JG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/CMSIS/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/emlib/inc""/>
|
||||
</option>
|
||||
<inputType id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.input.486237326" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
@@ -71,15 +70,14 @@
|
||||
<option id="gnu.both.asm.option.include.paths.998368574" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/drivers""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32JG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/CMSIS/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/emlib/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/SLSTK3401A_EFM32PG/config""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32PG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
</option>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.as.def.symbols.604334894" name="Defined symbols (-D)" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.as.def.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="EFM32PG1B200F256GM48=1"/>
|
||||
<listOptionValue builtIn="false" value="EFM32JG1B200F128GM32=1"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.core.asmSource.695503458" superClass="org.eclipse.cdt.core.asmSource"/>
|
||||
</tool>
|
||||
@@ -95,10 +93,10 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="crypto|fido2|efm32" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="aes-gcm/|micro-ecc/examples/|micro-ecc/scripts/|micro-ecc/test/|tiny-AES-c/" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="crypto"/>
|
||||
<entry excluding=".settings/|CMSIS/|docs/|emlib/|GNU ARM v7.2.1 - Debug/|hw/|inc/|mbedtls/|sl_crypto/|src/.crypto.c.swp|src/.device.c.swp|src/app.h|src/main.c|.cproject|.project|EFM32.hwconf|Makefile|src/crypto.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="efm32"/>
|
||||
<entry excluding=".ctap_errors.h.swp|.ctap.c.swp|.ctap.h.swp|.main.c.swp|.storage.h.swp|.wallet.c.swp|.wallet.h.swp|crypto.c|main.c|ctap_parse.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="fido2"/>
|
||||
<entry excluding="CMSIS/EFM32PG1B|crypto|efm32|fido2" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="aes-gcm|micro-ecc/examples|micro-ecc/scripts|micro-ecc/test|tiny-AES-c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="crypto"/>
|
||||
<entry excluding=".settings|CMSIS|docs|emlib|GNU ARM v7.2.1 - Debug|hw|inc|mbedtls|sl_crypto|src/crypto.c|src/main.c|.cproject|.project|EFM32.hwconf|Makefile|src/.crypto.c.swp|src/.device.c.swp|src/app.h" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="efm32"/>
|
||||
<entry excluding=".main.c.swp|crypto.c|ctap_parse.c|main.c|.ctap_errors.h.swp|.ctap.c.swp|.ctap.h.swp|.storage.h.swp|.wallet.c.swp|.wallet.h.swp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="fido2"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
@@ -126,7 +124,7 @@
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule buildConfig.stockConfigId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.release#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904" cppBuildConfig.builtinIncludes="studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/ studio:/sdk/hardware/kit/SLSTK3401A_EFM32PG/config/ studio:/sdk/platform/Device/SiliconLabs/EFM32PG1B/Include/ studio:/sdk/hardware/kit/common/bsp/ studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/ studio:/sdk/hardware/kit/SLSTK3401A_EFM32PG/config/ studio:/sdk/platform/Device/SiliconLabs/EFM32PG1B/Include/ studio:/sdk/hardware/kit/common/bsp/" cppBuildConfig.builtinLibraryFiles="" cppBuildConfig.builtinLibraryNames="" cppBuildConfig.builtinLibraryObjects="" cppBuildConfig.builtinLibraryPaths="" cppBuildConfig.builtinMacros="EFM32PG1B200F256GM48 EFM32PG1B200F256GM48" moduleId="com.silabs.ss.framework.ide.project.core.cpp" projectCommon.referencedModules="[{"builtinExcludes":[],"builtinSources":["emlib/em_gpio.c","emlib/em_system.c","emlib/em_cmu.c","emlib/em_assert.c","emlib/em_emu.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.emlib\">\r\n <inclusions pattern=\"emlib/em_system.c\"/>\r\n <inclusions pattern=\"emlib/em_emu.c\"/>\r\n <inclusions pattern=\"emlib/em_cmu.c\"/>\r\n <inclusions pattern=\"emlib/em_device.c\"/>\r\n <inclusions pattern=\"emlib/em_chip.c\"/>\r\n <inclusions pattern=\"emlib/em_assert.c\"/>\r\n <inclusions pattern=\"emlib/em_gpio.c\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.board\"/>"},{"builtinExcludes":[],"builtinSources":["CMSIS/EFM32PG1B/startup_gcc_efm32pg1b.s","CMSIS/EFM32PG1B/system_efm32pg1b.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.part\"/>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.bsp\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.drivers\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.CMSIS\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"}]" projectCommon.toolchainId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904"/>
|
||||
<storageModule buildConfig.stockConfigId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.release#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904" cppBuildConfig.builtinIncludes="studio:/sdk/hardware/kit/common/bsp/ studio:/sdk/hardware/kit/SLSTK3401A_EFM32PG/config/ studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/Device/SiliconLabs/EFM32PG1B/Include/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/ studio:/sdk/hardware/kit/common/bsp/ studio:/sdk/hardware/kit/SLSTK3401A_EFM32PG/config/ studio:/sdk/hardware/kit/common/drivers/ studio:/sdk/platform/Device/SiliconLabs/EFM32PG1B/Include/ studio:/sdk/platform/CMSIS/Include/ studio:/sdk/platform/emlib/inc/" cppBuildConfig.builtinLibraryFiles="" cppBuildConfig.builtinLibraryNames="" cppBuildConfig.builtinLibraryObjects="" cppBuildConfig.builtinLibraryPaths="" cppBuildConfig.builtinMacros="EFM32PG1B200F256GM48 EFM32PG1B200F256GM48" moduleId="com.silabs.ss.framework.ide.project.core.cpp" projectCommon.referencedModules="[{"builtinExcludes":[],"builtinSources":["emlib/em_gpio.c","emlib/em_system.c","emlib/em_cmu.c","emlib/em_assert.c","emlib/em_emu.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.emlib\">\r\n <inclusions pattern=\"emlib/em_system.c\"/>\r\n <inclusions pattern=\"emlib/em_emu.c\"/>\r\n <inclusions pattern=\"emlib/em_cmu.c\"/>\r\n <inclusions pattern=\"emlib/em_device.c\"/>\r\n <inclusions pattern=\"emlib/em_chip.c\"/>\r\n <inclusions pattern=\"emlib/em_assert.c\"/>\r\n <inclusions pattern=\"emlib/em_gpio.c\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.board\"/>"},{"builtinExcludes":[],"builtinSources":["CMSIS/EFM32PG1B/startup_gcc_efm32pg1b.s","CMSIS/EFM32PG1B/system_efm32pg1b.c"],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.part\"/>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.bsp\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.drivers\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"},{"builtinExcludes":[],"builtinSources":[],"builtin":true,"module":"<project:MModule xmlns:project=\"http://www.silabs.com/ss/Project.ecore\" builtin=\"true\" id=\"com.silabs.sdk.exx32.common.CMSIS\">\r\n <exclusions pattern=\".*\"/>\r\n</project:MModule>"}]" projectCommon.toolchainId="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" description="" id="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.release#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904" name="GNU ARM v7.2.1 - Release" parent="com.silabs.ide.si32.gcc.cdt.managedbuild.config.gnu.exe">
|
||||
<folderInfo id="com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt.release#com.silabs.ss.tool.ide.arm.toolchain.gnu.cdt:7.2.1.20170904." name="/" resourcePath="">
|
||||
@@ -145,12 +143,12 @@
|
||||
<option id="gnu.c.compiler.option.include.paths.1968865334" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/SLSTK3401A_EFM32PG/config""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/drivers""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32PG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/CMSIS/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/emlib/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/SLSTK3401A_EFM32PG/config""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32PG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
</option>
|
||||
<inputType id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.input.2075078357" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
@@ -162,12 +160,12 @@
|
||||
<option id="gnu.both.asm.option.include.paths.220914305" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/SLSTK3401A_EFM32PG/config""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/drivers""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32PG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/CMSIS/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/emlib/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/SLSTK3401A_EFM32PG/config""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/platform/Device/SiliconLabs/EFM32PG1B/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${StudioSdkPath}/hardware/kit/common/bsp""/>
|
||||
</option>
|
||||
<option id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.as.def.symbols.1679775183" name="Defined symbols (-D)" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.as.def.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="EFM32PG1B200F256GM48=1"/>
|
||||
@@ -185,6 +183,9 @@
|
||||
<tool id="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.archiver.base.29462529" name="GNU ARM Archiver" superClass="com.silabs.ide.si32.gcc.cdt.managedbuild.tool.gnu.archiver.base"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="efm32/CMSIS/EFM32JG1B|CMSIS/EFM32JG1B" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
|
@@ -33,5 +33,15 @@
|
||||
<type>2</type>
|
||||
<locationURI>$%7BPARENT-1-PROJECT_LOC%7D/fido2</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>CMSIS/EFM32JG1B/startup_gcc_efm32jg1b.s</name>
|
||||
<type>1</type>
|
||||
<locationURI>STUDIO_SDK_LOC/platform/Device/SiliconLabs/EFM32JG1B/Source/GCC/startup_efm32jg1b.S</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>CMSIS/EFM32JG1B/system_efm32jg1b.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>STUDIO_SDK_LOC/platform/Device/SiliconLabs/EFM32JG1B/Source/system_efm32jg1b.c</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
253
efm32boot/emlib/em_timer.c
Normal file
253
efm32boot/emlib/em_timer.c
Normal file
@@ -0,0 +1,253 @@
|
||||
/***************************************************************************//**
|
||||
* @file em_timer.c
|
||||
* @brief Timer/counter (TIMER) Peripheral API
|
||||
* @version 5.2.2
|
||||
*******************************************************************************
|
||||
* # License
|
||||
* <b>Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
|
||||
* obligation to support this Software. Silicon Labs is providing the
|
||||
* Software "AS IS", with no express or implied warranties of any kind,
|
||||
* including, but not limited to, any implied warranties of merchantability
|
||||
* or fitness for any particular purpose or warranties against infringement
|
||||
* of any proprietary rights of a third party.
|
||||
*
|
||||
* Silicon Labs will not be liable for any consequential, incidental, or
|
||||
* special damages, or any other relief, or for any claim by any third party,
|
||||
* arising from your use of this Software.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "em_timer.h"
|
||||
#if defined(TIMER_COUNT) && (TIMER_COUNT > 0)
|
||||
|
||||
#include "em_assert.h"
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup emlib
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup TIMER
|
||||
* @brief Timer/Counter (TIMER) Peripheral API
|
||||
* @details
|
||||
* The timer module consists of three main parts:
|
||||
* @li General timer config and enable control.
|
||||
* @li Compare/capture control.
|
||||
* @li Dead time insertion control (may not be available for all timers).
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
************************** GLOBAL FUNCTIONS *******************************
|
||||
******************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief
|
||||
* Initialize TIMER.
|
||||
*
|
||||
* @details
|
||||
* Notice that counter top must be configured separately with for instance
|
||||
* TIMER_TopSet(). In addition, compare/capture and dead-time insertion
|
||||
* init must be initialized separately if used. That should probably
|
||||
* be done prior to the use of this function if configuring the TIMER to
|
||||
* start when initialization is completed.
|
||||
*
|
||||
* @param[in] timer
|
||||
* Pointer to TIMER peripheral register block.
|
||||
*
|
||||
* @param[in] init
|
||||
* Pointer to TIMER initialization structure.
|
||||
******************************************************************************/
|
||||
void TIMER_Init(TIMER_TypeDef *timer, const TIMER_Init_TypeDef *init)
|
||||
{
|
||||
EFM_ASSERT(TIMER_REF_VALID(timer));
|
||||
|
||||
/* Stop timer if specified to be disabled (dosn't hurt if already stopped) */
|
||||
if (!(init->enable)) {
|
||||
timer->CMD = TIMER_CMD_STOP;
|
||||
}
|
||||
|
||||
/* Reset counter */
|
||||
timer->CNT = _TIMER_CNT_RESETVALUE;
|
||||
|
||||
timer->CTRL = ((uint32_t)(init->prescale) << _TIMER_CTRL_PRESC_SHIFT)
|
||||
| ((uint32_t)(init->clkSel) << _TIMER_CTRL_CLKSEL_SHIFT)
|
||||
| ((uint32_t)(init->fallAction) << _TIMER_CTRL_FALLA_SHIFT)
|
||||
| ((uint32_t)(init->riseAction) << _TIMER_CTRL_RISEA_SHIFT)
|
||||
| ((uint32_t)(init->mode) << _TIMER_CTRL_MODE_SHIFT)
|
||||
| (init->debugRun ? TIMER_CTRL_DEBUGRUN : 0)
|
||||
| (init->dmaClrAct ? TIMER_CTRL_DMACLRACT : 0)
|
||||
| (init->quadModeX4 ? TIMER_CTRL_QDM_X4 : 0)
|
||||
| (init->oneShot ? TIMER_CTRL_OSMEN : 0)
|
||||
|
||||
#if defined(TIMER_CTRL_X2CNT) && defined(TIMER_CTRL_ATI)
|
||||
| (init->count2x ? TIMER_CTRL_X2CNT : 0)
|
||||
| (init->ati ? TIMER_CTRL_ATI : 0)
|
||||
#endif
|
||||
| (init->sync ? TIMER_CTRL_SYNC : 0);
|
||||
|
||||
/* Start timer if specified to be enabled (dosn't hurt if already started) */
|
||||
if (init->enable) {
|
||||
timer->CMD = TIMER_CMD_START;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief
|
||||
* Initialize TIMER compare/capture channel.
|
||||
*
|
||||
* @details
|
||||
* Notice that if operating channel in compare mode, the CCV and CCVB register
|
||||
* must be set separately as required.
|
||||
*
|
||||
* @param[in] timer
|
||||
* Pointer to TIMER peripheral register block.
|
||||
*
|
||||
* @param[in] ch
|
||||
* Compare/capture channel to init for.
|
||||
*
|
||||
* @param[in] init
|
||||
* Pointer to TIMER initialization structure.
|
||||
******************************************************************************/
|
||||
void TIMER_InitCC(TIMER_TypeDef *timer,
|
||||
unsigned int ch,
|
||||
const TIMER_InitCC_TypeDef *init)
|
||||
{
|
||||
EFM_ASSERT(TIMER_REF_VALID(timer));
|
||||
EFM_ASSERT(TIMER_CH_VALID(ch));
|
||||
|
||||
timer->CC[ch].CTRL =
|
||||
((uint32_t)(init->eventCtrl) << _TIMER_CC_CTRL_ICEVCTRL_SHIFT)
|
||||
| ((uint32_t)(init->edge) << _TIMER_CC_CTRL_ICEDGE_SHIFT)
|
||||
| ((uint32_t)(init->prsSel) << _TIMER_CC_CTRL_PRSSEL_SHIFT)
|
||||
| ((uint32_t)(init->cufoa) << _TIMER_CC_CTRL_CUFOA_SHIFT)
|
||||
| ((uint32_t)(init->cofoa) << _TIMER_CC_CTRL_COFOA_SHIFT)
|
||||
| ((uint32_t)(init->cmoa) << _TIMER_CC_CTRL_CMOA_SHIFT)
|
||||
| ((uint32_t)(init->mode) << _TIMER_CC_CTRL_MODE_SHIFT)
|
||||
| (init->filter ? TIMER_CC_CTRL_FILT_ENABLE : 0)
|
||||
| (init->prsInput ? TIMER_CC_CTRL_INSEL_PRS : 0)
|
||||
| (init->coist ? TIMER_CC_CTRL_COIST : 0)
|
||||
| (init->outInvert ? TIMER_CC_CTRL_OUTINV : 0);
|
||||
}
|
||||
|
||||
#if defined(_TIMER_DTCTRL_MASK)
|
||||
/***************************************************************************//**
|
||||
* @brief
|
||||
* Initialize the TIMER DTI unit.
|
||||
*
|
||||
* @param[in] timer
|
||||
* Pointer to TIMER peripheral register block.
|
||||
*
|
||||
* @param[in] init
|
||||
* Pointer to TIMER DTI initialization structure.
|
||||
******************************************************************************/
|
||||
void TIMER_InitDTI(TIMER_TypeDef *timer, const TIMER_InitDTI_TypeDef *init)
|
||||
{
|
||||
EFM_ASSERT(TIMER0 == timer);
|
||||
|
||||
/* Make sure the DTI unit is disabled while initializing. */
|
||||
TIMER_EnableDTI(timer, false);
|
||||
|
||||
/* Setup the DTCTRL register.
|
||||
The enable bit will be set at the end of the function if specified. */
|
||||
timer->DTCTRL =
|
||||
(init->autoRestart ? TIMER_DTCTRL_DTDAS : 0)
|
||||
| (init->activeLowOut ? TIMER_DTCTRL_DTIPOL : 0)
|
||||
| (init->invertComplementaryOut ? TIMER_DTCTRL_DTCINV : 0)
|
||||
| (init->enablePrsSource ? TIMER_DTCTRL_DTPRSEN : 0)
|
||||
| ((uint32_t)(init->prsSel) << _TIMER_DTCTRL_DTPRSSEL_SHIFT);
|
||||
|
||||
/* Setup the DTTIME register. */
|
||||
timer->DTTIME =
|
||||
((uint32_t)(init->prescale) << _TIMER_DTTIME_DTPRESC_SHIFT)
|
||||
| ((uint32_t)(init->riseTime) << _TIMER_DTTIME_DTRISET_SHIFT)
|
||||
| ((uint32_t)(init->fallTime) << _TIMER_DTTIME_DTFALLT_SHIFT);
|
||||
|
||||
/* Setup the DTFC register. */
|
||||
timer->DTFC =
|
||||
(init->enableFaultSourceCoreLockup ? TIMER_DTFC_DTLOCKUPFEN : 0)
|
||||
| (init->enableFaultSourceDebugger ? TIMER_DTFC_DTDBGFEN : 0)
|
||||
| (init->enableFaultSourcePrsSel0 ? TIMER_DTFC_DTPRS0FEN : 0)
|
||||
| (init->enableFaultSourcePrsSel1 ? TIMER_DTFC_DTPRS1FEN : 0)
|
||||
| ((uint32_t)(init->faultAction) << _TIMER_DTFC_DTFA_SHIFT)
|
||||
| ((uint32_t)(init->faultSourcePrsSel0) << _TIMER_DTFC_DTPRS0FSEL_SHIFT)
|
||||
| ((uint32_t)(init->faultSourcePrsSel1) << _TIMER_DTFC_DTPRS1FSEL_SHIFT);
|
||||
|
||||
/* Setup the DTOGEN register. */
|
||||
timer->DTOGEN = init->outputsEnableMask;
|
||||
|
||||
/* Clear any previous DTI faults. */
|
||||
TIMER_ClearDTIFault(timer, TIMER_GetDTIFault(timer));
|
||||
|
||||
/* Enable/disable before returning. */
|
||||
TIMER_EnableDTI(timer, init->enable);
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************************//**
|
||||
* @brief
|
||||
* Reset TIMER to same state as after a HW reset.
|
||||
*
|
||||
* @note
|
||||
* The ROUTE register is NOT reset by this function, in order to allow for
|
||||
* centralized setup of this feature.
|
||||
*
|
||||
* @param[in] timer
|
||||
* Pointer to TIMER peripheral register block.
|
||||
******************************************************************************/
|
||||
void TIMER_Reset(TIMER_TypeDef *timer)
|
||||
{
|
||||
int i;
|
||||
|
||||
EFM_ASSERT(TIMER_REF_VALID(timer));
|
||||
|
||||
/* Make sure disabled first, before resetting other registers */
|
||||
timer->CMD = TIMER_CMD_STOP;
|
||||
|
||||
timer->CTRL = _TIMER_CTRL_RESETVALUE;
|
||||
timer->IEN = _TIMER_IEN_RESETVALUE;
|
||||
timer->IFC = _TIMER_IFC_MASK;
|
||||
timer->TOPB = _TIMER_TOPB_RESETVALUE;
|
||||
/* Write TOP after TOPB to invalidate TOPB (clear TIMER_STATUS_TOPBV) */
|
||||
timer->TOP = _TIMER_TOP_RESETVALUE;
|
||||
timer->CNT = _TIMER_CNT_RESETVALUE;
|
||||
/* Do not reset route register, setting should be done independently */
|
||||
/* (Note: ROUTE register may be locked by DTLOCK register.) */
|
||||
|
||||
for (i = 0; TIMER_CH_VALID(i); i++) {
|
||||
timer->CC[i].CTRL = _TIMER_CC_CTRL_RESETVALUE;
|
||||
timer->CC[i].CCV = _TIMER_CC_CCV_RESETVALUE;
|
||||
timer->CC[i].CCVB = _TIMER_CC_CCVB_RESETVALUE;
|
||||
}
|
||||
|
||||
/* Reset dead time insertion module, no effect on timers without DTI */
|
||||
|
||||
#if defined(TIMER_DTLOCK_LOCKKEY_UNLOCK)
|
||||
/* Unlock DTI registers first in case locked */
|
||||
timer->DTLOCK = TIMER_DTLOCK_LOCKKEY_UNLOCK;
|
||||
|
||||
timer->DTCTRL = _TIMER_DTCTRL_RESETVALUE;
|
||||
timer->DTTIME = _TIMER_DTTIME_RESETVALUE;
|
||||
timer->DTFC = _TIMER_DTFC_RESETVALUE;
|
||||
timer->DTOGEN = _TIMER_DTOGEN_RESETVALUE;
|
||||
timer->DTFAULTC = _TIMER_DTFAULTC_MASK;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @} (end addtogroup TIMER) */
|
||||
/** @} (end addtogroup emlib) */
|
||||
#endif /* defined(TIMER_COUNT) && (TIMER_COUNT > 0) */
|
@@ -8,19 +8,25 @@
|
||||
#ifndef SRC_APP_H_
|
||||
#define SRC_APP_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define IS_BOOTLOADER
|
||||
|
||||
#define DEBUG_LEVEL 0
|
||||
|
||||
#define PRINTING_USE_VCOM
|
||||
//#define PRINTING_USE_VCOM
|
||||
|
||||
#define USING_DEV_BOARD
|
||||
//#define USING_DEV_BOARD
|
||||
|
||||
#define BRIDGE_TO_WALLET
|
||||
|
||||
#define JUMP_LOC 0x8000
|
||||
#define JUMP_LOC 0x4000
|
||||
|
||||
#ifdef USING_DEV_BOARD
|
||||
#define PUSH_BUTTON gpioPortF,6
|
||||
#else
|
||||
#define PUSH_BUTTON gpioPortD,13
|
||||
#endif
|
||||
|
||||
//#define DISABLE_CTAPHID_PING
|
||||
#define DISABLE_CTAPHID_WINK
|
||||
@@ -32,6 +38,8 @@ int bootloader_bridge(uint8_t klen, uint8_t * keyh);
|
||||
|
||||
int is_authorized_to_boot();
|
||||
|
||||
#define LED_INIT_VALUE 0x101000
|
||||
|
||||
extern uint8_t REBOOT_FLAG;
|
||||
|
||||
#endif /* SRC_APP_H_ */
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "em_device.h"
|
||||
#include "em_chip.h"
|
||||
#include "em_timer.h"
|
||||
|
||||
#include "device.h"
|
||||
#include "app.h"
|
||||
@@ -63,10 +64,15 @@ bootmode:
|
||||
printf1(TAG_GEN,"Reflash condition detected\n");
|
||||
ctaphid_init();
|
||||
reset_efm8();
|
||||
TIMER0_enter_DefaultMode_from_RESET();
|
||||
TIMER_TopSet(TIMER0, 255);
|
||||
|
||||
RGB(LED_INIT_VALUE);
|
||||
|
||||
/* Infinite loop */
|
||||
int count = 0;
|
||||
while (1) {
|
||||
if (millis() - t1 > 1000)
|
||||
if (millis() - t1 > 10)
|
||||
{
|
||||
/*printf("heartbeat %ld\n", beat++);*/
|
||||
heartbeat();
|
||||
@@ -100,7 +106,7 @@ bootmode:
|
||||
|
||||
printf1(TAG_GEN,"Normal boot\n");
|
||||
|
||||
if (is_authorized_to_boot())
|
||||
if (is_authorized_to_boot() )
|
||||
{
|
||||
BOOT_boot();
|
||||
} else {
|
||||
|
@@ -170,7 +170,7 @@
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="com.silabs.ss.framework.ide.project.core.cpp" project.generation="40" projectCommon.boardIds="brd5000a:0.0.0.A02" projectCommon.buildArtifactType="EXE" projectCommon.importModeId="COPY" projectCommon.partId="mcu.8051.efm8.ub1.efm8ub10f16g-b-qfn28" projectCommon.sdkId="com.silabs.sdk.8051:4.1.1._-963069327"/>
|
||||
<storageModule moduleId="com.silabs.ss.framework.ide.project.core.cpp" project.generation="5" projectCommon.boardIds="brd5000a:0.0.0.A02" projectCommon.buildArtifactType="EXE" projectCommon.importModeId="COPY" projectCommon.partId="mcu.8051.efm8.ub1.efm8ub10f16g-b-qfn28" projectCommon.sdkId="com.silabs.sdk.8051:4.1.1._-963069327"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="efm8.com.silabs.ss.framework.ide.project.core.cdt.cdtMbsProjectType.972220390" name="SLS CDT Project" projectType="com.silabs.ss.framework.ide.project.core.cdt.cdtMbsProjectType"/>
|
||||
</storageModule>
|
||||
|
@@ -13,8 +13,7 @@
|
||||
void usb_transfer_complete();
|
||||
void spi_transfer_complete();
|
||||
|
||||
#define EFM32_RW_PIN P1_B2
|
||||
#define MSG_RDY_INT_PIN P1_B1
|
||||
|
||||
|
||||
#define INPUT_ENDPOINT EP2OUT
|
||||
#define OUTPUT_ENDPOINT EP3IN
|
||||
|
@@ -127,14 +127,22 @@ SI_SEGMENT_VARIABLE(configDesc[],
|
||||
#define LANG_STRING htole16( SLAB_USB_LANGUAGE )
|
||||
#define MFR_STRING 'S','i','l','i','c','o','n',' ','L','a','b','s','\0'
|
||||
#define MFR_SIZE 13
|
||||
#define PROD_STRING 'E','O','S',' ','W','a','l','l','e','t','\0'
|
||||
#define PROD_SIZE 11
|
||||
|
||||
#define SER_STRING '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','\0'
|
||||
#define SER_SIZE 17
|
||||
#define CFG_STRING 'C','o','n','f','i','g',' ','#','1','\0'
|
||||
#define CFG_SIZE 10
|
||||
#ifdef BRIDGE_TO_WALLET
|
||||
#define INT0_STRING 'E','O','S',' ','W','a','l','l','e','t','\0'
|
||||
#define INT0_SIZE 11
|
||||
#define PROD_STRING 'E','O','S',' ','W','a','l','l','e','t','\0'
|
||||
#define PROD_SIZE 11
|
||||
#else
|
||||
#define INT0_STRING 'S','o','l','o',' ','K','e','y','\0'
|
||||
#define INT0_SIZE 9
|
||||
#define PROD_STRING 'S','o','l','o',' ','K','e','y','\0'
|
||||
#define PROD_SIZE 9
|
||||
#endif
|
||||
|
||||
LANGID_STATIC_CONST_STRING_DESC( langDesc[], LANG_STRING );
|
||||
UTF16LE_PACKED_STATIC_CONST_STRING_DESC( mfrDesc[], MFR_STRING, MFR_SIZE);
|
||||
|
@@ -7,8 +7,20 @@
|
||||
|
||||
#define BUFFER_SIZE 12
|
||||
|
||||
#define SIGNAL_WRITE_BSY() P1_B2 = 0 // Set P1 low
|
||||
#define SIGNAL_WRITE_RDY() P1_B2 = 1 // Set P1 high
|
||||
#ifdef USING_DEVELOPMENT_BOARD
|
||||
#define RW_PIN P2_B3
|
||||
#define BUSY_PIN P1_B2
|
||||
#define MSG_RDY_PIN P1_B1
|
||||
#else
|
||||
#define RW_PIN P0_B1
|
||||
#define BUSY_PIN P0_B2
|
||||
#define MSG_RDY_PIN P0_B3
|
||||
#endif
|
||||
|
||||
#define SIGNAL_WRITE_BSY() BUSY_PIN = 0 // Set P1 low
|
||||
#define SIGNAL_WRITE_RDY() BUSY_PIN = 1 // Set P1 high
|
||||
|
||||
|
||||
|
||||
data uint8_t write_ptr = 0;
|
||||
data uint8_t read_ptr = 0;
|
||||
@@ -63,6 +75,7 @@ void usb_writeback_complete()
|
||||
|
||||
void spi_transfer_complete()
|
||||
{
|
||||
|
||||
if (count > 0) count--;
|
||||
i_ptr = 0;
|
||||
read_ptr++;
|
||||
@@ -107,9 +120,9 @@ int main(void) {
|
||||
|
||||
|
||||
SCON0_TI = 1;
|
||||
P2_B0 = 1;
|
||||
// P2_B0 = 1;
|
||||
|
||||
MSG_RDY_INT_PIN = 1;
|
||||
MSG_RDY_PIN = 1;
|
||||
|
||||
// enable SPI interrupts
|
||||
// SPI0FCN1 = SPI0FCN1 | (1<<4);
|
||||
@@ -121,7 +134,7 @@ int main(void) {
|
||||
// SPI0FCN0 &= ~3; // FIFO threshold 0x0
|
||||
SPI0FCN1 |= (1); // Enable RX fifo
|
||||
|
||||
cprints("hello,world\r\n");
|
||||
// cprints("hello,world\r\n");
|
||||
|
||||
|
||||
reset = RSTSRC;
|
||||
@@ -131,13 +144,12 @@ int main(void) {
|
||||
RSTSRC = (1<<4);
|
||||
}
|
||||
|
||||
MSG_RDY_INT_PIN = 1;
|
||||
MSG_RDY_PIN = 1;
|
||||
SIGNAL_WRITE_BSY();
|
||||
|
||||
while (1) {
|
||||
|
||||
|
||||
if (P2_B3 == 0)
|
||||
if (RW_PIN == 0)
|
||||
{
|
||||
i_ptr = 0;
|
||||
SPI0FCN0 |= (1<<6); // Flush TX fifo buffer
|
||||
@@ -153,7 +165,7 @@ int main(void) {
|
||||
SPI0DAT = (hidmsgbuf+read_ptr*64)[i_ptr++];
|
||||
}
|
||||
|
||||
while(P2_B3 == 0)
|
||||
while(RW_PIN == 0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -162,7 +174,7 @@ int main(void) {
|
||||
spi_transfer_complete();
|
||||
if (count == 0)
|
||||
{
|
||||
MSG_RDY_INT_PIN = 1;
|
||||
MSG_RDY_PIN = 1;
|
||||
}
|
||||
|
||||
SPI0FCN0 = SPI0FCN0 | (1<<2); // flush RX fifo
|
||||
@@ -181,6 +193,7 @@ int main(void) {
|
||||
// Did we RX data and have room?
|
||||
if ((SPI0CFG & (0x1)) == 0 && USB_TX_COUNT < 511/2)
|
||||
{
|
||||
|
||||
writebackbuf[writebackbuf_count++] = SPI0DAT;
|
||||
SIGNAL_WRITE_RDY();
|
||||
|
||||
@@ -204,11 +217,14 @@ int main(void) {
|
||||
|
||||
if (millis() - t1 > 1500)
|
||||
{
|
||||
#ifdef USING_DEVELOPMENT_BOARD
|
||||
P1_B5 = k++&1;
|
||||
#endif
|
||||
t1 = millis();
|
||||
}
|
||||
// if (!USBD_EpIsBusy(EP2OUT) && !USBD_EpIsBusy(EP3IN) && lastcount==count)
|
||||
if (!USBD_EpIsBusy(INPUT_ENDPOINT) && lastcount==count)
|
||||
// if (lastcount==count)
|
||||
{
|
||||
// cprintd("sched read to ",1,(int)(hidmsgbuf + write_ptr*64));
|
||||
if (count == BUFFER_SIZE)
|
||||
@@ -217,11 +233,12 @@ int main(void) {
|
||||
}
|
||||
else
|
||||
{
|
||||
// cprints("sched read\r\n");
|
||||
USBD_Read(INPUT_ENDPOINT, hidmsgbuf + write_ptr*64, 64, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cprints("it\r\n");
|
||||
|
||||
if (lastcount != count)
|
||||
{
|
||||
@@ -229,7 +246,7 @@ int main(void) {
|
||||
{
|
||||
// cputd(debugRi); cprints(">> ");
|
||||
// dump_hex(debugR,64);
|
||||
MSG_RDY_INT_PIN = 0;
|
||||
MSG_RDY_PIN = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -120,8 +120,9 @@ class UDPBridge(BaseHTTPRequestHandler):
|
||||
h = base64.b64encode(h.encode())
|
||||
h = to_websafe(h.decode())
|
||||
|
||||
START = 0x8000
|
||||
END = 2048 * 125 - 4
|
||||
num_pages = 64
|
||||
START = 0x4000
|
||||
END = 2048 * (num_pages - 3) - 4
|
||||
|
||||
ih = IntelHex(HEX_FILE)
|
||||
segs = ih.segments()
|
||||
@@ -132,7 +133,8 @@ class UDPBridge(BaseHTTPRequestHandler):
|
||||
print('im_size: ', im_size)
|
||||
print('firmware_size: ', len(arr))
|
||||
|
||||
sig = sha256((arr).tobytes())
|
||||
byts = (arr).tobytes() if hasattr(arr,'tobytes') else (arr).tostring()
|
||||
sig = sha256(byts)
|
||||
print('hash', binascii.hexlify(sig))
|
||||
sig = sk.sign_digest(sig)
|
||||
|
||||
|
@@ -1314,7 +1314,8 @@ async function run_tests() {
|
||||
|
||||
async function test_bootloader()
|
||||
{
|
||||
var addr = 0x8000;
|
||||
var addr = 0x4000;
|
||||
var num_pages = 64;
|
||||
|
||||
var p = await dev.is_bootloader();
|
||||
TEST(p.status == 'CTAP1_SUCCESS', 'Device is in bootloader mode');
|
||||
@@ -1324,16 +1325,16 @@ async function run_tests() {
|
||||
p = await dev.bootloader_write(0, randdata);
|
||||
TEST(p.status == 'CTAP2_ERR_NOT_ALLOWED', 'Denies accessing invalid address');
|
||||
|
||||
p = await dev.bootloader_write(0x8000-4, randdata);
|
||||
p = await dev.bootloader_write(addr-4, randdata);
|
||||
TEST(p.status == 'CTAP2_ERR_NOT_ALLOWED', 'Denies accessing invalid address');
|
||||
|
||||
p = await dev.bootloader_write(2048 * 125-4, randdata);
|
||||
p = await dev.bootloader_write(2048 * (num_pages-3)-4, randdata);
|
||||
TEST(p.status == 'CTAP2_ERR_NOT_ALLOWED', 'Denies accessing invalid address');
|
||||
|
||||
p = await dev.bootloader_write(2048 * 126, randdata);
|
||||
p = await dev.bootloader_write(2048 * (num_pages-2), randdata);
|
||||
TEST(p.status == 'CTAP2_ERR_NOT_ALLOWED', 'Denies accessing invalid address');
|
||||
|
||||
p = await dev.bootloader_write(2048 * 129, randdata);
|
||||
p = await dev.bootloader_write(2048 * (num_pages+1), randdata);
|
||||
TEST(p.status == 'CTAP2_ERR_NOT_ALLOWED', 'Denies accessing invalid address');
|
||||
|
||||
|
||||
@@ -1371,14 +1372,14 @@ async function run_tests() {
|
||||
}
|
||||
|
||||
//while(1)
|
||||
//{
|
||||
//await device_start_over();
|
||||
//await test_pin();
|
||||
//await test_crypto();
|
||||
//await test_rng();
|
||||
//}
|
||||
{
|
||||
await device_start_over();
|
||||
await test_pin();
|
||||
await test_crypto();
|
||||
await test_rng();
|
||||
}
|
||||
//await benchmark();
|
||||
await test_persistence();
|
||||
//await test_persistence();
|
||||
|
||||
//await test_bootloader();
|
||||
|
||||
|
@@ -4,10 +4,12 @@ from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
import ssl
|
||||
|
||||
|
||||
host =('localhost', 4443)
|
||||
httpd = HTTPServer(('localhost', 4443), SimpleHTTPRequestHandler)
|
||||
|
||||
httpd.socket = ssl.wrap_socket (httpd.socket,
|
||||
keyfile="localhost.key",
|
||||
certfile='localhost.crt', server_side=True)
|
||||
|
||||
print('serving on ', host)
|
||||
httpd.serve_forever()
|
||||
|
Reference in New Issue
Block a user