Makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. ##########################################################################################################################
  2. # File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Fri Oct 02 17:54:23 MSK 2020]
  3. ##########################################################################################################################
  4. # ------------------------------------------------
  5. # Generic Makefile (based on gcc)
  6. #
  7. # ChangeLog :
  8. # 2017-02-10 - Several enhancements + project update mode
  9. # 2015-07-22 - first version
  10. # ------------------------------------------------
  11. ######################################
  12. # target
  13. ######################################
  14. TARGET = cube
  15. ######################################
  16. # building variables
  17. ######################################
  18. # debug build?
  19. DEBUG = 1
  20. # optimization
  21. OPT = -Og
  22. #######################################
  23. # paths
  24. #######################################
  25. # Build path
  26. BUILD_DIR = build
  27. ######################################
  28. # source
  29. ######################################
  30. # C sources
  31. C_SOURCES = \
  32. Src/main.c \
  33. Src/gpio.c \
  34. Src/freertos.c \
  35. Src/adc.c \
  36. Src/comp.c \
  37. Src/spi.c \
  38. Src/tim.c \
  39. Src/usart.c \
  40. Src/usb_device.c \
  41. Src/usbd_conf.c \
  42. Src/usbd_desc.c \
  43. Src/usbd_cdc_if.c \
  44. Src/stm32l4xx_it.c \
  45. Src/stm32l4xx_hal_msp.c \
  46. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c \
  47. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c \
  48. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usb.c \
  49. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
  50. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c \
  51. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c \
  52. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c \
  53. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c \
  54. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c \
  55. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c \
  56. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c \
  57. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c \
  58. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c \
  59. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c \
  60. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \
  61. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \
  62. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \
  63. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \
  64. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c \
  65. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c \
  66. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_comp.c \
  67. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \
  68. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \
  69. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \
  70. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c \
  71. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \
  72. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \
  73. Src/system_stm32l4xx.c \
  74. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \
  75. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \
  76. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/list.c \
  77. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/queue.c \
  78. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \
  79. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/tasks.c \
  80. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/timers.c \
  81. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \
  82. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
  83. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
  84. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
  85. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
  86. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
  87. /Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \
  88. Src/stm32l4xx_hal_timebase_tim.c
  89. # ASM sources
  90. ASM_SOURCES = \
  91. startup_stm32l476xx.s
  92. #######################################
  93. # binaries
  94. #######################################
  95. PREFIX = arm-none-eabi-
  96. # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
  97. # either it can be added to the PATH environment variable.
  98. ifdef GCC_PATH
  99. CC = $(GCC_PATH)/$(PREFIX)gcc
  100. AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
  101. CP = $(GCC_PATH)/$(PREFIX)objcopy
  102. SZ = $(GCC_PATH)/$(PREFIX)size
  103. else
  104. CC = $(PREFIX)gcc
  105. AS = $(PREFIX)gcc -x assembler-with-cpp
  106. CP = $(PREFIX)objcopy
  107. SZ = $(PREFIX)size
  108. endif
  109. HEX = $(CP) -O ihex
  110. BIN = $(CP) -O binary -S
  111. #######################################
  112. # CFLAGS
  113. #######################################
  114. # cpu
  115. CPU = -mcpu=cortex-m4
  116. # fpu
  117. FPU = -mfpu=fpv4-sp-d16
  118. # float-abi
  119. FLOAT-ABI = -mfloat-abi=hard
  120. # mcu
  121. MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
  122. # macros for gcc
  123. # AS defines
  124. AS_DEFS =
  125. # C defines
  126. C_DEFS = \
  127. -DUSE_HAL_DRIVER \
  128. -DSTM32L476xx
  129. # AS includes
  130. AS_INCLUDES = \
  131. -IInc
  132. # C includes
  133. C_INCLUDES = \
  134. -IInc \
  135. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Inc \
  136. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy \
  137. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/include \
  138. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \
  139. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
  140. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \
  141. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
  142. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/CMSIS/Device/ST/STM32L4xx/Include \
  143. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/CMSIS/Include
  144. -I/Users/aku/Work/flipper/flipperzero-firmware-community/lib/STM32CubeL4/Drivers/CMSIS/Include
  145. # compile gcc flags
  146. ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
  147. CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
  148. ifeq ($(DEBUG), 1)
  149. CFLAGS += -g -gdwarf-2
  150. endif
  151. # Generate dependency information
  152. CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
  153. #######################################
  154. # LDFLAGS
  155. #######################################
  156. # link script
  157. LDSCRIPT = STM32L476RGTx_FLASH.ld
  158. # libraries
  159. LIBS = -lc -lm -lnosys
  160. LIBDIR =
  161. LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
  162. # default action: build all
  163. all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
  164. #######################################
  165. # build the application
  166. #######################################
  167. # list of objects
  168. OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
  169. vpath %.c $(sort $(dir $(C_SOURCES)))
  170. # list of ASM program objects
  171. OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
  172. vpath %.s $(sort $(dir $(ASM_SOURCES)))
  173. $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
  174. $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
  175. $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
  176. $(AS) -c $(CFLAGS) $< -o $@
  177. $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
  178. $(CC) $(OBJECTS) $(LDFLAGS) -o $@
  179. $(SZ) $@
  180. $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
  181. $(HEX) $< $@
  182. $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
  183. $(BIN) $< $@
  184. $(BUILD_DIR):
  185. mkdir $@
  186. #######################################
  187. # clean up
  188. #######################################
  189. clean:
  190. -rm -fR $(BUILD_DIR)
  191. #######################################
  192. # dependencies
  193. #######################################
  194. -include $(wildcard $(BUILD_DIR)/*.d)
  195. # *** EOF ***