VPATH += :$(HALPATH)/stm32l4
VPATH += :$(HALPATH)/stm32l4/Src
SRC += stm32l4_hal.c \
       stm32l4xx_hal.c \
       stm32l4xx_hal_rcc.c \
       stm32l4xx_hal_rcc_ex.c \
       stm32l4xx_hal_gpio.c \
       stm32l4xx_hal_uart.c \
       stm32l4xx_hal_pwr.c \
       stm32l4xx_hal_pwr_ex.c \
       stm32l4xx_hal_cortex.c \
       stm32l4xx_hal_cryp.c \
       stm32l4xx_hal_cryp_ex.c

EXTRAINCDIRS += $(HALPATH)/stm32l4 $(HALPATH)/stm32l4/Inc $(HALPATH)/stm32l4/Inc/Legacy $(HALPATH)/stm32l4/CMSIS/Include

ASRC += startup_stm32l443xx.S

MCU_FLAGS = -mcpu=cortex-m4

CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump
SIZE = arm-none-eabi-size
AR = arm-none-eabi-ar rcs
NM = arm-none-eabi-nm

#Output Format = Binary for this target
FORMAT = binary

CFLAGS += -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections
CPPFLAGS += -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections
ASFLAGS += -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections

CDEFS += -DSTM32L433RCTx -DSTM32L4 -DSTM32 -DDEBUG -DSTM32L443xx -DHSE_VALUE=7372800UL
CPPDEFS += -DSTM32L433RCTx -DSTM32L4 -DSTM32 -DDEBUG -DHSE_VALUE=7372800UL

LDFLAGS +=  --specs=nano.specs -T $(HALPATH)/stm32l4/STM32L443RCTx_FLASH.ld -Wl,--gc-sections -lm