Initial schematic commit

This commit is contained in:
jaseg 2018-11-17 11:35:25 +09:00
parent 155a29ce08
commit 194bd7fdb9
27 changed files with 5500 additions and 2602 deletions

View file

@ -1,75 +0,0 @@
# put your *.o targets here, make should handle the rest!
CUBE_PATH ?= $(wildcard ~)/resource/STM32CubeF4
CMSIS_PATH ?= $(CUBE_PATH)/Drivers/CMSIS
CMSIS_DEV_PATH ?= $(CMSIS_PATH)/Device/ST/STM32F4xx
HAL_PATH ?= $(CUBE_PATH)/Drivers/STM32F4xx_HAL_Driver
USB_PATH ?= $(CUBE_PATH)/Middlewares/ST/STM32_USB_Host_Library
OUT ?= out
VPATH = .:$(HAL_PATH)/Src:$(USB_PATH)/Core/Src:$(USB_PATH)/Class/HID/Src
CC := arm-none-eabi-gcc
LD := arm-none-eabi-ld
OBJCOPY := arm-none-eabi-objcopy
OBJDUMP := arm-none-eabi-objdump
SIZE := arm-none-eabi-size
CFLAGS = -g -Wall -std=gnu11 -Os -fdump-rtl-expand
CFLAGS += -mlittle-endian -mcpu=cortex-m4 -mthumb
#CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS = -nostartfiles
LDFLAGS += -g -Wl,-Map=main.map -nostdlib
#LDFLAGS += -Wl,--gc-sections
LIBS = -lgcc
CFLAGS += -DSTM32F407xx
LDFLAGS += -Tstm32_flash.ld
CFLAGS += -I$(CMSIS_DEV_PATH)/Include -I$(CMSIS_PATH)/Include -I$(HAL_PATH)/Inc -I. -Iconfig
LDFLAGS += -L$(CMSIS_PATH)/Lib/GCC
SOURCES = main.c keyboard.c menu.c usbh_conf.c startup_stm32f407xx.s system_stm32f4xx.c syscalls.c stm32f4xx_it.c
SOURCES_C = $(filter %.c,$(SOURCES))
SOURCES_ASM = $(filter %.s,$(SOURCES))
CFLAGS += -I$(USB_PATH)/Core/Inc -I$(USB_PATH)/Class/HID/Inc
USB_SOURCES := $(notdir $(wildcard $(USB_PATH)/Core/Src/*.c)) $(notdir $(wildcard $(USB_PATH)/Class/HID/Src/*.c))
USB_SOURCES := $(filter-out usbh_conf_template.c,$(USB_SOURCES))
HAL_SOURCES = stm32f4xx_hal.c
HAL_SOURCES += stm32f4xx_hal_rcc.c stm32f4xx_hal_flash.c stm32f4xx_hal_flash_ex.c stm32f4xx_hal_dma.c
HAL_SOURCES += stm32f4xx_hal_usart.c stm32f4xx_hal_pwr.c
HAL_SOURCES += stm32f4xx_hal_hcd.c stm32f4xx_hal_gpio.c stm32f4xx_hal_cortex.c
HAL_SOURCES += stm32f4xx_ll_usb.c
################################################################################
.PHONY: program clean
all: main.elf main.pdf
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $^
%.o: %.s
$(CC) -c $(CFLAGS) -o $@ $^
%.dot: %.elf
r2 -a arm -qc 'aa;agC' $< 2>/dev/null >$@
#$(HAL_PATH)/Src/stm32f4xx_ll_utils.o
main.elf: $(SOURCES_ASM:.s=.o) $(SOURCES_C:.c=.o) $(USB_SOURCES:.c=.o) $(HAL_SOURCES:.c=.o)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJCOPY) -O ihex $@ $(@:.elf=.hex)
$(OBJCOPY) -O binary $@ $(@:.elf=.bin)
$(OBJDUMP) -St $@ >$(@:.elf=.lst)
$(SIZE) $@
program: main.elf openocd.cfg
openocd -f openocd.cfg -c "program $< verify reset exit"
clean:
rm -f **.o
rm -f main.elf main.hex main.bin main.map main.lst
rm -f **.expand

View file

View file

@ -1,73 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Src/keyboard.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief This file implements the HID keyboard functions
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#include "main.h"
#define KYBRD_FIRST_COLUMN (uint16_t)7
#define KYBRD_LAST_COLUMN (uint16_t)479
#define KYBRD_FIRST_LINE (uint8_t)90
#define SMALL_FONT_COLUMN_WIDTH 8
#define SMALL_FONT_LINE_WIDTH 15
#define KYBRD_LAST_LINE (uint16_t)200
extern HID_DEMO_StateMachine hid_demo;
uint8_t KeybrdCharXpos = 0;
uint16_t KeybrdCharYpos = 0;
static void USR_KEYBRD_Init(void);
void HID_KeyboardMenuProcess(void) { USR_KEYBRD_Init(); }
static void USR_KEYBRD_Init(void)
{
uart_print("Keyboard initialized\n");
}
void USR_KEYBRD_ProcessData(uint8_t data)
{
uart_putc(data);
}

247
main.c
View file

@ -1,247 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Src/main.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief USB host HID Mouse and Keyboard demo main file
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#include "main.h"
SCB_Type *scb = SCB;
GPIO_TypeDef *gpioa = GPIOA;
USBH_HandleTypeDef hUSBHost;
HID_ApplicationTypeDef Appli_state = APPLICATION_IDLE;
USART_HandleTypeDef console_uart;
static void SystemClock_Config(void);
static void USBH_UserProcess(USBH_HandleTypeDef* phost, uint8_t id);
static void HID_InitApplication(void);
static void Error_Handler(void);
void WWDG_IRQHandler()
{
while (1);
}
void uart_print(char *s)
{
/* Like, there is millions of lines of perfectly useless pseudo-comments in the HAL driver. But don't think they'd
* say what unit that timeout parameter has in any obvious place. I'll just go with milliseconds here -.- */
HAL_USART_Transmit(&console_uart, (uint8_t*)s, strlen(s), 1000);
}
void uart_putc(char c)
{
/* See above. */
HAL_USART_Transmit(&console_uart, (uint8_t*)&c, 1, 1000);
}
void HAL_USART_MspInit(USART_HandleTypeDef *narf)
{
__HAL_RCC_GPIOA_CLK_ENABLE();
/* TX */
GPIO_InitTypeDef pa9 = {
.Pin = GPIO_PIN_9,
.Mode = GPIO_MODE_AF_PP,
.Pull = GPIO_PULLUP,
.Speed = GPIO_SPEED_FREQ_LOW,
.Alternate = GPIO_AF7_USART1
};
HAL_GPIO_Init(GPIOA, &pa9);
/* RX */
GPIO_InitTypeDef pa10 = {
.Pin = GPIO_PIN_10,
.Mode = GPIO_MODE_AF_PP,
.Pull = GPIO_PULLUP,
.Speed = GPIO_SPEED_FREQ_LOW,
.Alternate = GPIO_AF7_USART1
};
HAL_GPIO_Init(GPIOA, &pa10);
}
int main(void)
{
HAL_Init();
SystemClock_Config();
/* FIXME
HID_InitApplication();
USBH_Init(&hUSBHost, USBH_UserProcess, 0);
USBH_RegisterClass(&hUSBHost, USBH_HID_CLASS);
USBH_Start(&hUSBHost);
*/
/* LEDs */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_USART1_CLK_ENABLE();
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
GPIOA->MODER |=
(1<<GPIO_MODER_MODER6_Pos)|
(1<<GPIO_MODER_MODER7_Pos);
GPIOA->OSPEEDR |=
(2<<GPIO_OSPEEDR_OSPEED6_Pos)|
(2<<GPIO_OSPEEDR_OSPEED7_Pos);
USART_HandleTypeDef foo = {
.Instance = USART1,
.Init = {
.BaudRate = 115200,
.WordLength = USART_WORDLENGTH_8B,
.StopBits = USART_STOPBITS_1,
.Parity = USART_PARITY_NONE,
.Mode = USART_MODE_TX_RX
}
};
console_uart = foo;
HAL_USART_Init(&console_uart);
static int ticks = 0;
while (1) {
/* FIXME USBH_Process(&hUSBHost); */
/* FIXME HID_MenuProcess(); */
Toggle_Leds();
if (ticks++ == 1000000) {
uart_print("This is a test\r\n");
ticks = 0;
}
}
}
static void HID_InitApplication(void)
{
HID_MenuInit();
}
static void USBH_UserProcess(USBH_HandleTypeDef* phost, uint8_t id)
{
switch (id) {
case HOST_USER_SELECT_CONFIGURATION:
break;
case HOST_USER_DISCONNECTION:
Appli_state = APPLICATION_DISCONNECT;
break;
case HOST_USER_CLASS_ACTIVE:
Appli_state = APPLICATION_READY;
break;
case HOST_USER_CONNECTION:
Appli_state = APPLICATION_START;
break;
default:
break;
}
}
void Toggle_Leds(void) {
static uint32_t ticks;
if (ticks++ == 1000000) {
GPIOA->ODR ^= GPIO_ODR_OD6;
GPIOA->ODR ^= GPIO_ODR_OD7;
ticks = 0;
}
}
static void SystemClock_Config(void)
{
/* Enable Power Control clock */
__HAL_RCC_PWR_CLK_ENABLE();
/* Enable HSE Oscillator and activate PLL with HSE as source */
RCC_OscInitTypeDef foo = {
.OscillatorType = RCC_OSCILLATORTYPE_HSE,
.HSEState = RCC_HSE_ON,
.PLL.PLLState = RCC_PLL_ON,
.PLL.PLLSource = RCC_PLLSOURCE_HSE,
/* HSE input: 8MHz */
.PLL.PLLM = 8, /* VCO in: 1MHz = 8MHz / 8 */
.PLL.PLLN = 336, /* VCO out: 336MHz = 1MHz * 336 */
.PLL.PLLP = RCC_PLLP_DIV2, /* System: 168MHz = 336Mhz / 2 */
.PLL.PLLQ = 7 /* USB: 48MHz = 336MHz / 7 */
};
if (HAL_RCC_OscConfig(&foo) != HAL_OK)
Error_Handler();
/* FIXME does this require configuration?
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CK48;
PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
*/
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
clocks dividers */
RCC_ClkInitTypeDef bar = {
.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2),
.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK, /* See above */
.AHBCLKDivider = RCC_SYSCLK_DIV1, /* 168MHz = 168MHz / 1 */
.APB1CLKDivider = RCC_HCLK_DIV4, /* 42MHz = 168MHz / 4 */
.APB2CLKDivider = RCC_HCLK_DIV2 /* 84Mhz = 168MHz / 2 */
};
if (HAL_RCC_ClockConfig(&bar, FLASH_LATENCY_5) != HAL_OK)
Error_Handler();
}
void HAL_Delay(__IO uint32_t Delay)
{
while (Delay) {
if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk)
Delay--;
}
}
static void Error_Handler(void)
{
while (1)
;
}
void _init(void) {}

97
main.h
View file

