diff --git a/.cproject b/.cproject
deleted file mode 100644
index e19cf5e..0000000
--- a/.cproject
+++ /dev/null
@@ -1,318 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
index 69bb4ea..0276a84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
+/.vscode/
+/build/
*.o
*.d
*.bin
*.asmo
*.elf
*~
-
diff --git a/.project b/.project
deleted file mode 100644
index 7d6bec5..0000000
--- a/.project
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
- CandleLightTest
-
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.genmakebuilder
- clean,full,incremental,
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
- full,incremental,
-
-
-
-
-
- org.eclipse.cdt.core.cnature
- org.eclipse.cdt.managedbuilder.core.managedBuildNature
- org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
- org.eclipse.cdt.core.ccnature
-
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..2ceeb47
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,86 @@
+cmake_minimum_required(VERSION 3.10)
+project(candleLightFirmware C ASM)
+
+add_compile_options(
+ -std=gnu11
+ -mcpu=cortex-m0 -mthumb
+ -Wall -Wextra -Werror
+ -fmessage-length=0
+ -fsigned-char
+ -ffunction-sections -fdata-sections
+ -ffreestanding
+ -fno-move-loop-invariants
+ -Os -g3
+)
+
+add_link_options(
+ -mcpu=cortex-m0 -mthumb -O
+ -Wall -Wextra -g3
+ -nostartfiles -Xlinker --gc-sections --specs=nano.specs
+ -T ${CMAKE_SOURCE_DIR}/ldscripts/ldscript.ld
+)
+
+
+add_subdirectory(libs/STM32_HAL)
+add_subdirectory(libs/STM32_USB_Device_Library)
+
+set(
+ SOURCE_FILES
+ include/config.h
+
+ include/gs_usb.h
+ include/usbd_desc.h src/usbd_desc.c
+ include/usbd_gs_can.h src/usbd_gs_can.c
+ src/usbd_conf.c
+
+ include/can.h src/can.c
+ include/dfu.h src/dfu.c
+ include/flash.h src/flash.c
+ include/gpio.h src/gpio.c
+ include/led.h src/led.c
+ include/queue.h src/queue.c
+ include/timer.h src/timer.c
+ include/util.h src/util.c
+
+ src/main.c
+ src/interrupts.c
+)
+
+function(make_bin_file target)
+ add_custom_command(
+ TARGET ${target} POST_BUILD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${CMAKE_OBJCOPY} -O binary ${target} ${target}.bin
+ )
+endfunction()
+
+function(show_object_size target)
+ string(REPLACE "objcopy" "size" CMAKE_OBJSIZE "${CMAKE_OBJCOPY}")
+ add_custom_command(
+ TARGET ${target} POST_BUILD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${CMAKE_OBJSIZE} ${target}
+ )
+endfunction()
+
+function(add_flash_target target)
+ add_custom_target(
+ flash-${target} dfu-util -d 1d50:606f -a 0 -R -s 0x08000000 -D ${target}.bin
+ )
+endfunction()
+
+add_executable(candleLight_fw ${SOURCE_FILES})
+ target_include_directories(candleLight_fw PRIVATE include/)
+ target_compile_definitions(candleLight_fw PRIVATE BOARD=BOARD_candleLight)
+ target_link_libraries(candleLight_fw PRIVATE STM32_HAL_STM32F042x6 STM32_USB_Device_Library_STM32F042x6)
+ make_bin_file(candleLight_fw)
+ show_object_size(candleLight_fw)
+ add_flash_target(candleLight_fw)
+
+add_executable(cantact_fw ${SOURCE_FILES})
+ target_include_directories(cantact_fw PRIVATE include/)
+ target_compile_definitions(cantact_fw PRIVATE BOARD=BOARD_cantact)
+ target_link_libraries(cantact_fw PRIVATE STM32_HAL_STM32F072xB STM32_USB_Device_Library_STM32F072xB)
+ make_bin_file(cantact_fw)
+ show_object_size(cantact_fw)
+ add_flash_target(cantact_fw)
\ No newline at end of file
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 78c98d8..0000000
--- a/Makefile
+++ /dev/null
@@ -1,84 +0,0 @@
-TOOLCHAIN ?= arm-none-eabi-
-
-CC = $(TOOLCHAIN)gcc
-OBJCOPY = $(TOOLCHAIN)objcopy
-SIZE = $(TOOLCHAIN)size
-
-CFLAGS = -c -std=gnu11 -mcpu=cortex-m0 -mthumb -Os
-CFLAGS += -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants
-CFLAGS += -Wall -Wextra -g3 -D$(CHIP) -D BOARD=BOARD_$(BOARD)
-
-INCLUDES = -I"include"
-INCLUDES += -I"system/include" -I"system/include/cmsis" -I"system/include/stm32f0xx" -I"system/include/cmsis/device"
-INCLUDES += -I"Middlewares/ST/STM32_USB_Device_Library/Core/Inc"
-
-LDFLAGS = -mcpu=cortex-m0 -mthumb -O
-LDFLAGS += -Wall -Wextra -g3
-LDFLAGS += -T ldscripts/mem.ld -T ldscripts/libs.ld -T ldscripts/sections.ld
-LDFLAGS += -nostartfiles -Xlinker --gc-sections --specs=nano.specs
-
-SRC = $(wildcard src/*.c)
-SRC += $(wildcard system/src/stm32f0xx/*.c)
-SRC += $(wildcard system/src/newlib/*.c)
-SRC += $(wildcard system/src/cortexm/*.c)
-SRC += $(wildcard system/src/cmsis/*.c)
-SRC += $(wildcard Middlewares/ST/STM32_USB_Device_Library/Core/Src/*.c)
-OBJ = $(patsubst %.c,build/$(BOARD)/%.o,$(SRC))
-DEP = $(OBJ:%.o=%.d)
-
-ASM_SRC = system/src/cmsis/startup_stm32f042x6.S
-ASM_OBJ += $(patsubst %.S,build/$(BOARD)/%.asmo,$(ASM_SRC))
-DEP += $(ASM_OBJ:%.asmo=%.d)
-
-ELF = build/$(BOARD)/gsusb_$(BOARD).elf
-BIN = bin/gsusb_$(BOARD).bin
-
-all: candleLight cantact
-
-.PHONY : clean all
-
-clean:
- $(MAKE) BOARD=candleLight board-clean
- $(MAKE) BOARD=cantact board-clean
-
-candleLight:
- $(MAKE) CHIP=STM32F042x6 BOARD=candleLight bin
-
-flash-candleLight:
- $(MAKE) CHIP=STM32F042x6 BOARD=candleLight board-flash
-
-cantact:
- $(MAKE) CHIP=STM32F072xB BOARD=cantact bin
-
-flash-cantact:
- $(MAKE) CHIP=STM32F072xB BOARD=cantact board-flash
-
-board-flash: bin
- sudo dfu-util -d 1d50:606f -a 0 -s 0x08000000 -D $(BIN)
-
-bin: $(BIN)
-
-$(BIN): $(ELF)
- @mkdir -p $(dir $@)
- $(OBJCOPY) -O binary $(ELF) $(BIN)
- $(SIZE) --format=berkeley $(ELF)
-
-$(ELF): $(OBJ) $(ASM_OBJ)
- @mkdir -p $(dir $@)
- $(CC) $(LDFLAGS) -o $@ $(OBJ) $(ASM_OBJ)
-
--include $(DEP)
-
-build/$(BOARD)/%.o : %.c
- @echo $<
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDES) -MMD -c $< -o $@
-
-build/$(BOARD)/%.asmo : %.S
- @echo $<
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDES) -MMD -c $< -o $@
-
-.PHONY : board-clean
-board-clean :
- -rm -f $(BIN) $(OBJ) $(ASM_OBJ) $(DEP)
diff --git a/bin/gsusb_candleLight-v1.0.bin b/bin/gsusb_candleLight-v1.0.bin
deleted file mode 100755
index 09ac5c2..0000000
Binary files a/bin/gsusb_candleLight-v1.0.bin and /dev/null differ
diff --git a/bin/gsusb_cantact-v1.0.bin b/bin/gsusb_cantact-v1.0.bin
deleted file mode 100755
index b18bb4a..0000000
Binary files a/bin/gsusb_cantact-v1.0.bin and /dev/null differ
diff --git a/cmake/gcc-arm-none-eabi-8-2019-q3-update.cmake b/cmake/gcc-arm-none-eabi-8-2019-q3-update.cmake
new file mode 100644
index 0000000..bdbce90
--- /dev/null
+++ b/cmake/gcc-arm-none-eabi-8-2019-q3-update.cmake
@@ -0,0 +1,27 @@
+set(TOOLCHAIN gcc-arm-none-eabi-8-2019-q3-update)
+find_path(
+ TOOLCHAIN_BIN_DIR
+ arm-none-eabi-gcc
+ HINTS
+ $ENV{HOME}/bin/${TOOLCHAIN}/bin
+ $ENV{HOME}/opt/${TOOLCHAIN}/bin
+ /opt/${TOOLCHAIN}/bin
+ /srv/${TOOLCHAIN}/bin
+ /usr/local/${TOOLCHAIN}/bin
+ ENV TOOLCHAIN_BIN_DIR
+)
+
+set(CMAKE_SYSTEM_NAME Generic)
+set(CMAKE_SYSTEM_PROCESSOR arm)
+
+set(CMAKE_C_COMPILER "${TOOLCHAIN_BIN_DIR}/arm-none-eabi-gcc" CACHE INTERNAL "")
+set(CMAKE_CXX_COMPILER "${TOOLCHAIN_BIN_DIR}/arm-none-eabi-g++" CACHE INTERNAL "")
+set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERNAL "")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+SET (CMAKE_C_COMPILER_WORKS 1)
+SET (CMAKE_CXX_COMPILER_WORKS 1)
\ No newline at end of file
diff --git a/ldscripts/sections.ld b/ldscripts/ldscript.ld
similarity index 80%
rename from ldscripts/sections.ld
rename to ldscripts/ldscript.ld
index 9ef139f..6d491e8 100644
--- a/ldscripts/sections.ld
+++ b/ldscripts/ldscript.ld
@@ -1,9 +1,8 @@
-/*
- * Default linker script for Cortex-M (it includes specifics for STM32F[34]xx).
- *
- * To make use of the multi-region initialisations, define
- * OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS for the _startup.c file.
- */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 6K
+}
/*
* The '__stack' definition is required by crt0, do not remove it.
@@ -103,11 +102,7 @@ SECTIONS
LONG(LOADADDR(.data));
LONG(ADDR(.data));
LONG(ADDR(.data)+SIZEOF(.data));
-
- LONG(LOADADDR(.data_CCMRAM));
- LONG(ADDR(.data_CCMRAM));
- LONG(ADDR(.data_CCMRAM)+SIZEOF(.data_CCMRAM));
-
+
__data_regions_array_end = .;
__bss_regions_array_start = .;
@@ -115,9 +110,6 @@ SECTIONS
LONG(ADDR(.bss));
LONG(ADDR(.bss)+SIZEOF(.bss));
- LONG(ADDR(.bss_CCMRAM));
- LONG(ADDR(.bss_CCMRAM)+SIZEOF(.bss_CCMRAM));
-
__bss_regions_array_end = .;
/* End of memory regions initialisation arrays. */
@@ -234,24 +226,6 @@ SECTIONS
_etext = .;
__etext = .;
- /* MEMORY_ARRAY */
- /*
- .ROarraySection :
- {
- *(.ROarraySection .ROarraySection.*)
- } >MEMORY_ARRAY
- */
-
- /*
- * The secondary initialised data section.
- */
- .data_CCMRAM : ALIGN(4)
- {
- FILL(0xFF)
- *(.data.CCMRAM .data.CCMRAM.*)
- . = ALIGN(4) ;
- } > CCMRAM AT>FLASH
-
/*
* This address is used by the startup code to
* initialise the .data section.
@@ -290,12 +264,6 @@ SECTIONS
* the "section `.bss' type changed to PROGBITS" warning
*/
- /* The secondary uninitialised data section. */
- .bss_CCMRAM (NOLOAD) : ALIGN(4)
- {
- *(.bss.CCMRAM .bss.CCMRAM.*)
- } > CCMRAM
-
/* The primary uninitialised data section. */
.bss (NOLOAD) : ALIGN(4)
{
@@ -311,11 +279,6 @@ SECTIONS
__bss_end__ = .; /* standard newlib definition */
_ebss = . ; /* STM specific definition */
} >RAM
-
- .noinit_CCMRAM (NOLOAD) : ALIGN(4)
- {
- *(.noinit.CCMRAM .noinit.CCMRAM.*)
- } > CCMRAM
.noinit (NOLOAD) : ALIGN(4)
{
@@ -343,58 +306,7 @@ SECTIONS
{
. = . + _Minimum_Stack_Size ;
} >RAM
-
- /*
- * The FLASH Bank1.
- * The C or assembly source must explicitly place the code
- * or data there using the "section" attribute.
- */
- .b1text : ALIGN(4)
- {
- *(.b1text) /* remaining code */
- *(.b1rodata) /* read-only data (constants) */
- *(.b1rodata.*)
- } >FLASHB1
-
- /*
- * The EXTMEM.
- * The C or assembly source must explicitly place the code or data there
- * using the "section" attribute.
- */
-
- /* EXTMEM Bank0 */
- .eb0text : ALIGN(4)
- {
- *(.eb0text) /* remaining code */
- *(.eb0rodata) /* read-only data (constants) */
- *(.eb0rodata.*)
- } >EXTMEMB0
-
- /* EXTMEM Bank1 */
- .eb1text : ALIGN(4)
- {
- *(.eb1text) /* remaining code */
- *(.eb1rodata) /* read-only data (constants) */
- *(.eb1rodata.*)
- } >EXTMEMB1
-
- /* EXTMEM Bank2 */
- .eb2text : ALIGN(4)
- {
- *(.eb2text) /* remaining code */
- *(.eb2rodata) /* read-only data (constants) */
- *(.eb2rodata.*)
- } >EXTMEMB2
-
- /* EXTMEM Bank0 */
- .eb3text : ALIGN(4)
- {
- *(.eb3text) /* remaining code */
- *(.eb3rodata) /* read-only data (constants) */
- *(.eb3rodata.*)
- } >EXTMEMB3
-
-
+
/* After that there are only debugging sections. */
/* This can remove the debugging information from the standard libraries */
diff --git a/ldscripts/libs.ld b/ldscripts/libs.ld
deleted file mode 100644
index 70fea89..0000000
--- a/ldscripts/libs.ld
+++ /dev/null
@@ -1,8 +0,0 @@
-
-/*
- * Placeholder to list other libraries required by the application.
-
-GROUP(
-)
-
- */
diff --git a/ldscripts/mem.ld b/ldscripts/mem.ld
deleted file mode 100644
index 78d35d5..0000000
--- a/ldscripts/mem.ld
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Memory Spaces Definitions.
- *
- * Need modifying for a specific board.
- * FLASH.ORIGIN: starting address of flash
- * FLASH.LENGTH: length of flash
- * RAM.ORIGIN: starting address of RAM bank 0
- * RAM.LENGTH: length of RAM bank 0
- *
- * The values below can be addressed in further linker scripts
- * using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'.
- */
-
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 6K
-
- /*
- * Optional sections; define the origin and length to match
- * the the specific requirements of your hardware. The zero
- * length prevents inadvertent allocation.
- */
- CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0
- FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
- EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
- EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
- EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
- EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
-}
-
-/*
- * For external ram use something like:
- * RAM (xrw) : ORIGIN = 0x64000000, LENGTH = 2048K
- *
- * For special RAM areas use something like:
- * MEMORY_ARRAY (xrw) : ORIGIN = 0x20002000, LENGTH = 32
- */
diff --git a/libs/STM32_HAL/CMakeLists.txt b/libs/STM32_HAL/CMakeLists.txt
new file mode 100644
index 0000000..d90aef8
--- /dev/null
+++ b/libs/STM32_HAL/CMakeLists.txt
@@ -0,0 +1,113 @@
+project(STM32_HAL)
+
+set(SOURCES
+ config/stm32f0xx_hal_conf.h
+
+ src/stm32f0xx/stm32f0xx_hal.c
+ src/stm32f0xx/stm32f0xx_hal_can.c
+ src/stm32f0xx/stm32f0xx_hal_cortex.c
+ src/stm32f0xx/stm32f0xx_hal_dma.c
+ src/stm32f0xx/stm32f0xx_hal_flash.c
+ src/stm32f0xx/stm32f0xx_hal_flash_ex.c
+ src/stm32f0xx/stm32f0xx_hal_gpio.c
+ src/stm32f0xx/stm32f0xx_hal_i2c.c
+ src/stm32f0xx/stm32f0xx_hal_i2c_ex.c
+ src/stm32f0xx/stm32f0xx_hal_pcd.c
+ src/stm32f0xx/stm32f0xx_hal_pcd_ex.c
+ src/stm32f0xx/stm32f0xx_hal_pwr.c
+ src/stm32f0xx/stm32f0xx_hal_pwr_ex.c
+ src/stm32f0xx/stm32f0xx_hal_rcc.c
+ src/stm32f0xx/stm32f0xx_hal_rcc_ex.c
+ src/stm32f0xx/stm32f0xx_hal_tim.c
+ src/stm32f0xx/stm32f0xx_hal_tim_ex.c
+
+ src/newlib/assert.c
+ src/newlib/_exit.c
+ src/newlib/_sbrk.c
+ src/newlib/_startup.c
+ src/newlib/_syscalls.c
+
+ src/cortexm/exception_handlers.c
+ src/cortexm/_initialize_hardware.c
+ src/cortexm/_reset_hardware.c
+
+ src/cmsis/system_stm32f0xx.c
+
+ include/stm32f0xx/stm32f0xx_hal_tim.h
+ include/stm32f0xx/stm32f0xx_hal_pcd.h
+ include/stm32f0xx/stm32f0xx_hal_gpio.h
+ include/stm32f0xx/stm32f0xx_hal_i2c_ex.h
+ include/stm32f0xx/stm32f0xx_hal_flash_ex.h
+ include/stm32f0xx/stm32f0xx_hal_dma_ex.h
+ include/stm32f0xx/stm32f0xx_hal_i2c.h
+ include/stm32f0xx/stm32f0xx_hal_pwr.h
+ include/stm32f0xx/stm32f0xx_hal_pwr_ex.h
+ include/stm32f0xx/stm32f0xx_hal_dma.h
+ include/stm32f0xx/stm32f0xx_hal_gpio_ex.h
+ include/stm32f0xx/Legacy/stm32_hal_legacy.h
+ include/stm32f0xx/stm32f0xx_hal_rcc_ex.h
+ include/stm32f0xx/stm32f0xx_hal_def.h
+ include/stm32f0xx/stm32f0xx_hal.h
+ include/stm32f0xx/stm32f0xx_hal_rcc.h
+ include/stm32f0xx/stm32f0xx_hal_cortex.h
+ include/stm32f0xx/stm32f0xx_hal_flash.h
+ include/stm32f0xx/stm32f0xx_hal_tim_ex.h
+ include/stm32f0xx/stm32f0xx_hal_pcd_ex.h
+ include/stm32f0xx/stm32f0xx_hal_can.h
+ include/cmsis/cmsis_armcc.h
+ include/cmsis/arm_math.h
+ include/cmsis/cmsis_armcc_V6.h
+ include/cmsis/arm_common_tables.h
+ include/cmsis/core_cm3.h
+ include/cmsis/core_cm0plus.h
+ include/cmsis/core_cm7.h
+ include/cmsis/cmsis_gcc.h
+ include/cmsis/core_cmInstr.h
+ include/cmsis/core_cmFunc.h
+ include/cmsis/core_cm0.h
+ include/cmsis/arm_const_structs.h
+ include/cmsis/core_sc300.h
+ include/cmsis/device/stm32f031x6.h
+ include/cmsis/device/stm32f048xx.h
+ include/cmsis/device/stm32f042x6.h
+ include/cmsis/device/stm32f091xc.h
+ include/cmsis/device/stm32f0xx.h
+ include/cmsis/device/stm32f030x6.h
+ include/cmsis/device/stm32f030x8.h
+ include/cmsis/device/stm32f078xx.h
+ include/cmsis/device/system_stm32f0xx.h
+ include/cmsis/device/stm32f038xx.h
+ include/cmsis/device/stm32f058xx.h
+ include/cmsis/device/stm32f070xb.h
+ include/cmsis/device/stm32f098xx.h
+ include/cmsis/device/stm32f070x6.h
+ include/cmsis/device/stm32f071xb.h
+ include/cmsis/device/stm32f030xc.h
+ include/cmsis/device/stm32f051x8.h
+ include/cmsis/device/stm32f072xb.h
+ include/cmsis/cmsis_device.h
+ include/cmsis/core_cm4.h
+ include/cmsis/core_sc000.h
+ include/cmsis/core_cmSimd.h
+ include/arm/semihosting.h
+ include/cortexm/ExceptionHandlers.h
+ include/diag/Trace.h
+)
+
+set(INCLUDE_DIRS
+ include/
+ include/cmsis
+ include/stm32f0xx
+ include/cmsis/device
+ config/
+)
+
+add_library(STM32_HAL_STM32F042x6 OBJECT ${SOURCES} src/cmsis/startup_stm32f042x6.S)
+ target_include_directories(STM32_HAL_STM32F042x6 PUBLIC ${INCLUDE_DIRS})
+ target_compile_options(STM32_HAL_STM32F042x6 PRIVATE -Wno-unused-parameter -Wno-deprecated)
+ target_compile_definitions(STM32_HAL_STM32F042x6 PUBLIC STM32F042x6)
+
+add_library(STM32_HAL_STM32F072xB OBJECT ${SOURCES} src/cmsis/startup_stm32f072xb.S)
+ target_include_directories(STM32_HAL_STM32F072xB PUBLIC ${INCLUDE_DIRS})
+ target_compile_options(STM32_HAL_STM32F072xB PRIVATE -Wno-unused-parameter -Wno-deprecated)
+ target_compile_definitions(STM32_HAL_STM32F072xB PUBLIC STM32F072xB)
diff --git a/include/stm32f0xx_hal_conf.h b/libs/STM32_HAL/config/stm32f0xx_hal_conf.h
similarity index 100%
rename from include/stm32f0xx_hal_conf.h
rename to libs/STM32_HAL/config/stm32f0xx_hal_conf.h
diff --git a/system/include/arm/semihosting.h b/libs/STM32_HAL/include/arm/semihosting.h
similarity index 100%
rename from system/include/arm/semihosting.h
rename to libs/STM32_HAL/include/arm/semihosting.h
diff --git a/system/include/cmsis/README_DEVICE.txt b/libs/STM32_HAL/include/cmsis/README_DEVICE.txt
similarity index 100%
rename from system/include/cmsis/README_DEVICE.txt
rename to libs/STM32_HAL/include/cmsis/README_DEVICE.txt
diff --git a/system/include/cmsis/arm_common_tables.h b/libs/STM32_HAL/include/cmsis/arm_common_tables.h
similarity index 100%
rename from system/include/cmsis/arm_common_tables.h
rename to libs/STM32_HAL/include/cmsis/arm_common_tables.h
diff --git a/system/include/cmsis/arm_const_structs.h b/libs/STM32_HAL/include/cmsis/arm_const_structs.h
similarity index 100%
rename from system/include/cmsis/arm_const_structs.h
rename to libs/STM32_HAL/include/cmsis/arm_const_structs.h
diff --git a/system/include/cmsis/arm_math.h b/libs/STM32_HAL/include/cmsis/arm_math.h
similarity index 100%
rename from system/include/cmsis/arm_math.h
rename to libs/STM32_HAL/include/cmsis/arm_math.h
diff --git a/system/include/cmsis/cmsis_armcc.h b/libs/STM32_HAL/include/cmsis/cmsis_armcc.h
similarity index 100%
rename from system/include/cmsis/cmsis_armcc.h
rename to libs/STM32_HAL/include/cmsis/cmsis_armcc.h
diff --git a/system/include/cmsis/cmsis_armcc_V6.h b/libs/STM32_HAL/include/cmsis/cmsis_armcc_V6.h
similarity index 100%
rename from system/include/cmsis/cmsis_armcc_V6.h
rename to libs/STM32_HAL/include/cmsis/cmsis_armcc_V6.h
diff --git a/system/include/cmsis/cmsis_device.h b/libs/STM32_HAL/include/cmsis/cmsis_device.h
similarity index 100%
rename from system/include/cmsis/cmsis_device.h
rename to libs/STM32_HAL/include/cmsis/cmsis_device.h
diff --git a/system/include/cmsis/cmsis_gcc.h b/libs/STM32_HAL/include/cmsis/cmsis_gcc.h
similarity index 100%
rename from system/include/cmsis/cmsis_gcc.h
rename to libs/STM32_HAL/include/cmsis/cmsis_gcc.h
diff --git a/system/include/cmsis/core_cm0.h b/libs/STM32_HAL/include/cmsis/core_cm0.h
similarity index 100%
rename from system/include/cmsis/core_cm0.h
rename to libs/STM32_HAL/include/cmsis/core_cm0.h
diff --git a/system/include/cmsis/core_cm0plus.h b/libs/STM32_HAL/include/cmsis/core_cm0plus.h
similarity index 100%
rename from system/include/cmsis/core_cm0plus.h
rename to libs/STM32_HAL/include/cmsis/core_cm0plus.h
diff --git a/system/include/cmsis/core_cm3.h b/libs/STM32_HAL/include/cmsis/core_cm3.h
similarity index 100%
rename from system/include/cmsis/core_cm3.h
rename to libs/STM32_HAL/include/cmsis/core_cm3.h
diff --git a/system/include/cmsis/core_cm4.h b/libs/STM32_HAL/include/cmsis/core_cm4.h
similarity index 100%
rename from system/include/cmsis/core_cm4.h
rename to libs/STM32_HAL/include/cmsis/core_cm4.h
diff --git a/system/include/cmsis/core_cm7.h b/libs/STM32_HAL/include/cmsis/core_cm7.h
similarity index 100%
rename from system/include/cmsis/core_cm7.h
rename to libs/STM32_HAL/include/cmsis/core_cm7.h
diff --git a/system/include/cmsis/core_cmFunc.h b/libs/STM32_HAL/include/cmsis/core_cmFunc.h
similarity index 100%
rename from system/include/cmsis/core_cmFunc.h
rename to libs/STM32_HAL/include/cmsis/core_cmFunc.h
diff --git a/system/include/cmsis/core_cmInstr.h b/libs/STM32_HAL/include/cmsis/core_cmInstr.h
similarity index 100%
rename from system/include/cmsis/core_cmInstr.h
rename to libs/STM32_HAL/include/cmsis/core_cmInstr.h
diff --git a/system/include/cmsis/core_cmSimd.h b/libs/STM32_HAL/include/cmsis/core_cmSimd.h
similarity index 100%
rename from system/include/cmsis/core_cmSimd.h
rename to libs/STM32_HAL/include/cmsis/core_cmSimd.h
diff --git a/system/include/cmsis/core_sc000.h b/libs/STM32_HAL/include/cmsis/core_sc000.h
similarity index 100%
rename from system/include/cmsis/core_sc000.h
rename to libs/STM32_HAL/include/cmsis/core_sc000.h
diff --git a/system/include/cmsis/core_sc300.h b/libs/STM32_HAL/include/cmsis/core_sc300.h
similarity index 100%
rename from system/include/cmsis/core_sc300.h
rename to libs/STM32_HAL/include/cmsis/core_sc300.h
diff --git a/system/include/cmsis/device/stm32f030x6.h b/libs/STM32_HAL/include/cmsis/device/stm32f030x6.h
similarity index 100%
rename from system/include/cmsis/device/stm32f030x6.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f030x6.h
diff --git a/system/include/cmsis/device/stm32f030x8.h b/libs/STM32_HAL/include/cmsis/device/stm32f030x8.h
similarity index 100%
rename from system/include/cmsis/device/stm32f030x8.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f030x8.h
diff --git a/system/include/cmsis/device/stm32f030xc.h b/libs/STM32_HAL/include/cmsis/device/stm32f030xc.h
similarity index 100%
rename from system/include/cmsis/device/stm32f030xc.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f030xc.h
diff --git a/system/include/cmsis/device/stm32f031x6.h b/libs/STM32_HAL/include/cmsis/device/stm32f031x6.h
similarity index 100%
rename from system/include/cmsis/device/stm32f031x6.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f031x6.h
diff --git a/system/include/cmsis/device/stm32f038xx.h b/libs/STM32_HAL/include/cmsis/device/stm32f038xx.h
similarity index 100%
rename from system/include/cmsis/device/stm32f038xx.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f038xx.h
diff --git a/system/include/cmsis/device/stm32f042x6.h b/libs/STM32_HAL/include/cmsis/device/stm32f042x6.h
similarity index 100%
rename from system/include/cmsis/device/stm32f042x6.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f042x6.h
diff --git a/system/include/cmsis/device/stm32f048xx.h b/libs/STM32_HAL/include/cmsis/device/stm32f048xx.h
similarity index 100%
rename from system/include/cmsis/device/stm32f048xx.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f048xx.h
diff --git a/system/include/cmsis/device/stm32f051x8.h b/libs/STM32_HAL/include/cmsis/device/stm32f051x8.h
similarity index 100%
rename from system/include/cmsis/device/stm32f051x8.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f051x8.h
diff --git a/system/include/cmsis/device/stm32f058xx.h b/libs/STM32_HAL/include/cmsis/device/stm32f058xx.h
similarity index 100%
rename from system/include/cmsis/device/stm32f058xx.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f058xx.h
diff --git a/system/include/cmsis/device/stm32f070x6.h b/libs/STM32_HAL/include/cmsis/device/stm32f070x6.h
similarity index 100%
rename from system/include/cmsis/device/stm32f070x6.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f070x6.h
diff --git a/system/include/cmsis/device/stm32f070xb.h b/libs/STM32_HAL/include/cmsis/device/stm32f070xb.h
similarity index 100%
rename from system/include/cmsis/device/stm32f070xb.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f070xb.h
diff --git a/system/include/cmsis/device/stm32f071xb.h b/libs/STM32_HAL/include/cmsis/device/stm32f071xb.h
similarity index 100%
rename from system/include/cmsis/device/stm32f071xb.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f071xb.h
diff --git a/system/include/cmsis/device/stm32f072xb.h b/libs/STM32_HAL/include/cmsis/device/stm32f072xb.h
similarity index 100%
rename from system/include/cmsis/device/stm32f072xb.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f072xb.h
diff --git a/system/include/cmsis/device/stm32f078xx.h b/libs/STM32_HAL/include/cmsis/device/stm32f078xx.h
similarity index 100%
rename from system/include/cmsis/device/stm32f078xx.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f078xx.h
diff --git a/system/include/cmsis/device/stm32f091xc.h b/libs/STM32_HAL/include/cmsis/device/stm32f091xc.h
similarity index 100%
rename from system/include/cmsis/device/stm32f091xc.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f091xc.h
diff --git a/system/include/cmsis/device/stm32f098xx.h b/libs/STM32_HAL/include/cmsis/device/stm32f098xx.h
similarity index 100%
rename from system/include/cmsis/device/stm32f098xx.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f098xx.h
diff --git a/system/include/cmsis/device/stm32f0xx.h b/libs/STM32_HAL/include/cmsis/device/stm32f0xx.h
similarity index 100%
rename from system/include/cmsis/device/stm32f0xx.h
rename to libs/STM32_HAL/include/cmsis/device/stm32f0xx.h
diff --git a/system/include/cmsis/device/system_stm32f0xx.h b/libs/STM32_HAL/include/cmsis/device/system_stm32f0xx.h
similarity index 100%
rename from system/include/cmsis/device/system_stm32f0xx.h
rename to libs/STM32_HAL/include/cmsis/device/system_stm32f0xx.h
diff --git a/system/include/cortexm/ExceptionHandlers.h b/libs/STM32_HAL/include/cortexm/ExceptionHandlers.h
similarity index 100%
rename from system/include/cortexm/ExceptionHandlers.h
rename to libs/STM32_HAL/include/cortexm/ExceptionHandlers.h
diff --git a/system/include/diag/Trace.h b/libs/STM32_HAL/include/diag/Trace.h
similarity index 100%
rename from system/include/diag/Trace.h
rename to libs/STM32_HAL/include/diag/Trace.h
diff --git a/system/include/stm32f0xx/Legacy/stm32_hal_legacy.h b/libs/STM32_HAL/include/stm32f0xx/Legacy/stm32_hal_legacy.h
similarity index 100%
rename from system/include/stm32f0xx/Legacy/stm32_hal_legacy.h
rename to libs/STM32_HAL/include/stm32f0xx/Legacy/stm32_hal_legacy.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_can.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_can.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_can.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_can.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_cortex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_cortex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_cortex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_cortex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_def.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_def.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_def.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_def.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_dma.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_dma.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_dma.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_dma.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_dma_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_dma_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_dma_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_dma_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_flash.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_flash.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_flash.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_flash.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_flash_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_flash_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_flash_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_flash_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_gpio.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_gpio.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_gpio.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_gpio.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_gpio_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_gpio_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_gpio_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_gpio_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_i2c.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_i2c.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_i2c.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_i2c.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_i2c_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_i2c_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_i2c_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_i2c_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_pcd.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pcd.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_pcd.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pcd.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_pcd_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pcd_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_pcd_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pcd_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_pwr.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pwr.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_pwr.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pwr.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_pwr_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pwr_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_pwr_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_pwr_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_rcc.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_rcc.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_rcc.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_rcc.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_rcc_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_rcc_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_rcc_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_rcc_ex.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_tim.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_tim.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_tim.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_tim.h
diff --git a/system/include/stm32f0xx/stm32f0xx_hal_tim_ex.h b/libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_tim_ex.h
similarity index 100%
rename from system/include/stm32f0xx/stm32f0xx_hal_tim_ex.h
rename to libs/STM32_HAL/include/stm32f0xx/stm32f0xx_hal_tim_ex.h
diff --git a/system/src/cmsis/startup_stm32f042x6.S b/libs/STM32_HAL/src/cmsis/startup_stm32f042x6.S
similarity index 100%
rename from system/src/cmsis/startup_stm32f042x6.S
rename to libs/STM32_HAL/src/cmsis/startup_stm32f042x6.S
diff --git a/system/src/cmsis/startup_stm32f072xb.S b/libs/STM32_HAL/src/cmsis/startup_stm32f072xb.S
similarity index 100%
rename from system/src/cmsis/startup_stm32f072xb.S
rename to libs/STM32_HAL/src/cmsis/startup_stm32f072xb.S
diff --git a/system/src/cmsis/system_stm32f0xx.c b/libs/STM32_HAL/src/cmsis/system_stm32f0xx.c
similarity index 100%
rename from system/src/cmsis/system_stm32f0xx.c
rename to libs/STM32_HAL/src/cmsis/system_stm32f0xx.c
diff --git a/system/src/cortexm/_initialize_hardware.c b/libs/STM32_HAL/src/cortexm/_initialize_hardware.c
similarity index 100%
rename from system/src/cortexm/_initialize_hardware.c
rename to libs/STM32_HAL/src/cortexm/_initialize_hardware.c
diff --git a/system/src/cortexm/_reset_hardware.c b/libs/STM32_HAL/src/cortexm/_reset_hardware.c
similarity index 100%
rename from system/src/cortexm/_reset_hardware.c
rename to libs/STM32_HAL/src/cortexm/_reset_hardware.c
diff --git a/system/src/cortexm/exception_handlers.c b/libs/STM32_HAL/src/cortexm/exception_handlers.c
similarity index 100%
rename from system/src/cortexm/exception_handlers.c
rename to libs/STM32_HAL/src/cortexm/exception_handlers.c
diff --git a/system/src/diag/Trace.c b/libs/STM32_HAL/src/diag/Trace.c
similarity index 100%
rename from system/src/diag/Trace.c
rename to libs/STM32_HAL/src/diag/Trace.c
diff --git a/system/src/diag/trace_impl.c b/libs/STM32_HAL/src/diag/trace_impl.c
similarity index 100%
rename from system/src/diag/trace_impl.c
rename to libs/STM32_HAL/src/diag/trace_impl.c
diff --git a/system/src/newlib/README.txt b/libs/STM32_HAL/src/newlib/README.txt
similarity index 100%
rename from system/src/newlib/README.txt
rename to libs/STM32_HAL/src/newlib/README.txt
diff --git a/system/src/newlib/_cxx.cpp b/libs/STM32_HAL/src/newlib/_cxx.cpp
similarity index 100%
rename from system/src/newlib/_cxx.cpp
rename to libs/STM32_HAL/src/newlib/_cxx.cpp
diff --git a/system/src/newlib/_exit.c b/libs/STM32_HAL/src/newlib/_exit.c
similarity index 100%
rename from system/src/newlib/_exit.c
rename to libs/STM32_HAL/src/newlib/_exit.c
diff --git a/system/src/newlib/_sbrk.c b/libs/STM32_HAL/src/newlib/_sbrk.c
similarity index 100%
rename from system/src/newlib/_sbrk.c
rename to libs/STM32_HAL/src/newlib/_sbrk.c
diff --git a/system/src/newlib/_startup.c b/libs/STM32_HAL/src/newlib/_startup.c
similarity index 100%
rename from system/src/newlib/_startup.c
rename to libs/STM32_HAL/src/newlib/_startup.c
diff --git a/system/src/newlib/_syscalls.c b/libs/STM32_HAL/src/newlib/_syscalls.c
similarity index 100%
rename from system/src/newlib/_syscalls.c
rename to libs/STM32_HAL/src/newlib/_syscalls.c
diff --git a/system/src/newlib/assert.c b/libs/STM32_HAL/src/newlib/assert.c
similarity index 100%
rename from system/src/newlib/assert.c
rename to libs/STM32_HAL/src/newlib/assert.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_can.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_can.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_can.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_can.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_cortex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_cortex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_cortex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_cortex.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_dma.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_dma.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_dma.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_dma.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_flash.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_flash.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_flash.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_flash.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_flash_ex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_flash_ex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_flash_ex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_flash_ex.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_gpio.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_gpio.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_gpio.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_gpio.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_i2c.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_i2c.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_i2c.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_i2c.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_i2c_ex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_i2c_ex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_i2c_ex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_i2c_ex.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_pcd.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pcd.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_pcd.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pcd.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_pcd_ex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pcd_ex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_pcd_ex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pcd_ex.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_pwr.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pwr.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_pwr.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pwr.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_pwr_ex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pwr_ex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_pwr_ex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_pwr_ex.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_rcc.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_rcc.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_rcc.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_rcc.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_rcc_ex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_rcc_ex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_rcc_ex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_rcc_ex.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_tim.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_tim.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_tim.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_tim.c
diff --git a/system/src/stm32f0xx/stm32f0xx_hal_tim_ex.c b/libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_tim_ex.c
similarity index 100%
rename from system/src/stm32f0xx/stm32f0xx_hal_tim_ex.c
rename to libs/STM32_HAL/src/stm32f0xx/stm32f0xx_hal_tim_ex.c
diff --git a/libs/STM32_USB_Device_Library/CMakeLists.txt b/libs/STM32_USB_Device_Library/CMakeLists.txt
new file mode 100644
index 0000000..442c538
--- /dev/null
+++ b/libs/STM32_USB_Device_Library/CMakeLists.txt
@@ -0,0 +1,26 @@
+project(STM32_USB_Device_Library)
+
+set(SOURCES
+ Core/Inc/usbd_def.h
+ Core/Inc/usbd_ctlreq.h
+ Core/Src/usbd_ctlreq.c
+ Core/Inc/usbd_ioreq.h
+ Core/Src/usbd_ioreq.c
+ Core/Inc/usbd_core.h
+ Core/Src/usbd_core.c
+)
+
+set(INCLUDE_DIRS
+ Core/Inc/
+ config/
+)
+
+add_library(STM32_USB_Device_Library_STM32F042x6 STATIC ${SOURCES})
+ target_include_directories(STM32_USB_Device_Library_STM32F042x6 PUBLIC ${INCLUDE_DIRS})
+ target_compile_options(STM32_USB_Device_Library_STM32F042x6 PRIVATE -Wno-unused-parameter)
+ target_link_libraries(STM32_USB_Device_Library_STM32F042x6 PRIVATE STM32_HAL_STM32F042x6)
+
+add_library(STM32_USB_Device_Library_STM32F072xB STATIC ${SOURCES})
+ target_include_directories(STM32_USB_Device_Library_STM32F072xB PUBLIC ${INCLUDE_DIRS})
+ target_compile_options(STM32_USB_Device_Library_STM32F072xB PRIVATE -Wno-unused-parameter)
+ target_link_libraries(STM32_USB_Device_Library_STM32F072xB PRIVATE STM32_HAL_STM32F072xB)
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h b/libs/STM32_USB_Device_Library/Core/Inc/usbd_core.h
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h
rename to libs/STM32_USB_Device_Library/Core/Inc/usbd_core.h
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h b/libs/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
rename to libs/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h b/libs/STM32_USB_Device_Library/Core/Inc/usbd_def.h
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h
rename to libs/STM32_USB_Device_Library/Core/Inc/usbd_def.h
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h b/libs/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
rename to libs/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c b/libs/STM32_USB_Device_Library/Core/Src/usbd_core.c
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
rename to libs/STM32_USB_Device_Library/Core/Src/usbd_core.c
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c b/libs/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
rename to libs/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c b/libs/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c
similarity index 100%
rename from Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c
rename to libs/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c
diff --git a/include/usbd_conf.h b/libs/STM32_USB_Device_Library/config/usbd_conf.h
similarity index 100%
rename from include/usbd_conf.h
rename to libs/STM32_USB_Device_Library/config/usbd_conf.h
diff --git a/src/usbd_desc.c b/src/usbd_desc.c
index 0553648..f4938ff 100644
--- a/src/usbd_desc.c
+++ b/src/usbd_desc.c
@@ -27,6 +27,7 @@ THE SOFTWARE.
#include "usbd_core.h"
#include "usbd_desc.h"
#include "config.h"
+#include "util.h"
uint8_t *USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
uint8_t *USBD_FS_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
@@ -121,7 +122,7 @@ uint8_t *USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
hex32(buf + 8, *(uint32_t*)(UID_BASE + 4));
hex32(buf + 16, *(uint32_t*)(UID_BASE + 8));
- USBD_GetString(buf, USBD_StrDesc, length);
+ USBD_GetString((uint8_t*)buf, USBD_StrDesc, length);
return USBD_StrDesc;
}