Makefile 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. ##########################################################################################################################
  2. # File automatically-generated by tool: [projectgenerator] version: [4.1.0] date: [Thu May 16 15:52:03 MSK 2024]
  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 = RFDA4005
  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. Core/Src/RFDAproto.c \
  33. Core/Src/main.c \
  34. Core/Src/stm32f1xx_it.c \
  35. Core/Src/stm32f1xx_hal_msp.c \
  36. USB_DEVICE/App/usb_device.c \
  37. USB_DEVICE/App/usbd_desc.c \
  38. USB_DEVICE/App/usbd_cdc_if.c \
  39. USB_DEVICE/Target/usbd_conf.c \
  40. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
  41. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c \
  42. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
  43. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
  44. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
  45. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c \
  46. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c \
  47. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c \
  48. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
  49. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
  50. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
  51. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
  52. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
  53. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
  54. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
  55. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
  56. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
  57. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
  58. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_adc.c \
  59. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c \
  60. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
  61. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
  62. Core/Src/system_stm32f1xx.c \
  63. Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
  64. Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
  65. Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
  66. Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
  67. Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c
  68. # ASM sources
  69. ASM_SOURCES = \
  70. startup_stm32f103xb.s
  71. #######################################
  72. # binaries
  73. #######################################
  74. PREFIX = arm-none-eabi-
  75. # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
  76. # either it can be added to the PATH environment variable.
  77. ifdef GCC_PATH
  78. CC = $(GCC_PATH)/$(PREFIX)gcc
  79. AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
  80. CP = $(GCC_PATH)/$(PREFIX)objcopy
  81. SZ = $(GCC_PATH)/$(PREFIX)size
  82. else
  83. CC = $(PREFIX)gcc
  84. AS = $(PREFIX)gcc -x assembler-with-cpp
  85. CP = $(PREFIX)objcopy
  86. SZ = $(PREFIX)size
  87. endif
  88. HEX = $(CP) -O ihex
  89. BIN = $(CP) -O binary -S
  90. #######################################
  91. # CFLAGS
  92. #######################################
  93. # cpu
  94. CPU = -mcpu=cortex-m3
  95. # fpu
  96. # NONE for Cortex-M0/M0+/M3
  97. # float-abi
  98. # mcu
  99. MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
  100. # macros for gcc
  101. # AS defines
  102. AS_DEFS =
  103. # C defines
  104. C_DEFS = \
  105. -DUSE_FULL_LL_DRIVER \
  106. -DUSE_HAL_DRIVER \
  107. -DSTM32F103xB
  108. # AS includes
  109. AS_INCLUDES =
  110. # C includes
  111. C_INCLUDES = \
  112. -IUSB_DEVICE/App \
  113. -IUSB_DEVICE/Target \
  114. -ICore/Inc \
  115. -IDrivers/STM32F1xx_HAL_Driver/Inc \
  116. -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
  117. -IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
  118. -IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
  119. -IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
  120. -IDrivers/CMSIS/Include
  121. # compile gcc flags
  122. ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
  123. CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
  124. ifeq ($(DEBUG), 1)
  125. CFLAGS += -g -gdwarf-2
  126. endif
  127. # Generate dependency information
  128. CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
  129. #######################################
  130. # LDFLAGS
  131. #######################################
  132. # link script
  133. LDSCRIPT = STM32F103C8Tx_FLASH.ld
  134. # libraries
  135. LIBS = -lc -lm -lnosys
  136. LIBDIR =
  137. LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
  138. # default action: build all
  139. all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
  140. #######################################
  141. # build the application
  142. #######################################
  143. # list of objects
  144. OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
  145. vpath %.c $(sort $(dir $(C_SOURCES)))
  146. # list of ASM program objects
  147. OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
  148. vpath %.s $(sort $(dir $(ASM_SOURCES)))
  149. $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
  150. $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
  151. $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
  152. $(AS) -c $(CFLAGS) $< -o $@
  153. $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
  154. $(CC) $(OBJECTS) $(LDFLAGS) -o $@
  155. $(SZ) $@
  156. $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
  157. $(HEX) $< $@
  158. $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
  159. $(BIN) $< $@
  160. $(BUILD_DIR):
  161. mkdir $@
  162. #######################################
  163. # clean up
  164. #######################################
  165. clean:
  166. -rm -fR $(BUILD_DIR)
  167. #######################################
  168. # dependencies
  169. #######################################
  170. -include $(wildcard $(BUILD_DIR)/*.d)
  171. # *** EOF ***