@ -1,97 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Inc/main.h
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#ifndef __MAIN_H
#define __MAIN_H
#include "usbh_core.h"
#include "usbh_hid.h"
#include "usbh_hid_parser.h"
#include "stdio.h"
typedef enum {
HID_DEMO_START = 0,
HID_DEMO_KEYBOARD,
} HID_Demo_State;
typedef enum {
HID_KEYBOARD_IDLE = 0,
HID_KEYBOARD_WAIT,
HID_KEYBOARD_START,
} HID_keyboard_State;
typedef struct _DemoStateMachine {
__IO HID_Demo_State state;
__IO HID_keyboard_State keyboard_state;
__IO uint8_t select;
__IO uint8_t lock;
} HID_DEMO_StateMachine;
typedef enum {
APPLICATION_IDLE = 0,
APPLICATION_DISCONNECT,
APPLICATION_START,
APPLICATION_READY,
APPLICATION_RUNNING,
} HID_ApplicationTypeDef;
extern USBH_HandleTypeDef hUSBHost;
extern HID_ApplicationTypeDef Appli_state;
extern HID_DEMO_StateMachine hid_demo;
extern USART_HandleTypeDef console_uart;
void Toggle_Leds(void);
void HID_SelectItem(uint8_t** menu, uint8_t item);
void HID_MenuInit(void);
void HID_MenuProcess(void);
void HID_KeyboardMenuProcess(void);
void USR_KEYBRD_ProcessData(uint8_t data);
void uart_print(char *s);
void uart_putc(char c);
#endif

View file

@ -1,129 +0,0 @@
import re
from collections import defaultdict, namedtuple
Section = namedtuple('Section', ['name', 'offset', 'objects'])
ObjectEntry = namedtuple('ObjectEntry', ['filename', 'object', 'offset', 'size'])
FileEntry = namedtuple('FileEntry', ['section', 'object', 'offset', 'length'])
class Memory:
def __init__(self, name, origin, length, attrs=''):
self.name, self.origin, self.length, self.attrs = name, origin, length, attrs
self.sections = {}
self.files = defaultdict(lambda: [])
self.totals = defaultdict(lambda: 0)
def add_toplevel(self, name, offx, length):
self.sections[name] = Section(offx, length, [])
def add_obj(self, name, offx, length, fn, obj):
base_section, sep, subsec = name[1:].partition('.')
base_section = '.'+base_section
if base_section in self.sections:
sec = secname, secoffx, secobjs = self.sections[base_section]
secobjs.append(ObjectEntry(fn, obj, offx, length))
else:
sec = None
self.files[fn].append(FileEntry(sec, obj, offx, length))
self.totals[fn] += length
class MapFile:
def __init__(self, s):
self._lines = s.splitlines()
self.memcfg = {}
self.defaultmem = Memory('default', 0, 0xffffffffffffffff)
self._parse()
def __getitem__(self, offx_or_name):
''' Lookup a memory area by name or address '''
if offx_or_name in self.memcfg:
return self.memcfg[offx_or_name]
elif isinstance(offx_or_name, int):
for mem in self.memcfg.values():
if mem.origin <= offx_or_name < mem.origin+mem.length:
return mem
else:
return self.defaultmem
raise ValueError('Invalid argument type for indexing')
def _skip(self, regex):
matcher = re.compile(regex)
for l in self:
if matcher.match(l):
break
def __iter__(self):
while self._lines:
yield self._lines.pop(0)
def _parse(self):
self._skip('^Memory Configuration')
# Parse memory segmentation info
self._skip('^Name')
for l in self:
if not l:
break
name, origin, length, *attrs = l.split()
if not name.startswith('*'):
self.memcfg[name] = Memory(name, int(origin, 16), int(length, 16), attrs[0] if attrs else '')
# Parse section information
toplevel_m = re.compile('^(\.[a-zA-Z0-9_.]+)\s+(0x[0-9a-fA-F]+)\s+(0x[0-9a-fA-F]+)')
secondlevel_m = re.compile('^ (\.[a-zA-Z0-9_.]+)\s+(0x[0-9a-fA-F]+)\s+(0x[0-9a-fA-F]+)\s+(.*)$')
secondlevel_linebreak_m = re.compile('^ (\.[a-zA-Z0-9_.]+)\n')
filelike = re.compile('^(/?[^()]*\.[a-zA-Z0-9-_]+)(\(.*\))?')
linebreak_section = None
for l in self:
# Toplevel section
match = toplevel_m.match(l)
if match:
name, offx, length = match.groups()
offx, length = int(offx, 16), int(length, 16)
self[offx].add_toplevel(name, offx, length)
match = secondlevel_linebreak_m.match(l)
if match:
linebreak_section, = match.groups()
continue
if linebreak_section:
l = ' {} {}'.format(linebreak_section, l)
linebreak_section = None
# Second-level section
match = secondlevel_m.match(l)
if match:
name, offx, length, misc = match.groups()
match = filelike.match(misc)
if match:
fn, obj = match.groups()
obj = obj.strip('()') if obj else None
offx, length = int(offx, 16), int(length, 16)
self[offx].add_obj(name, offx, length, fn, obj)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Parser GCC map file')
parser.add_argument('mapfile', type=argparse.FileType('r'), help='The GCC .map file to parse')
parser.add_argument('-m', '--memory', type=str, help='The memory segments to print, comma-separated')
args = parser.parse_args()
mf = MapFile(args.mapfile.read())
args.mapfile.close()
mems = args.memory.split(',') if args.memory else mf.memcfg.keys()
for name in mems:
mem = mf.memcfg[name]
print('Symbols by file for memory', name)
for tot, fn in reversed(sorted( (tot, fn) for fn, tot in mem.totals.items() )):
print(' {:>8} {}'.format(tot, fn))
for length, offx, sec, obj in reversed(sorted(( (length, offx, sec, obj) for sec, obj, offx, length in
mem.files[fn] ), key=lambda e: e[0] )):
name = sec.name if sec else None
print(' {:>8} {:>#08x} {}'.format(length, offx, obj))
#print('{:>16} 0x{:016x} 0x{:016x} ({:>24}) {}'.format(name, origin, length, length, attrs))

View file

@ -1,25 +0,0 @@
#!/usr/bin/env python3
from matplotlib import pyplot as plt
f, ax = plt.subplots(1, figsize=(3, 8))
bar_width = 1
ax.bar([-bar_width/2], top, bottom=bottom, width=bar_width, label='foo')
ax.set_xticks([0], [filename])
ax.set_ylabel('Memory usage (B)')
ax.set_xlabel('')
ax.set_xlim([-bar_width/2, bar_width/2])
ax.set_ylim([0, mem_max])
if __name__ == '__main__':
import argparse
import mapparse
parser = argparse.ArgumentParser(description='Visualize program memory usage using GCC map file')
parser.add_argument('mapfile', type=argparse.FileType('r'), description='Input GCC .map file')
args = parser.parse_args()
mapping = mapparse.MapFile(args.mapfile.read())
mapping.

110
menu.c
View file

@ -1,110 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Src/menu.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief This file implements Menu Functions
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
HID_DEMO_StateMachine hid_demo;
static void USBH_KeybdDemo(USBH_HandleTypeDef* phost);
void HID_MenuInit(void)
{
uart_print("Starting HID Demo");
hid_demo.state = HID_DEMO_START;
HID_MenuProcess();
}
void HID_MenuProcess(void)
{
switch (hid_demo.state) {
case HID_DEMO_START:
if (Appli_state == APPLICATION_READY) {
if (USBH_HID_GetDeviceType(&hUSBHost) == HID_KEYBOARD) {
hid_demo.keyboard_state = HID_KEYBOARD_IDLE;
hid_demo.state = HID_DEMO_KEYBOARD;
uart_print("HID initialized");
HID_KeyboardMenuProcess();
} else {
uart_print("Unsupported HID device!\n");
hid_demo.state = HID_DEMO_START;
}
}
break;
case HID_DEMO_KEYBOARD:
if (Appli_state == APPLICATION_READY) {
USBH_KeybdDemo(&hUSBHost);
}
break;
default:
break;
}
if (Appli_state == APPLICATION_DISCONNECT) {
Appli_state = APPLICATION_IDLE;
uart_print("HID device disconnected\n");
hid_demo.state = HID_DEMO_START;
hid_demo.select = 0;
}
}
static void USBH_KeybdDemo(USBH_HandleTypeDef* phost)
{
HID_KEYBD_Info_TypeDef* k_pinfo;
char c;
k_pinfo = USBH_HID_GetKeybdInfo(phost);
if (k_pinfo != NULL) {
c = USBH_HID_GetASCIICode(k_pinfo);
if (c != 0) {
USR_KEYBRD_ProcessData(c);
}
}
}

View file

@ -1,14 +0,0 @@
telnet_port 4444
gdb_port 3333
interface jlink
adapter_khz 1000
transport select swd
source /usr/share/openocd/scripts/target/stm32f4x.cfg
init
#arm semihosting enable
#flash bank sysflash.alias stm32f0x 0x00000000 0 0 0 $_TARGETNAME

3
pcb/components.bck Normal file
View file

@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library

3
pcb/components.dcm Normal file
View file

@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library

44
pcb/components.lib Normal file
View file

@ -0,0 +1,44 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# FE1.1s
#
DEF FE1.1s U 0 40 Y Y 1 F N
F0 "U" -750 650 50 H V C CNN
F1 "FE1.1s" 550 650 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
S -800 600 800 -700 0 1 0 f
X VSS 1 1000 -300 200 L 50 50 1 1 I
X DM1 10 -400 -900 200 U 50 50 1 1 I
X DP1 11 -500 -900 200 U 50 50 1 1 I
X VD18_O 12 1000 0 200 L 50 50 1 1 I
X VD33 13 1000 100 200 L 50 50 1 1 I
X REXT 14 -1000 100 200 R 50 50 1 1 I
X DMU 15 100 800 200 D 50 50 1 1 I
X DPU 16 0 800 200 D 50 50 1 1 I
X XRSTJ 17 -1000 -500 200 R 50 50 1 1 I
X VBUSM 18 1000 400 200 L 50 50 1 1 I
X BUSJ 19 -1000 -400 200 R 50 50 1 1 I
X XOUT 2 -1000 400 200 R 50 50 1 1 I
X VDD5 20 1000 300 200 L 50 50 1 1 I
X VDD33_O 21 1000 200 200 L 50 50 1 1 I
X DRV 22 -200 800 200 D 50 50 1 1 I
X LED1 23 -300 800 200 D 50 50 1 1 I
X LED2 24 -400 800 200 D 50 50 1 1 I
X PWRJ 25 -1000 -300 200 R 50 50 1 1 I
X OVCJ 26 -1000 -200 200 R 50 50 1 1 I
X TESTJ 27 -1000 -100 200 R 50 50 1 1 I
X VD18 28 1000 -100 200 L 50 50 1 1 I
X XIN 3 -1000 300 200 R 50 50 1 1 I
X DM4 4 500 -900 200 U 50 50 1 1 I
X DP4 5 400 -900 200 U 50 50 1 1 I
X DM3 6 200 -900 200 U 50 50 1 1 I
X DP3 7 100 -900 200 U 50 50 1 1 I
X DM2 8 -100 -900 200 U 50 50 1 1 I
X DP2 9 -200 -900 200 U 50 50 1 1 I
ENDDRAW
ENDDEF
#
#End Library

732
pcb/securehid-cache.lib Normal file
View file

