Rev 29 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 28 | mjames | 1 | ########################################################################################################################## |
| 29 | mjames | 2 | # File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Sat Nov 07 12:03:30 GMT 2020] |
| 28 | mjames | 3 | ########################################################################################################################## |
| 2 | mjames | 4 | |
| 28 | mjames | 5 | # ------------------------------------------------ |
| 6 | # Generic Makefile (based on gcc) |
||
| 7 | # |
||
| 8 | # ChangeLog : |
||
| 9 | # 2017-02-10 - Several enhancements + project update mode |
||
| 10 | # 2015-07-22 - first version |
||
| 11 | # ------------------------------------------------ |
||
| 2 | mjames | 12 | |
| 28 | mjames | 13 | ###################################### |
| 14 | # target |
||
| 15 | ###################################### |
||
| 16 | TARGET = EngineBay2 |
||
| 2 | mjames | 17 | |
| 18 | |||
| 28 | mjames | 19 | ###################################### |
| 20 | # building variables |
||
| 21 | ###################################### |
||
| 22 | # debug build? |
||
| 23 | DEBUG = 1 |
||
| 24 | # optimization |
||
| 30 | mjames | 25 | OPT = -Og |
| 2 | mjames | 26 | |
| 27 | |||
| 28 | mjames | 28 | ####################################### |
| 29 | # paths |
||
| 30 | ####################################### |
||
| 31 | # Build path |
||
| 32 | BUILD_DIR = build |
||
| 2 | mjames | 33 | |
| 28 | mjames | 34 | ###################################### |
| 35 | # source |
||
| 36 | ###################################### |
||
| 37 | # C sources |
||
| 38 | C_SOURCES = \ |
||
| 39 | Src/main.c \ |
||
| 40 | Src/stm32l1xx_it.c \ |
||
| 41 | Src/stm32l1xx_hal_msp.c \ |
||
| 42 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_adc.c \ |
||
| 43 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_adc_ex.c \ |
||
| 44 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal.c \ |
||
| 45 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_rcc.c \ |
||
| 46 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_rcc_ex.c \ |
||
| 47 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_flash.c \ |
||
| 48 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_flash_ex.c \ |
||
| 49 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_flash_ramfunc.c \ |
||
| 50 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_gpio.c \ |
||
| 51 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_dma.c \ |
||
| 52 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_pwr.c \ |
||
| 53 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_pwr_ex.c \ |
||
| 54 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_cortex.c \ |
||
| 55 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_exti.c \ |
||
| 56 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_spi.c \ |
||
| 57 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_tim.c \ |
||
| 58 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_tim_ex.c \ |
||
| 59 | Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_uart.c \ |
||
| 60 | Src/system_stm32l1xx.c |
||
| 2 | mjames | 61 | |
| 28 | mjames | 62 | # ASM sources |
| 63 | ASM_SOURCES = \ |
||
| 64 | startup_stm32l152xe.s |
||
| 2 | mjames | 65 | |
| 66 | |||
| 67 | |||
| 68 | |||
| 28 | mjames | 69 | ####################################### |
| 70 | # binaries |
||
| 71 | ####################################### |
||
| 72 | PREFIX = arm-none-eabi- |
||
| 73 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) |
||
| 74 | # either it can be added to the PATH environment variable. |
||
| 75 | ifdef GCC_PATH |
||
| 76 | CC = $(GCC_PATH)/$(PREFIX)gcc |
||
| 77 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp |
||
| 78 | CP = $(GCC_PATH)/$(PREFIX)objcopy |
||
| 79 | SZ = $(GCC_PATH)/$(PREFIX)size |
||
| 80 | else |
||
| 81 | CC = $(PREFIX)gcc |
||
| 82 | AS = $(PREFIX)gcc -x assembler-with-cpp |
||
| 83 | CP = $(PREFIX)objcopy |
||
| 84 | SZ = $(PREFIX)size |
||
| 85 | endif |
||
| 86 | HEX = $(CP) -O ihex |
||
| 87 | BIN = $(CP) -O binary -S |
||
| 88 | |||
| 89 | ####################################### |
||
| 90 | # CFLAGS |
||
| 91 | ####################################### |
||
| 92 | # cpu |
||
| 93 | CPU = -mcpu=cortex-m3 |
||
| 2 | mjames | 94 | |
| 28 | mjames | 95 | # fpu |
| 96 | # NONE for Cortex-M0/M0+/M3 |
||
| 2 | mjames | 97 | |
| 28 | mjames | 98 | # float-abi |
| 2 | mjames | 99 | |
| 100 | |||
| 28 | mjames | 101 | # mcu |
| 102 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) |
||
| 2 | mjames | 103 | |
| 28 | mjames | 104 | # macros for gcc |
| 105 | # AS defines |
||
| 106 | AS_DEFS = |
||
| 2 | mjames | 107 | |
| 28 | mjames | 108 | # C defines |
| 109 | C_DEFS = \ |
||
| 110 | -DUSE_HAL_DRIVER \ |
||
| 111 | -DSTM32L152xE |
||
| 2 | mjames | 112 | |
| 113 | |||
| 28 | mjames | 114 | # AS includes |
| 115 | AS_INCLUDES = |
||
| 2 | mjames | 116 | |
| 28 | mjames | 117 | # C includes |
| 118 | C_INCLUDES = \ |
||
| 119 | -IInc \ |
||
| 120 | -IDrivers/STM32L1xx_HAL_Driver/Inc \ |
||
| 121 | -IDrivers/STM32L1xx_HAL_Driver/Inc/Legacy \ |
||
| 122 | -IDrivers/CMSIS/Device/ST/STM32L1xx/Include \ |
||
| 123 | -IDrivers/CMSIS/Include |
||
| 2 | mjames | 124 | |
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | |||
| 28 | mjames | 129 | ####################################################### |
| 130 | # Additional code |
||
| 2 | mjames | 131 | |
| 28 | mjames | 132 | C_SOURCES += Src/misc.c |
| 2 | mjames | 133 | |
| 134 | |||
| 28 | mjames | 135 | # PLX code library |
| 136 | LIBPLX=../libPLX |
||
| 137 | include $(LIBPLX)/libPLX.mk |
||
| 2 | mjames | 138 | |
| 139 | |||
| 140 | |||
| 28 | mjames | 141 | # Using UART1 and UART2 with LibSerial. |
| 142 | C_DEFS += -DSERIAL_UART1 -DSERIAL_UART2 |
||
| 2 | mjames | 143 | |
| 28 | mjames | 144 | LIBSERIAL=../libSerial |
| 145 | include $(LIBSERIAL)/libSerial.mk |
||
| 2 | mjames | 146 | |
| 147 | |||
| 148 | ####################################################### |
||
| 28 | mjames | 149 | # compile gcc flags |
| 150 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
| 2 | mjames | 151 | |
| 28 | mjames | 152 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
| 2 | mjames | 153 | |
| 28 | mjames | 154 | ifeq ($(DEBUG), 1) |
| 155 | CFLAGS += -g -gdwarf-2 |
||
| 156 | endif |
||
| 2 | mjames | 157 | |
| 158 | |||
| 28 | mjames | 159 | # Generate dependency information |
| 160 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" |
||
| 2 | mjames | 161 | |
| 162 | |||
| 28 | mjames | 163 | ####################################### |
| 164 | # LDFLAGS |
||
| 165 | ####################################### |
||
| 166 | # link script |
||
| 167 | LDSCRIPT = STM32L152RETx_FLASH.ld |
||
| 2 | mjames | 168 | |
| 28 | mjames | 169 | # libraries |
| 170 | LIBS = -lc -lm -lnosys |
||
| 171 | LIBDIR = |
||
| 172 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections |
||
| 2 | mjames | 173 | |
| 28 | mjames | 174 | # default action: build all |
| 175 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin |
||
| 2 | mjames | 176 | |
| 177 | |||
| 28 | mjames | 178 | ####################################### |
| 179 | # build the application |
||
| 180 | ####################################### |
||
| 181 | # list of objects |
||
| 182 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) |
||
| 183 | vpath %.c $(sort $(dir $(C_SOURCES))) |
||
| 184 | # list of ASM program objects |
||
| 185 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) |
||
| 186 | vpath %.s $(sort $(dir $(ASM_SOURCES))) |
||
| 2 | mjames | 187 | |
| 28 | mjames | 188 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) |
| 189 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
| 2 | mjames | 190 | |
| 28 | mjames | 191 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) |
| 192 | $(AS) -c $(CFLAGS) $< -o $@ |
||
| 9 | mjames | 193 | |
| 28 | mjames | 194 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile |
| 195 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ |
||
| 196 | $(SZ) $@ |
||
| 9 | mjames | 197 | |
| 28 | mjames | 198 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
| 199 | $(HEX) $< $@ |
||
| 2 | mjames | 200 | |
| 28 | mjames | 201 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
| 202 | $(BIN) $< $@ |
||
| 9 | mjames | 203 | |
| 28 | mjames | 204 | $(BUILD_DIR): |
| 205 | mkdir $@ |
||
| 2 | mjames | 206 | |
| 28 | mjames | 207 | ####################################### |
| 208 | # clean up |
||
| 209 | ####################################### |
||
| 210 | clean: |
||
| 211 | -rm -fR $(BUILD_DIR) |
||
| 212 | |||
| 213 | ####################################### |
||
| 214 | # dependencies |
||
| 215 | ####################################### |
||
| 216 | -include $(wildcard $(BUILD_DIR)/*.d) |
||
| 2 | mjames | 217 | |
| 28 | mjames | 218 | # *** EOF *** |