Makefile 4.5 KB

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