@ -0,0 +1,732 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Connector_Generic_Conn_01x04
#
DEF Connector_Generic_Conn_01x04 J 0 40 Y N 1 F N
F0 "J" 0 200 50 H V C CNN
F1 "Connector_Generic_Conn_01x04" 0 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_1x??_*
$ENDFPLIST
DRAW
S -50 -195 0 -205 1 1 6 N
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 105 0 95 1 1 6 N
S -50 150 50 -250 1 1 10 f
X Pin_1 1 -200 100 150 R 50 50 1 1 P
X Pin_2 2 -200 0 150 R 50 50 1 1 P
X Pin_3 3 -200 -100 150 R 50 50 1 1 P
X Pin_4 4 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_Generic_Conn_02x05_Odd_Even
#
DEF Connector_Generic_Conn_02x05_Odd_Even J 0 40 Y N 1 F N
F0 "J" 50 300 50 H V C CNN
F1 "Connector_Generic_Conn_02x05_Odd_Even" 50 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_2x??_*
$ENDFPLIST
DRAW
S -50 -195 0 -205 1 1 6 N
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 105 0 95 1 1 6 N
S -50 205 0 195 1 1 6 N
S -50 250 150 -250 1 1 10 f
S 150 -195 100 -205 1 1 6 N
S 150 -95 100 -105 1 1 6 N
S 150 5 100 -5 1 1 6 N
S 150 105 100 95 1 1 6 N
S 150 205 100 195 1 1 6 N
X Pin_1 1 -200 200 150 R 50 50 1 1 P
X Pin_10 10 300 -200 150 L 50 50 1 1 P
X Pin_2 2 300 200 150 L 50 50 1 1 P
X Pin_3 3 -200 100 150 R 50 50 1 1 P
X Pin_4 4 300 100 150 L 50 50 1 1 P
X Pin_5 5 -200 0 150 R 50 50 1 1 P
X Pin_6 6 300 0 150 L 50 50 1 1 P
X Pin_7 7 -200 -100 150 R 50 50 1 1 P
X Pin_8 8 300 -100 150 L 50 50 1 1 P
X Pin_9 9 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_USB_B_Micro
#
DEF Connector_USB_B_Micro J 0 40 Y Y 1 F N
F0 "J" -200 450 50 H V L CNN
F1 "Connector_USB_B_Micro" -200 350 50 H V L CNN
F2 "" 150 -50 50 H I C CNN
F3 "" 150 -50 50 H I C CNN
ALIAS USB_B_Mini
$FPLIST
USB*
$ENDFPLIST
DRAW
C -150 85 25 0 1 10 F
C -25 135 15 0 1 10 F
S -200 -300 200 300 0 1 10 f
S -5 -300 5 -270 0 1 0 N
S 10 50 -20 20 0 1 10 F
S 200 -205 170 -195 0 1 0 N
S 200 -105 170 -95 0 1 0 N
S 200 -5 170 5 0 1 0 N
S 200 195 170 205 0 1 0 N
P 2 0 1 10 -75 85 25 85 N
P 4 0 1 10 -125 85 -100 85 -50 135 -25 135 N
P 4 0 1 10 -100 85 -75 85 -50 35 0 35 N
P 4 0 1 10 25 110 25 60 75 85 25 110 F
P 5 0 1 0 -170 220 -70 220 -80 190 -160 190 -170 220 F
P 9 0 1 0 -185 230 -185 220 -175 190 -175 180 -65 180 -65 190 -55 220 -55 230 -185 230 N
X VBUS 1 300 200 100 L 50 50 1 1 w
X D- 2 300 -100 100 L 50 50 1 1 P
X D+ 3 300 0 100 L 50 50 1 1 P
X ID 4 300 -200 100 L 50 50 1 1 P
X GND 5 0 -400 100 U 50 50 1 1 w
X Shield 6 -100 -400 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# MCU_ST_STM32F1_STM32F103C8Tx
#
DEF MCU_ST_STM32F1_STM32F103C8Tx U 0 20 Y Y 1 F N
F0 "U" -600 1450 50 H V L CNN
F1 "MCU_ST_STM32F1_STM32F103C8Tx" 300 1450 50 H V L CNN
F2 "Package_QFP:LQFP-48_7x7mm_P0.5mm" -600 -1400 50 H I R CNN
F3 "" 0 0 50 H I C CNN
ALIAS STM32F103CBTx
$FPLIST
LQFP*7x7mm*P0.5mm*
$ENDFPLIST
DRAW
S -600 -1400 500 1400 0 1 10 f
X VBAT 1 -200 1500 100 D 50 50 1 1 W
X PA0 10 600 200 100 L 50 50 1 1 B
X PA1 11 600 100 100 L 50 50 1 1 B
X PA2 12 600 0 100 L 50 50 1 1 B
X PA3 13 600 -100 100 L 50 50 1 1 B
X PA4 14 600 -200 100 L 50 50 1 1 B
X PA5 15 600 -300 100 L 50 50 1 1 B
X PA6 16 600 -400 100 L 50 50 1 1 B
X PA7 17 600 -500 100 L 50 50 1 1 B
X PB0 18 -700 200 100 R 50 50 1 1 B
X PB1 19 -700 100 100 R 50 50 1 1 B
X PC13 2 -700 600 100 R 50 50 1 1 B
X PB2 20 -700 0 100 R 50 50 1 1 B
X PB10 21 -700 -800 100 R 50 50 1 1 B
X PB11 22 -700 -900 100 R 50 50 1 1 B
X VSS 23 -200 -1500 100 U 50 50 1 1 W
X VDD 24 -100 1500 100 D 50 50 1 1 W
X PB12 25 -700 -1000 100 R 50 50 1 1 B
X PB13 26 -700 -1100 100 R 50 50 1 1 B
X PB14 27 -700 -1200 100 R 50 50 1 1 B
X PB15 28 -700 -1300 100 R 50 50 1 1 B
X PA8 29 600 -600 100 L 50 50 1 1 B
X PC14 3 -700 500 100 R 50 50 1 1 B
X PA9 30 600 -700 100 L 50 50 1 1 B
X PA10 31 600 -800 100 L 50 50 1 1 B
X PA11 32 600 -900 100 L 50 50 1 1 B
X PA12 33 600 -1000 100 L 50 50 1 1 B
X PA13 34 600 -1100 100 L 50 50 1 1 B
X VSS 35 -100 -1500 100 U 50 50 1 1 W
X VDD 36 0 1500 100 D 50 50 1 1 W
X PA14 37 600 -1200 100 L 50 50 1 1 B
X PA15 38 600 -1300 100 L 50 50 1 1 B
X PB3 39 -700 -100 100 R 50 50 1 1 B
X PC15 4 -700 400 100 R 50 50 1 1 B
X PB4 40 -700 -200 100 R 50 50 1 1 B
X PB5 41 -700 -300 100 R 50 50 1 1 B
X PB6 42 -700 -400 100 R 50 50 1 1 B
X PB7 43 -700 -500 100 R 50 50 1 1 B
X BOOT0 44 -700 1100 100 R 50 50 1 1 I
X PB8 45 -700 -600 100 R 50 50 1 1 B
X PB9 46 -700 -700 100 R 50 50 1 1 B
X VSS 47 0 -1500 100 U 50 50 1 1 W
X VDD 48 100 1500 100 D 50 50 1 1 W
X PD0 5 -700 900 100 R 50 50 1 1 I
X PD1 6 -700 800 100 R 50 50 1 1 I
X NRST 7 -700 1300 100 R 50 50 1 1 I
X VSSA 8 100 -1500 100 U 50 50 1 1 W
X VDDA 9 200 1500 100 D 50 50 1 1 W
ENDDRAW
ENDDEF
#
# MCU_ST_STM32F4_STM32F407VETx
#
DEF MCU_ST_STM32F4_STM32F407VETx U 0 20 Y Y 1 F N
F0 "U" -700 2550 50 H V L CNN
F1 "MCU_ST_STM32F4_STM32F407VETx" 500 2550 50 H V L CNN
F2 "Package_QFP:LQFP-100_14x14mm_P0.5mm" -700 -2600 50 H I R CNN
F3 "" 0 0 50 H I C CNN
ALIAS STM32F407VGTx
$FPLIST
LQFP*14x14mm*P0.5mm*
$ENDFPLIST
DRAW
S -700 -2600 700 2500 0 1 10 f
X PE2 1 -900 500 200 R 50 50 1 1 B
X VSS 10 -200 -2800 200 U 50 50 1 1 W
X VDD 100 300 2700 200 D 50 50 1 1 W
X VDD 11 -200 2700 200 D 50 50 1 1 W
X PH0 12 -900 1000 200 R 50 50 1 1 I
X PH1 13 -900 900 200 R 50 50 1 1 I
X NRST 14 -900 2400 200 R 50 50 1 1 I
X PC0 15 900 -1000 200 L 50 50 1 1 B
X PC1 16 900 -1100 200 L 50 50 1 1 B
X PC2 17 900 -1200 200 L 50 50 1 1 B
X PC3 18 900 -1300 200 L 50 50 1 1 B
X VDD 19 -100 2700 200 D 50 50 1 1 W
X PE3 2 -900 400 200 R 50 50 1 1 B
X VSSA 20 200 -2800 200 U 50 50 1 1 W
X VREF+ 21 -900 1800 200 R 50 50 1 1 W
X VDDA 22 400 2700 200 D 50 50 1 1 W
X PA0 23 900 2400 200 L 50 50 1 1 B
X PA1 24 900 2300 200 L 50 50 1 1 B
X PA2 25 900 2200 200 L 50 50 1 1 B
X PA3 26 900 2100 200 L 50 50 1 1 B
X VSS 27 -100 -2800 200 U 50 50 1 1 W
X VDD 28 0 2700 200 D 50 50 1 1 W
X PA4 29 900 2000 200 L 50 50 1 1 B
X PE4 3 -900 300 200 R 50 50 1 1 B
X PA5 30 900 1900 200 L 50 50 1 1 B
X PA6 31 900 1800 200 L 50 50 1 1 B
X PA7 32 900 1700 200 L 50 50 1 1 B
X PC4 33 900 -1400 200 L 50 50 1 1 B
X PC5 34 900 -1500 200 L 50 50 1 1 B
X PB0 35 900 700 200 L 50 50 1 1 B
X PB1 36 900 600 200 L 50 50 1 1 B
X PB2 37 900 500 200 L 50 50 1 1 B
X PE7 38 -900 0 200 R 50 50 1 1 B
X PE8 39 -900 -100 200 R 50 50 1 1 B
X PE5 4 -900 200 200 R 50 50 1 1 B
X PE9 40 -900 -200 200 R 50 50 1 1 B
X PE10 41 -900 -300 200 R 50 50 1 1 B
X PE11 42 -900 -400 200 R 50 50 1 1 B
X PE12 43 -900 -500 200 R 50 50 1 1 B
X PE13 44 -900 -600 200 R 50 50 1 1 B
X PE14 45 -900 -700 200 R 50 50 1 1 B
X PE15 46 -900 -800 200 R 50 50 1 1 B
X PB10 47 900 -300 200 L 50 50 1 1 B
X PB11 48 900 -400 200 L 50 50 1 1 B
X VCAP_1 49 -900 2000 200 R 50 50 1 1 W
X PE6 5 -900 100 200 R 50 50 1 1 B
X VDD 50 100 2700 200 D 50 50 1 1 W
X PB12 51 900 -500 200 L 50 50 1 1 B
X PB13 52 900 -600 200 L 50 50 1 1 B
X PB14 53 900 -700 200 L 50 50 1 1 B
X PB15 54 900 -800 200 L 50 50 1 1 B
X PD8 55 -900 -1800 200 R 50 50 1 1 B
X PD9 56 -900 -1900 200 R 50 50 1 1 B
X PD10 57 -900 -2000 200 R 50 50 1 1 B
X PD11 58 -900 -2100 200 R 50 50 1 1 B
X PD12 59 -900 -2200 200 R 50 50 1 1 B
X VBAT 6 -300 2700 200 D 50 50 1 1 W
X PD13 60 -900 -2300 200 R 50 50 1 1 B
X PD14 61 -900 -2400 200 R 50 50 1 1 B
X PD15 62 -900 -2500 200 R 50 50 1 1 B
X PC6 63 900 -1600 200 L 50 50 1 1 B
X PC7 64 900 -1700 200 L 50 50 1 1 B
X PC8 65 900 -1800 200 L 50 50 1 1 B
X PC9 66 900 -1900 200 L 50 50 1 1 B
X PA8 67 900 1600 200 L 50 50 1 1 B
X PA9 68 900 1500 200 L 50 50 1 1 B
X PA10 69 900 1400 200 L 50 50 1 1 B
X PC13 7 900 -2300 200 L 50 50 1 1 B
X PA11 70 900 1300 200 L 50 50 1 1 B
X PA12 71 900 1200 200 L 50 50 1 1 B
X PA13 72 900 1100 200 L 50 50 1 1 B
X VCAP_2 73 -900 1900 200 R 50 50 1 1 W
X VSS 74 0 -2800 200 U 50 50 1 1 W
X VDD 75 200 2700 200 D 50 50 1 1 W
X PA14 76 900 1000 200 L 50 50 1 1 B
X PA15 77 900 900 200 L 50 50 1 1 B
X PC10 78 900 -2000 200 L 50 50 1 1 B
X PC11 79 900 -2100 200 L 50 50 1 1 B
X PC14 8 900 -2400 200 L 50 50 1 1 B
X PC12 80 900 -2200 200 L 50 50 1 1 B
X PD0 81 -900 -1000 200 R 50 50 1 1 B
X PD1 82 -900 -1100 200 R 50 50 1 1 B
X PD2 83 -900 -1200 200 R 50 50 1 1 B
X PD3 84 -900 -1300 200 R 50 50 1 1 B
X PD4 85 -900 -1400 200 R 50 50 1 1 B
X PD5 86 -900 -1500 200 R 50 50 1 1 B
X PD6 87 -900 -1600 200 R 50 50 1 1 B
X PD7 88 -900 -1700 200 R 50 50 1 1 B
X PB3 89 900 400 200 L 50 50 1 1 B
X PC15 9 900 -2500 200 L 50 50 1 1 B
X PB4 90 900 300 200 L 50 50 1 1 B
X PB5 91 900 200 200 L 50 50 1 1 B
X PB6 92 900 100 200 L 50 50 1 1 B
X PB7 93 900 0 200 L 50 50 1 1 B
X BOOT0 94 -900 2200 200 R 50 50 1 1 I
X PB8 95 900 -100 200 L 50 50 1 1 B
X PB9 96 900 -200 200 L 50 50 1 1 B
X PE0 97 -900 700 200 R 50 50 1 1 B
X PE1 98 -900 600 200 R 50 50 1 1 B
X VSS 99 100 -2800 200 U 50 50 1 1 W
ENDDRAW
ENDDEF
#
# components_FE1.1s
#
DEF components_FE1.1s U 0 40 Y Y 1 F N
F0 "U" -750 650 50 H V C CNN
F1 "components_FE1.1s" 550 650 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
S -800 600 800 -700 0 1 0 f
X VSS 1 1000 -300 200 L 50 50 1 1 I
X DM1 10 -400 -900 200 U 50 50 1 1 I
X DP1 11 -500 -900 200 U 50 50 1 1 I
X VD18_O 12 1000 0 200 L 50 50 1 1 I
X VD33 13 1000 100 200 L 50 50 1 1 I
X REXT 14 -1000 100 200 R 50 50 1 1 I
X DMU 15 100 800 200 D 50 50 1 1 I
X DPU 16 0 800 200 D 50 50 1 1 I
X XRSTJ 17 -1000 -500 200 R 50 50 1 1 I
X VBUSM 18 1000 400 200 L 50 50 1 1 I
X BUSJ 19 -1000 -400 200 R 50 50 1 1 I
X XOUT 2 -1000 400 200 R 50 50 1 1 I
X VDD5 20 1000 300 200 L 50 50 1 1 I
X VDD33_O 21 1000 200 200 L 50 50 1 1 I
X DRV 22 -200 800 200 D 50 50 1 1 I
X LED1 23 -300 800 200 D 50 50 1 1 I
X LED2 24 -400 800 200 D 50 50 1 1 I
X PWRJ 25 -1000 -300 200 R 50 50 1 1 I
X OVCJ 26 -1000 -200 200 R 50 50 1 1 I
X TESTJ 27 -1000 -100 200 R 50 50 1 1 I
X VD18 28 1000 -100 200 L 50 50 1 1 I
X XIN 3 -1000 300 200 R 50 50 1 1 I
X DM4 4 500 -900 200 U 50 50 1 1 I
X DP4 5 400 -900 200 U 50 50 1 1 I
X DM3 6 200 -900 200 U 50 50 1 1 I
X DP3 7 100 -900 200 U 50 50 1 1 I
X DM2 8 -100 -900 200 U 50 50 1 1 I
X DP2 9 -200 -900 200 U 50 50 1 1 I
ENDDRAW
ENDDEF
#
# conn_USB_A
#
DEF conn_USB_A J 0 40 Y Y 1 F N
F0 "J" -200 450 50 H V L CNN
F1 "conn_USB_A" -200 350 50 H V L CNN
F2 "" 150 -50 50 H I C CNN
F3 "" 150 -50 50 H I C CNN
$FPLIST
USB*
$ENDFPLIST
DRAW
C -150 85 25 0 1 10 F
C -25 135 15 0 1 10 F
S -200 -300 200 300 0 1 10 f
S -60 190 -170 210 0 1 0 F
S -50 180 -180 230 0 1 0 N
S -5 -300 5 -270 0 1 0 N
S 10 50 -20 20 0 1 10 F
S 200 -105 170 -95 0 1 0 N
S 200 -5 170 5 0 1 0 N
S 200 195 170 205 0 1 0 N
P 4 0 1 10 -125 85 -100 85 -50 135 -25 135 N
P 4 0 1 10 -100 85 -75 85 -50 35 0 35 N
P 4 0 1 10 25 110 25 60 75 85 25 110 F
P 2 1 1 10 -75 85 25 85 N
X VBUS 1 300 200 100 L 50 50 1 1 W
X D- 2 300 -100 100 L 50 50 1 1 P
X D+ 3 300 0 100 L 50 50 1 1 P
X GND 4 0 -400 100 U 50 50 1 1 W
X Shield 5 -100 -400 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_Battery_Cell
#
DEF device_Battery_Cell BT 0 0 N N 1 F N
F0 "BT" 100 100 50 H V L CNN
F1 "device_Battery_Cell" 100 0 50 H V L CNN
F2 "" 0 60 50 V I C CNN
F3 "" 0 60 50 V I C CNN
DRAW
S -90 70 90 60 0 1 0 F
S -62 47 58 27 0 1 0 F
P 2 0 1 0 0 30 0 0 N
P 2 0 1 0 0 70 0 100 N
P 2 0 1 10 20 135 60 135 N
P 2 0 1 10 40 155 40 115 N
X + 1 0 200 100 D 50 50 1 1 P
X - 2 0 -100 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_C
#
DEF device_C C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "device_C" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C_*
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_CP
#
DEF device_CP C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "device_CP" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
CP_*
$ENDFPLIST
DRAW
S -90 20 -90 40 0 1 0 N
S -90 20 90 20 0 1 0 N
S 90 -20 -90 -40 0 1 0 F
S 90 40 -90 40 0 1 0 N
S 90 40 90 20 0 1 0 N
P 2 0 1 0 -70 90 -30 90 N
P 2 0 1 0 -50 110 -50 70 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_CP_Small
#
DEF device_CP_Small C 0 10 N N 1 F N
F0 "C" 10 70 50 H V L CNN
F1 "device_CP_Small" 10 -80 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
CP_*
$ENDFPLIST
DRAW
S -60 -12 60 -27 0 1 0 F
S -60 27 60 12 0 1 0 N
P 2 0 1 0 -50 60 -30 60 N
P 2 0 1 0 -40 50 -40 70 N
X ~ 1 0 100 73 D 50 50 1 1 P
X ~ 2 0 -100 73 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_C_Small
#
DEF device_C_Small C 0 10 N N 1 F N
F0 "C" 10 70 50 H V L CNN
F1 "device_C_Small" 10 -80 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C_*
$ENDFPLIST
DRAW
P 2 0 1 13 -60 -20 60 -20 N
P 2 0 1 12 -60 20 60 20 N
X ~ 1 0 100 80 D 50 50 1 1 P
X ~ 2 0 -100 80 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_Crystal_GND24_Small
#
DEF device_Crystal_GND24_Small Y 0 40 Y N 1 F N
F0 "Y" 50 175 50 H V L CNN
F1 "device_Crystal_GND24_Small" 50 100 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Crystal*
$ENDFPLIST
DRAW
S -30 -60 30 60 0 1 0 N
P 2 0 1 15 -50 -30 -50 30 N
P 2 0 1 15 50 -30 50 30 N
P 4 0 1 0 -50 -50 -50 -75 50 -75 50 -50 N
P 4 0 1 0 -50 50 -50 75 50 75 50 50 N
X 1 1 -100 0 50 R 50 50 1 1 P
X 2 2 0 -125 50 U 50 50 1 1 P
X 3 3 100 0 50 L 50 50 1 1 P
X 4 4 0 125 50 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_LED
#
DEF device_LED D 0 40 Y N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "device_LED" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
LED*
$ENDFPLIST
DRAW
P 2 0 1 8 -50 -50 -50 50 N
P 2 0 1 0 -50 0 50 0 N
P 4 0 1 8 50 -50 50 50 -50 0 50 -50 N
P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N
P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_LED_Small
#
DEF device_LED_Small D 0 10 N N 1 F N
F0 "D" -50 125 50 H V L CNN
F1 "device_LED_Small" -175 -100 50 H V L CNN
F2 "" 0 0 50 V I C CNN
F3 "" 0 0 50 V I C CNN
$FPLIST
LED-*
LED_*
$ENDFPLIST
DRAW
P 2 0 1 0 -30 -40 -30 40 N
P 2 0 1 0 40 0 -30 0 N
P 4 0 1 0 30 -40 -30 0 30 40 30 -40 N
P 5 0 1 0 0 30 -20 50 -10 50 -20 50 -20 40 N
P 5 0 1 0 20 50 0 70 10 70 0 70 0 60 N
X K 1 -100 0 70 R 50 50 1 1 P
X A 2 100 0 70 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_R_Pack04
#
DEF device_R_Pack04 RN 0 0 Y N 1 F N
F0 "RN" -300 0 50 V V C CNN
F1 "device_R_Pack04" 200 0 50 V V C CNN
F2 "" 275 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
DIP*
SOIC*
$ENDFPLIST
DRAW
S -250 -95 150 95 0 1 10 f
S -225 75 -175 -75 0 1 10 N
S -125 75 -75 -75 0 1 10 N
S -25 75 25 -75 0 1 10 N
S 75 75 125 -75 0 1 10 N
P 2 0 1 0 -200 -100 -200 -75 N
P 2 0 1 0 -200 75 -200 100 N
P 2 0 1 0 -100 -100 -100 -75 N
P 2 0 1 0 -100 75 -100 100 N
P 2 0 1 0 0 -100 0 -75 N
P 2 0 1 0 0 75 0 100 N
P 2 0 1 0 100 -100 100 -75 N
P 2 0 1 0 100 75 100 100 N
X R1.1 1 -200 -200 100 U 50 50 1 1 P
X R2.1 2 -100 -200 100 U 50 50 1 1 P
X R3.1 3 0 -200 100 U 50 50 1 1 P
X R4.1 4 100 -200 100 U 50 50 1 1 P
X R4.2 5 100 200 100 D 50 50 1 1 P
X R3.2 6 0 200 100 D 50 50 1 1 P
X R2.2 7 -100 200 100 D 50 50 1 1 P
X R1.2 8 -200 200 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_R_Small
#
DEF device_R_Small R 0 10 N N 1 F N
F0 "R" 30 20 50 H V L CNN
F1 "device_R_Small" 30 -40 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -30 70 30 -70 0 1 8 N
X ~ 1 0 100 30 D 50 50 1 1 P
X ~ 2 0 -100 30 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# device_Speaker_Crystal
#
DEF device_Speaker_Crystal LS 0 0 Y N 1 F N
F0 "LS" 25 225 50 H V R CNN
F1 "device_Speaker_Crystal" 25 150 50 H V R CNN
F2 "" -35 -50 50 H I C CNN
F3 "" -35 -50 50 H I C CNN
ALIAS Speaker_Ultrasound
DRAW
S -100 50 45 -150 0 0 10 N
S -80 -25 25 -75 0 0 10 N
P 2 0 0 0 -65 -90 15 -90 N
P 2 0 0 0 -65 -10 15 -10 N
P 2 0 0 0 -25 -90 -25 -120 N
P 2 0 0 0 -25 -10 -25 20 N
P 4 0 0 10 45 50 145 150 145 -250 45 -150 N
X 1 1 -200 0 100 R 50 50 1 1 I
X 2 2 -200 -100 100 R 50 50 1 1 I
ENDDRAW
ENDDEF
#
# power_+3.3V
#
DEF power_+3.3V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_+3.3V" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS +3.3V
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +3V3 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_VBUS
#
DEF power_VBUS #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_VBUS" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X VBUS 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_VDDA
#
DEF power_VDDA #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_VDDA" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
C 0 75 25 0 1 0 N
P 2 0 1 0 0 0 0 50 N
X VDDA 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_VSSA
#
DEF power_VSSA #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_VSSA" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
C 0 75 25 0 1 0 N
P 2 0 1 0 0 0 0 50 N
X VSSA 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# regul_AP1117-33
#
DEF regul_AP1117-33 U 0 10 Y Y 1 F N
F0 "U" -150 125 50 H V C CNN
F1 "regul_AP1117-33" 0 125 50 H V L CNN
F2 "TO_SOT_Packages_SMD:SOT-223-3Lead_TabPin2" 0 200 50 H I C CNN
F3 "" 100 -250 50 H I C CNN
ALIAS AP1117-18 AP1117-25 AP1117-33 AP1117-50 LD1117S33TR_SOT223 LD1117S12TR_SOT223 LD1117S18TR_SOT223 LD1117S25TR_SOT223 LD1117S50TR_SOT223 NCP1117-12_SOT223 NCP1117-1.5_SOT223 NCP1117-1.8_SOT223 NCP1117-2.0_SOT223 NCP1117-2.5_SOT223 NCP1117-2.85_SOT223 NCP1117-3.3_SOT223 NCP1117-5.0_SOT223
$FPLIST
SOT?223*TabPin2*
$ENDFPLIST
DRAW
S -200 -200 200 75 0 1 10 f
X GND 1 0 -300 100 U 50 50 1 1 W
X VO 2 300 0 100 L 50 50 1 1 P
X VI 3 -300 0 100 R 50 50 1 1 W
ENDDRAW
ENDDEF
#
# switches_SW_Push
#
DEF switches_SW_Push SW 0 40 N N 1 F N
F0 "SW" 50 100 50 H V L CNN
F1 "switches_SW_Push" 0 -60 50 H V C CNN
F2 "" 0 200 50 H I C CNN
F3 "" 0 200 50 H I C CNN
DRAW
C -80 0 20 0 1 0 N
C 80 0 20 0 1 0 N
P 2 0 1 0 0 50 0 120 N
P 2 0 1 0 100 50 -100 50 N
X 1 1 -200 0 100 R 50 50 0 1 P
X 2 2 200 0 100 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
# transistors_2N7002
#
DEF transistors_2N7002 Q 0 0 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "transistors_2N7002" 200 0 50 H V L CNN
F2 "TO_SOT_Packages_SMD:SOT-23" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
ALIAS 2N7002 MMBF170
$FPLIST
SOT?23*
$ENDFPLIST
DRAW
C 65 0 111 0 1 10 N
C 100 -70 11 0 1 0 F
C 100 70 11 0 1 0 F
P 2 0 1 0 30 -70 100 -70 N
P 2 0 1 10 30 -50 30 -90 N
P 2 0 1 0 30 0 100 0 N
P 2 0 1 10 30 20 30 -20 N
P 2 0 1 0 30 70 100 70 N
P 2 0 1 10 30 90 30 50 N
P 2 0 1 0 100 -70 100 -100 N
P 2 0 1 0 100 -70 100 0 N
P 2 0 1 0 100 100 100 70 N
P 3 0 1 10 10 75 10 -75 10 -75 N
P 4 0 1 0 40 0 80 15 80 -15 40 0 F
P 4 0 1 0 100 -70 130 -70 130 70 100 70 N
P 4 0 1 0 110 20 115 15 145 15 150 10 N
P 4 0 1 0 130 15 115 -10 145 -10 130 15 N
X G 1 -200 0 210 R 50 50 1 1 I
X S 2 100 -200 100 U 50 50 1 1 P
X D 3 100 200 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

