Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. TARGET = iap
  2. INCLUDES = -I../stm32/stm32f4xx_spl/inc
  3. INCLUDES += -I../stm32/system
  4. INCLUDES += -I../config
  5. #----
  6. INCLUDES += -I.
  7. INCLUDES += -IFATFS
  8. INCLUDES += -I../thirdparty/lwip/src/include
  9. INCLUDES += -I../thirdparty/lwip/src/include/netif
  10. INCLUDES += -I../thirdparty/lwip/src/include/lwip
  11. INCLUDES += -I../thirdparty/lwip/src/include/lwip/apps
  12. #INCLUDES += -Ilwip/port/STM32F4x7
  13. #INCLUDES += -Ilwip/port/STM32F4x7/Standalone
  14. #INCLUDES += -Ilwip/port/STM32F4x7/arch
  15. INCLUDES += -I../thirdparty/lwip/port/Standalone
  16. INCLUDES += -I../thirdparty/lwip/system
  17. INCLUDES += -I../thirdparty/lwip/system/arch
  18. INCLUDES += -IModules
  19. INCLUDES += -IModules/Ethernet
  20. INCLUDES += -IModules/Console
  21. INCLUDES += -I../stm32/stm32f4x7_ethernet
  22. INCLUDES += -IUser
  23. INCLUDES += -Istm32sprog
  24. INCLUDES += -I../thirdparty/TinyStdio
  25. #----
  26. CSRC = $(wildcard *.c ../stm32/system/*.c)
  27. CSRC += $(wildcard ../stm32/stm32f4xx_spl/src/*.c)
  28. #----
  29. CSRC += $(wildcard FATFS/*.c)
  30. CSRC += $(wildcard ../thirdparty/lwip/src/*.c)
  31. CSRC += $(wildcard ../thirdparty/lwip/src/api/*.c)
  32. CSRC += $(wildcard ../thirdparty/lwip/src/core/*.c)
  33. CSRC += $(wildcard ../thirdparty/lwip/src/core/ipv4/*.c)
  34. CSRC += $(wildcard ../thirdparty/lwip/src/netif/*.c)
  35. #CSRC += $(wildcard lwip/port/STM32F4x7/Standalone/*.c)
  36. CSRC += $(wildcard ../thirdparty/lwip/port/Standalone/*.c)
  37. CSRC += $(wildcard Modules/*.c)
  38. CSRC += $(wildcard Modules/Ethernet/httpserver.c)
  39. CSRC += $(wildcard Modules/Ethernet/netconf.c)
  40. CSRC += $(wildcard ../stm32/stm32f4x7_ethernet/*.c)
  41. CSRC += $(wildcard User/*.c)
  42. CSRC += $(wildcard stm32sprog/*.c)
  43. CSRC += $(wildcard ../thirdparty/TinyStdio/*.c)
  44. #---
  45. CSRC += $(wildcard syscalls/syscalls.c)
  46. CFLAGS = -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -DPRINTF_CUSTOM
  47. CFLAGS += -DHARDWARE_$(shell echo $(HARDWARE) | tr a-z A-Z)
  48. ifeq ($(SWOTRACE), 1)
  49. CFLAGS += -DSWOTRACE
  50. endif
  51. ifeq ($(MAC),)
  52. #Print default MAC
  53. MAC = $(shell awk '/\#define DEVICE_MAC/{print $$3}' ./Modules/settings_api.h )
  54. else
  55. #Set device MAC
  56. CFLAGS += -DDEVICE_MAC='"$(MAC)"'
  57. endif
  58. LDSCRIPT := ../projects/gcc/stm32_flash.ld
  59. ASMSRC = ../projects/gcc/startup_stm32f4xx.s
  60. BUILDDIR = ../build/iap/$(TARGET)
  61. FW_FLASH_START = $(shell awk '/IAP_FLASH_FIRST_PAGE_ADDRESS/{print $$3}' ../config/common_config.h )
  62. FW_FLASH_CRC = $(shell awk '/IAP_FLASH_CRC_ADDRESS/{print $$3}' ../config/common_config.h )
  63. -include ../Makefile.inc.stm32
  64. #Building Web UI FS
  65. WUI_DIR = ../web_interface/dist/upload
  66. FSDATA_DIR = ./Modules/Ethernet
  67. $(FSDATA_DIR)/fsdata.c: $(WUI_DIR)/*
  68. mkdir -p $(FSDATA_DIR)
  69. ../docs/makefsdata.pl $(FSDATA_DIR) $(WUI_DIR)
  70. prebuild: $(FSDATA_DIR)/fsdata.c
  71. @grep -wl --include *.h --include *.c "DEVICE_MAC" ./ -R | xargs touch
  72. @grep -wl --include *.h --include *.c "SWOTRACE" ./ ../shared -R | xargs touch
  73. postbuild:
  74. @echo "Device MAC address: $(MAC)"
  75. @echo "FW start address: $(FW_FLASH_START)"
  76. @echo "FW CRC address: $(FW_FLASH_CRC)"
  77. @$(BUILDDIR)/../../tools/cortex_crc $(OUTPUTDIR)/$(TARGET).bin $(FW_FLASH_START) $(FW_FLASH_CRC)