Makefile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. prebuild:
  61. @grep -wl --include *.h --include *.c "DEVICE_MAC" ./ -R | xargs touch
  62. @grep -wl --include *.h --include *.c "SWOTRACE" ./ ../shared -R | xargs touch
  63. postbuild:
  64. @echo "Device MAC address: $(MAC)"
  65. @echo "FW start address: $(FW_FLASH_START)"
  66. @echo "FW CRC address: $(FW_FLASH_CRC)"
  67. @$(BUILDDIR)/../../tools/cortex_crc $(OUTPUTDIR)/$(TARGET).bin $(FW_FLASH_START) $(FW_FLASH_CRC)