2310
pcb/securehid.bak Normal file

File diff suppressed because it is too large Load diff

1
pcb/securehid.kicad_pcb Normal file
View file

@ -0,0 +1 @@
(kicad_pcb (version 4) (host kicad "dummy file") )

30
pcb/securehid.pro Normal file
View file

@ -0,0 +1,30 @@
update=Sat Nov 17 08:52:10 2018
version=1
last_client=kicad
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[general]
version=1
[eeschema]
version=1
LibDir=

2336
pcb/securehid.sch Normal file

File diff suppressed because it is too large Load diff

41
pcb/sym-lib-table Normal file
View file

@ -0,0 +1,41 @@
(sym_lib_table
(lib (name power)(type Legacy)(uri /usr/share/kicad/library/power.lib)(options "")(descr ""))
(lib (name device)(type Legacy)(uri /usr/share/kicad/library/device.lib)(options "")(descr ""))
(lib (name switches)(type Legacy)(uri /usr/share/kicad/library/switches.lib)(options "")(descr ""))
(lib (name relays)(type Legacy)(uri /usr/share/kicad/library/relays.lib)(options "")(descr ""))
(lib (name motors)(type Legacy)(uri /usr/share/kicad/library/motors.lib)(options "")(descr ""))
(lib (name transistors)(type Legacy)(uri /usr/share/kicad/library/transistors.lib)(options "")(descr ""))
(lib (name conn)(type Legacy)(uri /usr/share/kicad/library/conn.lib)(options "")(descr ""))
(lib (name linear)(type Legacy)(uri /usr/share/kicad/library/linear.lib)(options "")(descr ""))
(lib (name regul)(type Legacy)(uri /usr/share/kicad/library/regul.lib)(options "")(descr ""))
(lib (name 74xx)(type Legacy)(uri /usr/share/kicad/library/74xx.lib)(options "")(descr ""))
(lib (name cmos4000)(type Legacy)(uri /usr/share/kicad/library/cmos4000.lib)(options "")(descr ""))
(lib (name adc-dac)(type Legacy)(uri /usr/share/kicad/library/adc-dac.lib)(options "")(descr ""))
(lib (name memory)(type Legacy)(uri /usr/share/kicad/library/memory.lib)(options "")(descr ""))
(lib (name xilinx)(type Legacy)(uri /usr/share/kicad/library/xilinx.lib)(options "")(descr ""))
(lib (name microcontrollers)(type Legacy)(uri /usr/share/kicad/library/microcontrollers.lib)(options "")(descr ""))
(lib (name dsp)(type Legacy)(uri /usr/share/kicad/library/dsp.lib)(options "")(descr ""))
(lib (name microchip)(type Legacy)(uri /usr/share/kicad/library/microchip.lib)(options "")(descr ""))
(lib (name analog_switches)(type Legacy)(uri /usr/share/kicad/library/analog_switches.lib)(options "")(descr ""))
(lib (name motorola)(type Legacy)(uri /usr/share/kicad/library/motorola.lib)(options "")(descr ""))
(lib (name texas)(type Legacy)(uri /usr/share/kicad/library/texas.lib)(options "")(descr ""))
(lib (name intel)(type Legacy)(uri /usr/share/kicad/library/intel.lib)(options "")(descr ""))
(lib (name audio)(type Legacy)(uri /usr/share/kicad/library/audio.lib)(options "")(descr ""))
(lib (name interface)(type Legacy)(uri /usr/share/kicad/library/interface.lib)(options "")(descr ""))
(lib (name digital-audio)(type Legacy)(uri /usr/share/kicad/library/digital-audio.lib)(options "")(descr ""))
(lib (name philips)(type Legacy)(uri /usr/share/kicad/library/philips.lib)(options "")(descr ""))
(lib (name display)(type Legacy)(uri /usr/share/kicad/library/display.lib)(options "")(descr ""))
(lib (name cypress)(type Legacy)(uri /usr/share/kicad/library/cypress.lib)(options "")(descr ""))
(lib (name siliconi)(type Legacy)(uri /usr/share/kicad/library/siliconi.lib)(options "")(descr ""))
(lib (name opto)(type Legacy)(uri /usr/share/kicad/library/opto.lib)(options "")(descr ""))
(lib (name atmel)(type Legacy)(uri /usr/share/kicad/library/atmel.lib)(options "")(descr ""))
(lib (name contrib)(type Legacy)(uri /usr/share/kicad/library/contrib.lib)(options "")(descr ""))
(lib (name valves)(type Legacy)(uri /usr/share/kicad/library/valves.lib)(options "")(descr ""))
(lib (name MCU_ST_STM32F4)(type Legacy)(uri /home/user/ref/kicad-symbols/MCU_ST_STM32F4.lib)(options "")(descr ""))
(lib (name MCU_ST_STM32F1)(type Legacy)(uri /home/user/ref/kicad-symbols/MCU_ST_STM32F1.lib)(options "")(descr ""))
(lib (name Connector)(type Legacy)(uri /home/user/ref/kicad-symbols/Connector.lib)(options "")(descr ""))
(lib (name Connector_Generic)(type Legacy)(uri /home/user/ref/kicad-symbols/Connector_Generic.lib)(options "")(descr ""))
(lib (name Connector_Generic_MountingPin)(type Legacy)(uri /home/user/ref/kicad-symbols/Connector_Generic_MountingPin.lib)(options "")(descr ""))
(lib (name Connector_Generic_Shielded)(type Legacy)(uri /home/user/ref/kicad-symbols/Connector_Generic_Shielded.lib)(options "")(descr ""))
(lib (name components)(type Legacy)(uri /home/user/research/secureHID/pcb/components.lib)(options "")(descr ""))
)

