########################################################################################################################## # File automatically-generated by tool: [projectgenerator] version: [2.26.0] date: [Thu Nov 16 09:19:43 CET 2017] ########################################################################################################################## # ------------------------------------------------ # Generic Makefile (based on gcc) # # ChangeLog : # 2017-02-10 - Several enhancements + project update mode # 2015-07-22 - first version # ------------------------------------------------ ###################################### # target ###################################### TARGET = bees ###################################### # building variables ###################################### # debug build? DEBUG = 1 # optimization OPT = -Og ####################################### # paths ####################################### # Build path BUILD_DIR = build ###################################### # source ###################################### # C sources C_SOURCES = \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_comp_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lptim.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_smartcard.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_usart.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_smbus.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rtc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_crc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_adc_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_spi.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_crs.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_comp.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cryp_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pcd.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rng.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dac.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_wwdg.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ramfunc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rtc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2s.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_irda.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lptim.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_comp.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_crc_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_smartcard_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rng.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_adc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cryp.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_firewall.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rtc_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_iwdg.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tsc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dac_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dma.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lcd.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_adc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dac.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pcd_ex.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_crc.c \ ./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c \ ./Drivers/BSP/sx1272mb2das/sx1272mb2das.c \ ./Drivers/BSP/Components/sx1272/sx1272.c \ ./Middlewares/Third_Party/Lora/Core/lora.c \ ./Middlewares/Third_Party/Lora/Crypto/aes.c \ ./Middlewares/Third_Party/Lora/Crypto/cmac.c \ ./Middlewares/Third_Party/Lora/Mac/region/RegionCommon.c \ ./Middlewares/Third_Party/Lora/Mac/region/Region.c \ ./Middlewares/Third_Party/Lora/Mac/region/RegionEU868.c \ ./Middlewares/Third_Party/Lora/Mac/LoRaMac.c \ ./Middlewares/Third_Party/Lora/Mac/LoRaMacCrypto.c \ ./Middlewares/Third_Party/Lora/Utilities/delay.c \ ./Middlewares/Third_Party/Lora/Utilities/timeServer.c \ ./Middlewares/Third_Party/Lora/Utilities/utilities.c \ ./Middlewares/Third_Party/Lora/Utilities/low_power.c \ ./Src/vcom.c \ ./Src/stm32l0xx_hw.c \ ./Src/hw_rtc.c \ ./Src/stm32l0xx_hal_msp.c \ ./Src/debug.c \ ./Src/hw_i2c.c \ ./Src/hw_gpio.c \ ./Src/hw_spi.c \ ./Src/main.c \ ./Src/system_stm32l0xx.c \ ./Src/stm32l0xx_it.c \ Src/voc_sensor.c \ Drivers/BME680/bme680.c # ASM sources ASM_SOURCES = \ startup/startup_stm32l073xx.s ###################################### # firmware library ###################################### PERIFLIB_SOURCES = ####################################### # binaries ####################################### BINPATH = /bin PREFIX = arm-none-eabi- CC = $(BINPATH)/$(PREFIX)gcc AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp CP = $(BINPATH)/$(PREFIX)objcopy AR = $(BINPATH)/$(PREFIX)ar SZ = $(BINPATH)/$(PREFIX)size HEX = $(CP) -O ihex BIN = $(CP) -O binary -S ####################################### # CFLAGS ####################################### # cpu CPU = -mcpu=cortex-m0plus # fpu # NONE for Cortex-M0/M0+/M3 # float-abi # mcu MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) # macros for gcc # AS defines AS_DEFS = # C defines C_DEFS = \ -DUSE_HAL_DRIVER \ -DSTM32L073xx \ -DREGION_EU868 \ -DUSE_FULL_LL_DRIVER # AS includes AS_INCLUDES = # C includes C_INCLUDES = \ -IInc \ -IDrivers/STM32L0xx_HAL_Driver/Inc \ -IDrivers/STM32L0xx_HAL_Driver/Inc/Legacy \ -IDrivers/CMSIS/Device/ST/STM32L0xx/Include \ -IDrivers/CMSIS/Include \ -IMiddlewares/Third_Party/Lora/Core \ -IMiddlewares/Third_Party/Lora/Crypto \ -IMiddlewares/Third_Party/Lora/Mac \ -IMiddlewares/Third_Party/Lora/Phy \ -IMiddlewares/Third_Party/Lora/Utilities \ -IMiddlewares/Third_Party/Lora/Mac/region \ -IDrivers/BSP/Components/sx1272 # compile gcc flags ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) CFLAGS += -ggdb -g -gdwarf-2 endif # Generate dependency information CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" CFLAGS += -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" CFLAGS += -std=gnu99 -Wfatal-errors CFLAGS += -Wall -Wextra -Wshadow CFLAGS += -Wwrite-strings -Wold-style-definition -Winline -Wno-missing-noreturn -Wstrict-prototypes CFLAGS += -Wredundant-decls -Wfloat-equal -Wsign-compare CFLAGS += -fno-common -ffunction-sections -fdata-sections -Wno-unused-function CFLAGS += -MD -Wno-format-zero-length -Wno-redundant-decls -Wno-unused-parameter CFLAGS += -Wno-discarded-qualifiers -Wno-unused-variable CFLAGS += -Wno-float-equal -Wno-implicit-fallthrough CFLAGS += -fmerge-constants -fmerge-all-constants -finline-small-functions -findirect-inlining ####################################### # LDFLAGS ####################################### # link script LDSCRIPT = STM32L073RZTx_FLASH.ld # libraries LIBS = -lc -lm -lnosys LIBDIR = LDFLAGS = $(MCU) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections # -specs=nano.specs # default action: build all all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin ####################################### # build the application ####################################### # list of objects OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) vpath %.c $(sort $(dir $(C_SOURCES))) # list of ASM program objects OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) vpath %.s $(sort $(dir $(ASM_SOURCES))) .PHONY: flash dis $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) @$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) @$(AS) -c $(CFLAGS) $< -o $@ $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile @$(CC) $(OBJECTS) $(LDFLAGS) -o $@ @$(SZ) $@ $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) @$(HEX) $< $@ $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) @$(BIN) $< $@ $(BUILD_DIR): @mkdir -p $@ flash: $(BUILD_DIR)/$(TARGET).bin @printf " FLASH $<\n" @st-flash write $< 0x8000000 dis: $(BUILD_DIR)/$(TARGET).elf @arm-none-eabi-objdump -Sslrtd build/mf103.elf > disassembly.lst ####################################### # clean up ####################################### clean: -rm -fR .dep $(BUILD_DIR) ####################################### # dependencies ####################################### -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) # *** EOF ***