Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. TARGET := stm32$(HARDWARE)service
  2. #ifeq ($(DEBUG), 1)
  3. CFLAGS += -DDEBUG -g
  4. #endif
  5. ifeq ($(MAC),)
  6. #Print default MAC
  7. MAC = $(shell awk '/\#define DEVICE_MAC/{print $$3}' ./modules/settings_api.h )
  8. else
  9. #Set device MAC
  10. CFLAGS += -DDEVICE_MAC='"$(MAC)"'
  11. endif
  12. ifeq ($(FLASH_ERASE), 1)
  13. CFLAGS += -DFLASH_ERASE
  14. endif
  15. CFLAGS += -DBT6702_SERVICE
  16. CFLAGS += -DPRINTF_$(shell echo $(PRINTF) | tr a-z A-Z)
  17. INCLUDES = -I../config
  18. INCLUDES += -I../stm32/stm32f4xx_spl/inc
  19. INCLUDES += -I../stm32/system
  20. INCLUDES += -I../peripheral_modules/inc
  21. INCLUDES += -I../thirdparty/TinyStdio
  22. INCLUDES += -IUser
  23. INCLUDES += -IHardware
  24. INCLUDES += -ICommands
  25. INCLUDES += -ISettings
  26. INCLUDES += -IConsole
  27. INCLUDES += -I.
  28. CSRC = $(wildcard ../stm32/stm32f4xx_spl/src/*.c)
  29. CSRC += $(wildcard ../stm32/system/*.c)
  30. CSRC += $(wildcard ../peripheral_modules/src/*.c)
  31. CSRC += $(wildcard ../thirdparty/TinyStdio/*.c)
  32. CSRC += $(wildcard User/*.c)
  33. CSRC += $(wildcard Hardware/*.c)
  34. CSRC += $(wildcard Commands/*.c)
  35. CSRC += $(wildcard Settings/*.c)
  36. CSRC += $(wildcard Console/*.c)
  37. CSRC += $(wildcard *.c)
  38. INCLUDES += -Ileds
  39. INCLUDES += -Ibuttons
  40. INCLUDES += -I../modules/jumper
  41. INCLUDES += -I../modules/d_inouts
  42. INCLUDES += -I../modules/common/
  43. INCLUDES += -I../modules/mbedtls_api
  44. INCLUDES += -I../modules
  45. CSRC += $(wildcard leds/*.c)
  46. CSRC += $(wildcard buttons/*.c)
  47. CSRC += $(wildcard ../modules/jumper/*.c)
  48. CSRC += $(wildcard ../modules/d_inouts/*.c)
  49. CSRC += $(wildcard ../modules/common/*.c)
  50. #CSRC += $(wildcard ../modules/mbedtls_api/*.c)
  51. CSRC += $(wildcard ../modules/*.c)
  52. CFLAGS += -DOS_FREERTOS
  53. CFLAGS += -DHARDWARE_$(shell echo $(HARDWARE) | tr a-z A-Z)
  54. #FreeRTOS
  55. LDSCRIPT := ../modules/startup/stm32_flash.ld
  56. INCLUDES += -I../thirdparty/FreeRTOS/include -I../thirdparty/FreeRTOS/portable/GCC/ARM_CM3
  57. CSRC += $(wildcard ../thirdparty/FreeRTOS/*.c ../thirdparty/FreeRTOS/portable/GCC/ARM_CM3/*.c)
  58. ASMSRC = ../modules/startup/startup_stm32f4xx.s
  59. # MemMang
  60. CSRC += $(wildcard ../thirdparty/FreeRTOS/portable/MemMang/heap_4.c)
  61. # LwIP + Web #
  62. INCLUDES += -IHTTP_Server
  63. INCLUDES += -I../thirdparty/lwip/src/include
  64. INCLUDES += -I../thirdparty/lwip/src/include/netif
  65. INCLUDES += -I../thirdparty/lwip/src/include/lwip
  66. INCLUDES += -I../thirdparty/lwip/src/include/lwip/apps
  67. INCLUDES += -I../thirdparty/lwip/src/include/netif
  68. # INCLUDES += -I../thirdparty/lwip/src/netif/ppp
  69. INCLUDES += -I../thirdparty/lwip/port
  70. INCLUDES += -I../thirdparty/lwip/port/FreeRTOS
  71. INCLUDES += -I../thirdparty/lwip/system
  72. INCLUDES += -I../thirdparty/lwip/system/arch
  73. INCLUDES += -IEthernet
  74. # INCLUDES += -I../stm32/stm32f4x7_ethernet
  75. INCLUDES += -I../modules/STM32F4x7_ETH_Driver
  76. CSRC += $(wildcard HTTP_Server/http_server.c)
  77. CSRC += $(wildcard HTTP_Server/trap_params.c)
  78. CSRC += $(wildcard HTTP_Server/web_params_api.c)
  79. CSRC += $(wildcard ../thirdparty/lwip/src/*.c)
  80. CSRC += $(wildcard ../thirdparty/lwip/src/api/*.c)
  81. CSRC += $(wildcard ../thirdparty/lwip/src/core/*.c)
  82. CSRC += $(wildcard ../thirdparty/lwip/src/core/ipv4/*.c)
  83. CSRC += $(wildcard ../thirdparty/lwip/src/core/snmp/*.c)
  84. CSRC += $(wildcard ../thirdparty/lwip/src/netif/*.c)
  85. #CSRC += $(wildcard ../thirdparty/lwip/src/netif/ppp/*.c)
  86. CSRC += $(wildcard ../thirdparty/lwip/port/FreeRTOS/*.c)
  87. CSRC += $(wildcard Ethernet/*.c)
  88. # CSRC += $(wildcard ../stm32/stm32f4x7_ethernet/*.c)
  89. CSRC += $(wildcard ../modules/STM32F4x7_ETH_Driver/*.c)
  90. CSRC += $(wildcard ../stm32/system/syscalls/syscalls.c)
  91. #SSL
  92. #INCLUDES += -I../thirdparty/PolarSSL/include/
  93. #CSRC += $(wildcard ../thirdparty/PolarSSL/library/*.c)
  94. INCLUDES += -I../thirdparty/mbedTLS/include/
  95. CSRC += $(wildcard ../thirdparty/mbedTLS/library/*.c)
  96. CFLAGS += -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -DLOG_ENABLE -DMBEDTLS_CONFIG_FILE='<mbedtls_config.h>'
  97. #-DPOLARSSL_CERTS_C
  98. BUILDDIR = ../build/bt6702_service/$(TARGET)
  99. FW_FLASH_START = $(shell awk '/USER_FLASH_FIRST_PAGE_ADDRESS/{print $$3}' ../config/common_config.h )
  100. FW_FLASH_CRC = $(shell awk '/USER_FLASH_CRC_ADDRESS/{print $$3}' ../config/common_config.h )
  101. FW_NAME = BT_6702xx_service
  102. -include ../Makefile.inc.stm32
  103. prebuild:
  104. @echo "Hardware version: $(HARDWARE)"
  105. postbuild: $(BUILDDIR)/$(TARGET).bin
  106. @echo "FW start address: $(FW_FLASH_START)"
  107. @echo "FW CRC address: $(FW_FLASH_CRC)"
  108. @echo "Copying to: $(OUTPUTDIR)/$(FW_NAME).bin"
  109. @cp $(BUILDDIR)/$(TARGET).bin $(OUTPUTDIR)/$(FW_NAME).bin
  110. @$(BUILDDIR)/../../tools/cortex_crc $(OUTPUTDIR)/$(FW_NAME).bin $(FW_FLASH_START) $(FW_FLASH_CRC)