View file

@ -1,523 +0,0 @@
/**
******************************************************************************
* @file startup_stm32f407xx.s
* @author MCD Application Team
* @version V1.4.4
* @date 17-February-2017
* @brief STM32F407xx Devices vector table for GCC based toolchain.
* This module performs:
* - Set the initial SP
* - Set the initial PC == Reset_Handler,
* - Set the vector table entries with the exceptions ISR address
* - Branches to main in the C library (which eventually
* calls main()).
* After Reset the Cortex-M4 processor is in Thread mode,
* priority is Privileged, and the Stack is set to Main.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
.syntax unified
.cpu cortex-m4
.fpu softvfp
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
ldr sp, =_estack /* set stack pointer */
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2], #4
LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl main
bx lr
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @param None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The minimal vector table for a Cortex M3. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
*******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
/* External Interrupts */
.word WWDG_IRQHandler /* Window WatchDog */
.word PVD_IRQHandler /* PVD through EXTI Line detection */
.word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
.word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
.word FLASH_IRQHandler /* FLASH */
.word RCC_IRQHandler /* RCC */
.word EXTI0_IRQHandler /* EXTI Line0 */
.word EXTI1_IRQHandler /* EXTI Line1 */
.word EXTI2_IRQHandler /* EXTI Line2 */
.word EXTI3_IRQHandler /* EXTI Line3 */
.word EXTI4_IRQHandler /* EXTI Line4 */
.word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
.word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
.word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
.word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
.word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
.word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
.word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
.word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
.word CAN1_TX_IRQHandler /* CAN1 TX */
.word CAN1_RX0_IRQHandler /* CAN1 RX0 */
.word CAN1_RX1_IRQHandler /* CAN1 RX1 */
.word CAN1_SCE_IRQHandler /* CAN1 SCE */
.word EXTI9_5_IRQHandler /* External Line[9:5]s */
.word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
.word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
.word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
.word TIM2_IRQHandler /* TIM2 */
.word TIM3_IRQHandler /* TIM3 */
.word TIM4_IRQHandler /* TIM4 */
.word I2C1_EV_IRQHandler /* I2C1 Event */
.word I2C1_ER_IRQHandler /* I2C1 Error */
.word I2C2_EV_IRQHandler /* I2C2 Event */
.word I2C2_ER_IRQHandler /* I2C2 Error */
.word SPI1_IRQHandler /* SPI1 */
.word SPI2_IRQHandler /* SPI2 */
.word USART1_IRQHandler /* USART1 */
.word USART2_IRQHandler /* USART2 */
.word USART3_IRQHandler /* USART3 */
.word EXTI15_10_IRQHandler /* External Line[15:10]s */
.word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
.word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
.word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */
.word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */
.word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
.word TIM8_CC_IRQHandler /* TIM8 Capture Compare */
.word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
.word FSMC_IRQHandler /* FSMC */
.word SDIO_IRQHandler /* SDIO */
.word TIM5_IRQHandler /* TIM5 */
.word SPI3_IRQHandler /* SPI3 */
.word UART4_IRQHandler /* UART4 */
.word UART5_IRQHandler /* UART5 */
.word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */
.word TIM7_IRQHandler /* TIM7 */
.word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
.word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
.word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
.word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
.word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
.word ETH_IRQHandler /* Ethernet */
.word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */
.word CAN2_TX_IRQHandler /* CAN2 TX */
.word CAN2_RX0_IRQHandler /* CAN2 RX0 */
.word CAN2_RX1_IRQHandler /* CAN2 RX1 */
.word CAN2_SCE_IRQHandler /* CAN2 SCE */
.word OTG_FS_IRQHandler /* USB OTG FS */
.word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
.word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
.word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
.word USART6_IRQHandler /* USART6 */
.word I2C3_EV_IRQHandler /* I2C3 event */
.word I2C3_ER_IRQHandler /* I2C3 error */
.word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */
.word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */
.word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */
.word OTG_HS_IRQHandler /* USB OTG HS */
.word DCMI_IRQHandler /* DCMI */
.word 0 /* CRYP crypto */
.word HASH_RNG_IRQHandler /* Hash and Rng */
.word FPU_IRQHandler /* FPU */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
.weak PVD_IRQHandler
.thumb_set PVD_IRQHandler,Default_Handler
.weak TAMP_STAMP_IRQHandler
.thumb_set TAMP_STAMP_IRQHandler,Default_Handler
.weak RTC_WKUP_IRQHandler
.thumb_set RTC_WKUP_IRQHandler,Default_Handler
.weak FLASH_IRQHandler
.thumb_set FLASH_IRQHandler,Default_Handler
.weak RCC_IRQHandler
.thumb_set RCC_IRQHandler,Default_Handler
.weak EXTI0_IRQHandler
.thumb_set EXTI0_IRQHandler,Default_Handler
.weak EXTI1_IRQHandler
.thumb_set EXTI1_IRQHandler,Default_Handler
.weak EXTI2_IRQHandler
.thumb_set EXTI2_IRQHandler,Default_Handler
.weak EXTI3_IRQHandler
.thumb_set EXTI3_IRQHandler,Default_Handler
.weak EXTI4_IRQHandler
.thumb_set EXTI4_IRQHandler,Default_Handler
.weak DMA1_Stream0_IRQHandler
.thumb_set DMA1_Stream0_IRQHandler,Default_Handler
.weak DMA1_Stream1_IRQHandler
.thumb_set DMA1_Stream1_IRQHandler,Default_Handler
.weak DMA1_Stream2_IRQHandler
.thumb_set DMA1_Stream2_IRQHandler,Default_Handler
.weak DMA1_Stream3_IRQHandler
.thumb_set DMA1_Stream3_IRQHandler,Default_Handler
.weak DMA1_Stream4_IRQHandler
.thumb_set DMA1_Stream4_IRQHandler,Default_Handler
.weak DMA1_Stream5_IRQHandler
.thumb_set DMA1_Stream5_IRQHandler,Default_Handler
.weak DMA1_Stream6_IRQHandler
.thumb_set DMA1_Stream6_IRQHandler,Default_Handler
.weak ADC_IRQHandler
.thumb_set ADC_IRQHandler,Default_Handler
.weak CAN1_TX_IRQHandler
.thumb_set CAN1_TX_IRQHandler,Default_Handler
.weak CAN1_RX0_IRQHandler
.thumb_set CAN1_RX0_IRQHandler,Default_Handler
.weak CAN1_RX1_IRQHandler
.thumb_set CAN1_RX1_IRQHandler,Default_Handler
.weak CAN1_SCE_IRQHandler
.thumb_set CAN1_SCE_IRQHandler,Default_Handler
.weak EXTI9_5_IRQHandler
.thumb_set EXTI9_5_IRQHandler,Default_Handler
.weak TIM1_BRK_TIM9_IRQHandler
.thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
.weak TIM1_UP_TIM10_IRQHandler
.thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
.weak TIM1_TRG_COM_TIM11_IRQHandler
.thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
.weak TIM1_CC_IRQHandler
.thumb_set TIM1_CC_IRQHandler,Default_Handler
.weak TIM2_IRQHandler
.thumb_set TIM2_IRQHandler,Default_Handler
.weak TIM3_IRQHandler
.thumb_set TIM3_IRQHandler,Default_Handler
.weak TIM4_IRQHandler
.thumb_set TIM4_IRQHandler,Default_Handler
.weak I2C1_EV_IRQHandler
.thumb_set I2C1_EV_IRQHandler,Default_Handler
.weak I2C1_ER_IRQHandler
.thumb_set I2C1_ER_IRQHandler,Default_Handler
.weak I2C2_EV_IRQHandler
.thumb_set I2C2_EV_IRQHandler,Default_Handler
.weak I2C2_ER_IRQHandler
.thumb_set I2C2_ER_IRQHandler,Default_Handler
.weak SPI1_IRQHandler
.thumb_set SPI1_IRQHandler,Default_Handler
.weak SPI2_IRQHandler
.thumb_set SPI2_IRQHandler,Default_Handler
.weak USART1_IRQHandler
.thumb_set USART1_IRQHandler,Default_Handler
.weak USART2_IRQHandler
.thumb_set USART2_IRQHandler,Default_Handler
.weak USART3_IRQHandler
.thumb_set USART3_IRQHandler,Default_Handler
.weak EXTI15_10_IRQHandler
.thumb_set EXTI15_10_IRQHandler,Default_Handler
.weak RTC_Alarm_IRQHandler
.thumb_set RTC_Alarm_IRQHandler,Default_Handler
.weak OTG_FS_WKUP_IRQHandler
.thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
.weak TIM8_BRK_TIM12_IRQHandler
.thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler
.weak TIM8_UP_TIM13_IRQHandler
.thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler
.weak TIM8_TRG_COM_TIM14_IRQHandler
.thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler
.weak TIM8_CC_IRQHandler
.thumb_set TIM8_CC_IRQHandler,Default_Handler
.weak DMA1_Stream7_IRQHandler
.thumb_set DMA1_Stream7_IRQHandler,Default_Handler
.weak FSMC_IRQHandler
.thumb_set FSMC_IRQHandler,Default_Handler
.weak SDIO_IRQHandler
.thumb_set SDIO_IRQHandler,Default_Handler
.weak TIM5_IRQHandler
.thumb_set TIM5_IRQHandler,Default_Handler
.weak SPI3_IRQHandler
.thumb_set SPI3_IRQHandler,Default_Handler
.weak UART4_IRQHandler
.thumb_set UART4_IRQHandler,Default_Handler
.weak UART5_IRQHandler
.thumb_set UART5_IRQHandler,Default_Handler
.weak TIM6_DAC_IRQHandler
.thumb_set TIM6_DAC_IRQHandler,Default_Handler
.weak TIM7_IRQHandler
.thumb_set TIM7_IRQHandler,Default_Handler
.weak DMA2_Stream0_IRQHandler
.thumb_set DMA2_Stream0_IRQHandler,Default_Handler
.weak DMA2_Stream1_IRQHandler
.thumb_set DMA2_Stream1_IRQHandler,Default_Handler
.weak DMA2_Stream2_IRQHandler
.thumb_set DMA2_Stream2_IRQHandler,Default_Handler
.weak DMA2_Stream3_IRQHandler
.thumb_set DMA2_Stream3_IRQHandler,Default_Handler
.weak DMA2_Stream4_IRQHandler
.thumb_set DMA2_Stream4_IRQHandler,Default_Handler
.weak ETH_IRQHandler
.thumb_set ETH_IRQHandler,Default_Handler
.weak ETH_WKUP_IRQHandler
.thumb_set ETH_WKUP_IRQHandler,Default_Handler
.weak CAN2_TX_IRQHandler
.thumb_set CAN2_TX_IRQHandler,Default_Handler
.weak CAN2_RX0_IRQHandler
.thumb_set CAN2_RX0_IRQHandler,Default_Handler
.weak CAN2_RX1_IRQHandler
.thumb_set CAN2_RX1_IRQHandler,Default_Handler
.weak CAN2_SCE_IRQHandler
.thumb_set CAN2_SCE_IRQHandler,Default_Handler
.weak OTG_FS_IRQHandler
.thumb_set OTG_FS_IRQHandler,Default_Handler
.weak DMA2_Stream5_IRQHandler
.thumb_set DMA2_Stream5_IRQHandler,Default_Handler
.weak DMA2_Stream6_IRQHandler
.thumb_set DMA2_Stream6_IRQHandler,Default_Handler
.weak DMA2_Stream7_IRQHandler
.thumb_set DMA2_Stream7_IRQHandler,Default_Handler
.weak USART6_IRQHandler
.thumb_set USART6_IRQHandler,Default_Handler
.weak I2C3_EV_IRQHandler
.thumb_set I2C3_EV_IRQHandler,Default_Handler
.weak I2C3_ER_IRQHandler
.thumb_set I2C3_ER_IRQHandler,Default_Handler
.weak OTG_HS_EP1_OUT_IRQHandler
.thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler
.weak OTG_HS_EP1_IN_IRQHandler
.thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler
.weak OTG_HS_WKUP_IRQHandler
.thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler
.weak OTG_HS_IRQHandler
.thumb_set OTG_HS_IRQHandler,Default_Handler
.weak DCMI_IRQHandler
.thumb_set DCMI_IRQHandler,Default_Handler
.weak HASH_RNG_IRQHandler
.thumb_set HASH_RNG_IRQHandler,Default_Handler
.weak FPU_IRQHandler
.thumb_set FPU_IRQHandler,Default_Handler
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -1,158 +0,0 @@
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = 0x20020000; /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x200;; /* required amount of heap */
_Min_Stack_Size = 0x400;; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
}
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data goes into FLASH */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
_siccmram = LOADADDR(.ccmram);
/* CCM-RAM section
*
* IMPORTANT NOTE!
* If initialized variables will be placed in this section,
* the startup code needs to be modified to copy the init-values.
*/
.ccmram :
{
. = ALIGN(4);
_sccmram = .; /* create a global symbol at ccmram start */
*(.ccmram)
*(.ccmram*)
. = ALIGN(4);
_eccmram = .; /* create a global symbol at ccmram end */
} >CCMRAM AT> FLASH
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(4);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(4);
} >RAM
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}

