Makefile 2.8 KB

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