Makefile 4.6 KB

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