View file

@ -1,154 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Inc/stm32f4xx_hal_conf.h
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief HAL configuration file.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without
*modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
*notice,
* this list of conditions and the following disclaimer in the
*documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its
*contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
*ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
*LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
*USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#ifndef __STM32F4xx_HAL_CONF_H
#define __STM32F4xx_HAL_CONF_H
#define HAL_MODULE_ENABLED
#include "stm32f4xx_hal_def.h"
#define HAL_RCC_MODULE_ENABLED
#include "stm32f4xx_hal_rcc.h"
#define HAL_FLASH_MODULE_ENABLED
#include "stm32f4xx_hal_flash.h"
#define HAL_DMA_MODULE_ENABLED
#include "stm32f4xx_hal_dma.h"
#define HAL_USART_MODULE_ENABLED
#include "stm32f4xx_hal_usart.h"
#define HAL_PWR_MODULE_ENABLED
#include "stm32f4xx_hal_pwr.h"
/* USB host controller foo */
#define HAL_HCD_MODULE_ENABLED
#include "stm32f4xx_hal_hcd.h"
/* Whoever needs a HAL for GPIOs... */
#define HAL_GPIO_MODULE_ENABLED
#include "stm32f4xx_hal_gpio.h"
/* Why not wrap the wrapper? */
#define HAL_CORTEX_MODULE_ENABLED
#include "stm32f4xx_hal_cortex.h"
/*
#define HAL_DMA2D_MODULE_ENABLED
#include "stm32f4xx_hal_dma2d.h"
#define HAL_SRAM_MODULE_ENABLED
#include "stm32f4xx_hal_sram.h"
#define HAL_SDRAM_MODULE_ENABLED
#include "stm32f4xx_hal_sdram.h"
#define HAL_I2C_MODULE_ENABLED
#include "stm32f4xx_hal_i2c.h"
#define HAL_LTDC_MODULE_ENABLED
#include "stm32f4xx_hal_ltdc.h"
#define HAL_DSI_MODULE_ENABLED
#include "stm32f4xx_hal_dsi.h"
#define HAL_FMPI2C_MODULE_ENABLED
#include "stm32f4xx_hal_fmpi2c.h"
*/
#if !defined(HSE_VALUE)
#if defined(USE_STM32469I_DISCO_REVA)
#define HSE_VALUE \
25000000U /*!< Default value of the External oscillator in Hz */
#else
#define HSE_VALUE \
8000000U /*!< Default value of the External oscillator in Hz */
#endif /* USE_STM32469I_DISCO_REVA */
#endif /* HSE_VALUE */
#if !defined(HSE_STARTUP_TIMEOUT)
#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */
#endif
/* Internal High Speed oscillator (HSI) value. This value is used by the RCC HAL module to compute the system frequency
* (when HSI is used as system clock source, directly or through the PLL). */
#if !defined(HSI_VALUE)
#define HSI_VALUE 16000000U
#endif
/* Internal Low Speed oscillator (LSI) value. */
#if !defined(LSI_VALUE)
#define LSI_VALUE 32000U
#endif
/* External Low Speed oscillator (LSE) value. */
#if !defined(LSE_VALUE)
#define LSE_VALUE 32768U
#endif
#if !defined(LSE_STARTUP_TIMEOUT)
#define LSE_STARTUP_TIMEOUT 5000U
#endif
/* External clock source for I2S peripheral This value is used by the I2S HAL module to compute the I2S clock source
* frequency, this source is inserted directly through I2S_CKIN pad. */
#if !defined(EXTERNAL_CLOCK_VALUE)
#define EXTERNAL_CLOCK_VALUE 12288000U
#endif
/* For the HAL */
#define VDD_VALUE 3300U
#define TICK_INT_PRIORITY 0x00U
#define USE_RTOS 0
#define PREFETCH_ENABLE 1
#define INSTRUCTION_CACHE_ENABLE 1
#define DATA_CACHE_ENABLE 1
#define USE_SPI_CRC 1U
#define assert_param(expr) ((void)0U)
#endif

View file

@ -1,72 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
#include "stm32f4xx_it.h"
extern HCD_HandleTypeDef hhcd;
void NMI_Handler(void) {}
void HardFault_Handler(void)
{
while (1)
;
}
void MemManage_Handler(void)
{
while (1)
;
}
void BusFault_Handler(void)
{
while (1)
;
}
void UsageFault_Handler(void)
{
while (1)
;
}
void SVC_Handler(void) {}
void DebugMon_Handler(void) {}
void PendSV_Handler(void) {}
void SysTick_Handler(void) {
HAL_IncTick();
}
void OTG_FS_IRQHandler(void) {
HAL_HCD_IRQHandler(&hhcd);
}

View file

@ -1,44 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#include "main.h"
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void OTG_FS_IRQHandler(void);
#endif

View file

@ -1,190 +0,0 @@
/* Support files for GNU libc. Files in the system namespace go here.
Files in the C namespace (ie those that do not start with an
underscore) go in .c. */
#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/errno.h>
#include <reent.h>
#include <unistd.h>
#include <sys/wait.h>
#define FreeRTOS
#define MAX_STACK_SIZE 0x200
extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));
#ifndef FreeRTOS
register char * stack_ptr asm("sp");
#endif
caddr_t _sbrk(int incr)
{
extern char end asm("end");
static char *heap_end;
char *prev_heap_end,*min_stack_ptr;
if (heap_end == 0)
heap_end = &end;
prev_heap_end = heap_end;
#ifdef FreeRTOS
/* Use the NVIC offset register to locate the main stack pointer. */
min_stack_ptr = (char*)(*(unsigned int *)*(unsigned int *)0xE000ED08);
/* Locate the STACK bottom address */
min_stack_ptr -= MAX_STACK_SIZE;
if (heap_end + incr > min_stack_ptr)
#else
if (heap_end + incr > stack_ptr)
#endif
{
// write(1, "Heap and stack collision\n", 25);
// abort();
errno = ENOMEM;
return (caddr_t) -1;
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}
/*
* _gettimeofday primitive (Stub function)
* */
int _gettimeofday (struct timeval * tp, struct timezone * tzp)
{
/* Return fixed data for the timezone. */
if (tzp)
{
tzp->tz_minuteswest = 0;
tzp->tz_dsttime = 0;
}
return 0;
}
void initialise_monitor_handles()
{
}
int _getpid(void)
{
return 1;
}
int _kill(int pid, int sig)
{
errno = EINVAL;
return -1;
}
void _exit (int status)
{
_kill(status, -1);
while (1) {}
}
int _write(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
__io_putchar( *ptr++ );
}
return len;
}
int _close(int file)
{
return -1;
}
int _fstat(int file, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
int _isatty(int file)
{
return 1;
}
int _lseek(int file, int ptr, int dir)
{
return 0;
}
int _read(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
*ptr++ = __io_getchar();
}
return len;
}
int _open(char *path, int flags, ...)
{
/* Pretend like we always fail */
return -1;
}
int _wait(int *status)
{
errno = ECHILD;
return -1;
}
int _unlink(char *name)
{
errno = ENOENT;
return -1;
}
int _times(struct tms *buf)
{
return -1;
}
int _stat(char *file, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
int _link(char *old, char *new)
{
errno = EMLINK;
return -1;
}
int _fork(void)
{
errno = EAGAIN;
return -1;
}
int _execve(char *name, char **argv, char **env)
{
errno = ENOMEM;
return -1;
}

View file

@ -1,143 +0,0 @@
/**
******************************************************************************
* @file system_stm32f4xx.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
*
* This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the "startup_stm32f4xx.s" file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be
*used
* by the user application to setup the
*SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and
*must
* be called whenever the core clock is changed
* during program execution.
*
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without
*modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
*notice,
* this list of conditions and the following disclaimer in the
*documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its
*contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
*ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
*LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
*USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#include "stm32f4xx.h"
#if !defined(HSE_VALUE)
#if defined(USE_STM32469I_DISCO_REVA)
#define HSE_VALUE \
((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
#else
#define HSE_VALUE \
((uint32_t)8000000) /*!< Default value of the External oscillator in Hz */
#endif /* USE_STM32469I_DISCO_REVA */
#endif /* HSE_VALUE */
#if !defined(HSI_VALUE)
#define HSI_VALUE \
((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
#endif /* HSI_VALUE */
#define VECT_TAB_OFFSET 0x00 /* This value must be a multiple of 0x200. */
/* The following variable is updated in three ways:
1) by calling CMSIS function SystemCoreClockUpdate()
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
Note: If you use this function to configure the system clock; then there is no need to call the 2 first functions
listed above, since the SystemCoreClock variable is updated automatically. */
uint32_t SystemCoreClock = 16000000;
const uint8_t AHBPrescTable[16] = { 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 3, 4, 6, 7, 8, 9 };
const uint8_t APBPrescTable[8] = { 0, 0, 0, 0, 1, 2, 3, 4 };
/* Setup the microcontroller system: Initialize the FPU setting, vector table location and External memory configuration. */
void SystemInit(void)
{
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10 * 2) | (3UL << 11 * 2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state */
RCC->CR |= (uint32_t)0x00000001; /* Set HSION bit */
RCC->CFGR = 0x00000000; /* Reset CFGR register */
RCC->CR &= (uint32_t)0xFEF6FFFF; /* Reset HSEON, CSSON and PLLON bits */
RCC->PLLCFGR = 0x24003010; /* Reset PLLCFGR register */
RCC->CR &= (uint32_t)0xFFFBFFFF; /* Reset HSEBYP bit */
RCC->CIR = 0x00000000; /* Disable all interrupts */
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
}
/* Update SystemCoreClock variable according to Clock Register Values. The SystemCoreClock variable contains the core
* clock (HCLK), it can be used by the user application to setup the SysTick timer or configure other parameters. */
void SystemCoreClockUpdate(void)
{
switch (RCC->CFGR & RCC_CFGR_SWS) {
case 0x00: /* HSI */
SystemCoreClock = HSI_VALUE;
break;
case 0x04: /* HSE */
SystemCoreClock = HSE_VALUE;
break;
case 0x08: {/* PLL */
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
SYSCLK = PLL_VCO / PLL_P */
uint32_t pllvco;
uint32_t pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
uint32_t pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
if (pllsource != 0) /* HSE */
pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
else /* HSI */
pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
uint32_t pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >> 16) + 1) * 2;
SystemCoreClock = pllvco / pllp;
break; }
default:
SystemCoreClock = HSI_VALUE;
break;
}
/* Compute HCLK frequency */
SystemCoreClock >>= AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
}

View file

@ -1,434 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Src/usbh_conf.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief USB Host configuration file.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
#include "usbh_core.h"
HCD_HandleTypeDef hhcd;
/*******************************************************************************
HCD BSP Routines
*******************************************************************************/
/**
* @brief Initializes the HCD MSP.
* @param hhcd: HCD handle
* @retval None
*/
void HAL_HCD_MspInit(HCD_HandleTypeDef* hhcd)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* Configure USB FS GPIOs */
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = (GPIO_PIN_11 | GPIO_PIN_12);
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* Configure POWER_SWITCH IO pin */
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* Enable USB FS Clocks */
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
/* Set USBFS Interrupt priority */
HAL_NVIC_SetPriority(OTG_FS_IRQn, 6, 0);
/* Enable USBFS Interrupt */
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
}
/**
* @brief DeInitializes the HCD MSP.
* @param hhcd: HCD handle
* @retval None
*/
void HAL_HCD_MspDeInit(HCD_HandleTypeDef* hhcd)
{
/* Disable USB FS Clocks */
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
}
/*******************************************************************************
LL Driver Callbacks (HCD -> USB Host Library)
*******************************************************************************/
/**
* @brief SOF callback.
* @param hhcd: HCD handle
* @retval None
*/
void HAL_HCD_SOF_Callback(HCD_HandleTypeDef* hhcd)
{
USBH_LL_IncTimer(hhcd->pData);
}
/**
* @brief Connect callback.
* @param hhcd: HCD handle
* @retval None
*/
void HAL_HCD_Connect_Callback(HCD_HandleTypeDef* hhcd)
{
USBH_LL_Connect(hhcd->pData);
}
/**
* @brief Disconnect callback.
* @param hhcd: HCD handle
* @retval None
*/
void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef* hhcd)
{
USBH_LL_Disconnect(hhcd->pData);
}
/**
* @brief Notify URB state change callback.
* @param hhcd: HCD handle
* @param chnum: Channel number
* @param urb_state: URB State
* @retval None
*/
void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef* hhcd, uint8_t chnum,
HCD_URBStateTypeDef urb_state)
{
/* To be used with OS to sync URB state with the global state machine */
}
/*******************************************************************************
LL Driver Interface (USB Host Library --> HCD)
*******************************************************************************/
/**
* @brief USBH_LL_Init
* Initialize the Low Level portion of the Host driver.
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef* phost)
{
/* Set the LL Driver parameters */
hhcd.Instance = USB_OTG_FS;
hhcd.Init.Host_channels = 11;
hhcd.Init.dma_enable = 0;
hhcd.Init.low_power_enable = 0;
hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd.Init.Sof_enable = 0;
hhcd.Init.speed = HCD_SPEED_FULL;
hhcd.Init.vbus_sensing_enable = 0;
hhcd.Init.lpm_enable = 0;
/* Link the driver to the stack */
hhcd.pData = phost;
phost->pData = &hhcd;
/* Initialize the LL Driver */
HAL_HCD_Init(&hhcd);
USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd));
return USBH_OK;
}
/**
* @brief De-Initializes the Low Level portion of the Host driver.
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_DeInit(USBH_HandleTypeDef* phost)
{
HAL_HCD_DeInit(phost->pData);
return USBH_OK;
}
/**
* @brief Starts the Low Level portion of the Host driver.
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef* phost)
{
HAL_HCD_Start(phost->pData);
return USBH_OK;
}
/**
* @brief Stops the Low Level portion of the Host driver.
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_Stop(USBH_HandleTypeDef* phost)
{
HAL_HCD_Stop(phost->pData);
return USBH_OK;
}
/**
* @brief Returns the USB Host Speed from the Low Level Driver.
* @param phost: Host handle
* @retval USBH Speeds
*/
USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef* phost)
{
USBH_SpeedTypeDef speed = USBH_SPEED_FULL;
switch (HAL_HCD_GetCurrentSpeed(phost->pData)) {
case 0:
speed = USBH_SPEED_HIGH;
break;
case 1:
speed = USBH_SPEED_FULL;
break;
case 2:
speed = USBH_SPEED_LOW;
break;
default:
speed = USBH_SPEED_FULL;
break;
}
return speed;
}
/**
* @brief Resets the Host Port of the Low Level Driver.
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef* phost)
{
HAL_HCD_ResetPort(phost->pData);
return USBH_OK;
}
/**
* @brief Returns the last transferred packet size.
* @param phost: Host handle
* @param pipe: Pipe index
* @retval Packet Size
*/
uint32_t USBH_LL_GetLastXferSize(USBH_HandleTypeDef* phost, uint8_t pipe)
{
return HAL_HCD_HC_GetXferCount(phost->pData, pipe);
}
/**
* @brief Opens a pipe of the Low Level Driver.
* @param phost: Host handle
* @param pipe: Pipe index
* @param epnum: Endpoint Number
* @param dev_address: Device USB address
* @param speed: Device Speed
* @param ep_type: Endpoint Type
* @param mps: Endpoint Max Packet Size
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef* phost, uint8_t pipe,
uint8_t epnum, uint8_t dev_address,
uint8_t speed, uint8_t ep_type,
uint16_t mps)
{
HAL_HCD_HC_Init(phost->pData, pipe, epnum, dev_address, speed, ep_type, mps);
return USBH_OK;
}
/**
* @brief Closes a pipe of the Low Level Driver.
* @param phost: Host handle
* @param pipe: Pipe index
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_ClosePipe(USBH_HandleTypeDef* phost, uint8_t pipe)
{
HAL_HCD_HC_Halt(phost->pData, pipe);
return USBH_OK;
}
/**
* @brief Submits a new URB to the low level driver.
* @param phost: Host handle
* @param pipe: Pipe index
* This parameter can be a value from 1 to 15
* @param direction: Channel number
* This parameter can be one of these values:
* 0: Output
* 1: Input
* @param ep_type: Endpoint Type
* This parameter can be one of these values:
* @arg EP_TYPE_CTRL: Control type
* @arg EP_TYPE_ISOC: Isochronous type
* @arg EP_TYPE_BULK: Bulk type
* @arg EP_TYPE_INTR: Interrupt type
* @param token: Endpoint Type
* This parameter can be one of these values:
* @arg 0: PID_SETUP
* @arg 1: PID_DATA
* @param pbuff: pointer to URB data
* @param length: length of URB data
* @param do_ping: activate do ping protocol (for high speed only)
* This parameter can be one of these values:
* 0: do ping inactive
* 1: do ping active
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_SubmitURB(USBH_HandleTypeDef* phost, uint8_t pipe,
uint8_t direction, uint8_t ep_type,
uint8_t token, uint8_t* pbuff,
uint16_t length, uint8_t do_ping)
{
HAL_HCD_HC_SubmitRequest(phost->pData, pipe, direction, ep_type, token, pbuff,
length, do_ping);
return USBH_OK;
}
/**
* @brief Gets a URB state from the low level driver.
* @param phost: Host handle
* @param pipe: Pipe index
* This parameter can be a value from 1 to 15
* @retval URB state
* This parameter can be one of these values:
* @arg URB_IDLE
* @arg URB_DONE
* @arg URB_NOTREADY
* @arg URB_NYET
* @arg URB_ERROR
* @arg URB_STALL
*/
USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef* phost,
uint8_t pipe)
{
return (USBH_URBStateTypeDef)HAL_HCD_HC_GetURBState(phost->pData, pipe);
}
/**
* @brief Drives VBUS.
* @param phost: Host handle
* @param state: VBUS state
* This parameter can be one of these values:
* 0: VBUS Active
* 1: VBUS Inactive
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_DriverVBUS(USBH_HandleTypeDef* phost,
uint8_t state)
{
if (state == 0) {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET);
} else {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET);
}
HAL_Delay(200);
return USBH_OK;
}
/**
* @brief Sets toggle for a pipe.
* @param phost: Host handle
* @param pipe: Pipe index
* @param toggle: toggle (0/1)
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef* phost, uint8_t pipe,
uint8_t toggle)
{
if (hhcd.hc[pipe].ep_is_in) {
hhcd.hc[pipe].toggle_in = toggle;
} else {
hhcd.hc[pipe].toggle_out = toggle;
}
return USBH_OK;
}
/**
* @brief Returns the current toggle of a pipe.
* @param phost: Host handle
* @param pipe: Pipe index
* @retval toggle (0/1)
*/
uint8_t USBH_LL_GetToggle(USBH_HandleTypeDef* phost, uint8_t pipe)
{
uint8_t toggle = 0;
if (hhcd.hc[pipe].ep_is_in) {
toggle = hhcd.hc[pipe].toggle_in;
} else {
toggle = hhcd.hc[pipe].toggle_out;
}
return toggle;
}
/**
* @brief Delay routine for the USB Host Library
* @param Delay: Delay in ms
* @retval None
*/
void USBH_Delay(uint32_t Delay)
{
#if (USBH_USE_OS == 1)
osDelay(Delay);
#else
HAL_Delay(Delay);
#endif
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -1,114 +0,0 @@
/**
******************************************************************************
* @file USB_Host/HID_Standalone/Inc/usbh_conf.h
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief General low level driver configuration
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_CONF_H
#define __USBH_CONF_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Exported types ------------------------------------------------------------*/
#define USBH_MAX_NUM_ENDPOINTS 2
#define USBH_MAX_NUM_INTERFACES 2
#define USBH_MAX_NUM_CONFIGURATION 1
#define USBH_MAX_NUM_SUPPORTED_CLASS 1
#define USBH_KEEP_CFG_DESCRIPTOR 0
#define USBH_MAX_SIZE_CONFIGURATION 0x200
#define USBH_MAX_DATA_BUFFER 0x200
#define USBH_DEBUG_LEVEL 2
#define USBH_USE_OS 0
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* CMSIS OS macros */
#if (USBH_USE_OS == 1)
#include "cmsis_os.h"
#define USBH_PROCESS_PRIO osPriorityNormal
#endif
/* Memory management macros */
#define USBH_malloc malloc
#define USBH_free free
#define USBH_memset memset
#define USBH_memcpy memcpy
/* DEBUG macros */
#if (USBH_DEBUG_LEVEL > 0)
#define USBH_UsrLog(...) \
printf(__VA_ARGS__); \
printf("\n");
#else
#define USBH_UsrLog(...)
#endif
#if (USBH_DEBUG_LEVEL > 1)
#define USBH_ErrLog(...) \
printf("ERROR: "); \
printf(__VA_ARGS__); \
printf("\n");
#else
#define USBH_ErrLog(...)
#endif
#if (USBH_DEBUG_LEVEL > 2)
#define USBH_DbgLog(...) \
printf("DEBUG : "); \
printf(__VA_ARGS__); \
printf("\n");
#else
#define USBH_DbgLog(...)
#endif
/* Exported functions ------------------------------------------------------- */
#endif /* __USBH_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/