application.mk 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. APP_INC = -I.
  2. APP_INC += -I$(TOP)
  3. APP_INC += -Ifatfs/src
  4. APP_INC += -Ifatfs/src/drivers
  5. APP_INC += -IFreeRTOS
  6. APP_INC += -IFreeRTOS/Source/include
  7. APP_INC += -IFreeRTOS/Source/portable/GCC/ARM_CM3
  8. APP_INC += -Iftp
  9. APP_INC += -Ihal
  10. APP_INC += -Ihal/inc
  11. APP_INC += -Imisc
  12. APP_INC += -Imods
  13. APP_INC += -I$(TOP)/drivers/cc3100/inc
  14. APP_INC += -Isimplelink
  15. APP_INC += -Isimplelink/oslib
  16. APP_INC += -Itelnet
  17. APP_INC += -Iutil
  18. APP_INC += -Ibootmgr
  19. APP_INC += -I$(BUILD)
  20. APP_INC += -I$(BUILD)/genhdr
  21. APP_INC += -I$(TOP)/ports/stm32
  22. APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS
  23. APP_FATFS_SRC_C = $(addprefix fatfs/src/,\
  24. drivers/sflash_diskio.c \
  25. drivers/sd_diskio.c \
  26. )
  27. APP_RTOS_SRC_C = $(addprefix FreeRTOS/Source/,\
  28. croutine.c \
  29. event_groups.c \
  30. list.c \
  31. queue.c \
  32. tasks.c \
  33. timers.c \
  34. portable/GCC/ARM_CM3/port.c \
  35. portable/MemMang/heap_4.c \
  36. )
  37. APP_FTP_SRC_C = $(addprefix ftp/,\
  38. ftp.c \
  39. updater.c \
  40. )
  41. APP_HAL_SRC_C = $(addprefix hal/,\
  42. adc.c \
  43. aes.c \
  44. cc3200_hal.c \
  45. cpu.c \
  46. crc.c \
  47. des.c \
  48. gpio.c \
  49. i2c.c \
  50. i2s.c \
  51. interrupt.c \
  52. pin.c \
  53. prcm.c \
  54. sdhost.c \
  55. shamd5.c \
  56. spi.c \
  57. startup_gcc.c \
  58. systick.c \
  59. timer.c \
  60. uart.c \
  61. utils.c \
  62. wdt.c \
  63. )
  64. APP_MISC_SRC_C = $(addprefix misc/,\
  65. antenna.c \
  66. FreeRTOSHooks.c \
  67. help.c \
  68. mpirq.c \
  69. mperror.c \
  70. mpexception.c \
  71. )
  72. APP_MODS_SRC_C = $(addprefix mods/,\
  73. modmachine.c \
  74. modnetwork.c \
  75. modubinascii.c \
  76. moduos.c \
  77. modusocket.c \
  78. modussl.c \
  79. modutime.c \
  80. modwipy.c \
  81. modwlan.c \
  82. pybadc.c \
  83. pybpin.c \
  84. pybi2c.c \
  85. pybrtc.c \
  86. pybflash.c \
  87. pybsd.c \
  88. pybsleep.c \
  89. pybspi.c \
  90. pybtimer.c \
  91. pybuart.c \
  92. pybwdt.c \
  93. )
  94. APP_CC3100_SRC_C = $(addprefix drivers/cc3100/src/,\
  95. device.c \
  96. driver.c \
  97. flowcont.c \
  98. fs.c \
  99. netapp.c \
  100. netcfg.c \
  101. socket.c \
  102. wlan.c \
  103. )
  104. APP_SL_SRC_C = $(addprefix simplelink/,\
  105. oslib/osi_freertos.c \
  106. cc_pal.c \
  107. )
  108. APP_TELNET_SRC_C = $(addprefix telnet/,\
  109. telnet.c \
  110. )
  111. APP_UTIL_SRC_C = $(addprefix util/,\
  112. cryptohash.c \
  113. fifo.c \
  114. gccollect.c \
  115. random.c \
  116. socketfifo.c \
  117. )
  118. APP_UTIL_SRC_S = $(addprefix util/,\
  119. gchelper.s \
  120. sleeprestore.s \
  121. )
  122. APP_MAIN_SRC_C = \
  123. main.c \
  124. mptask.c \
  125. mpthreadport.c \
  126. serverstask.c \
  127. fatfs_port.c \
  128. APP_LIB_SRC_C = $(addprefix lib/,\
  129. oofatfs/ff.c \
  130. oofatfs/option/unicode.c \
  131. libc/string0.c \
  132. mp-readline/readline.c \
  133. netutils/netutils.c \
  134. timeutils/timeutils.c \
  135. utils/pyexec.c \
  136. utils/interrupt_char.c \
  137. utils/sys_stdio_mphal.c \
  138. )
  139. APP_STM_SRC_C = $(addprefix ports/stm32/,\
  140. bufhelper.c \
  141. irq.c \
  142. )
  143. OBJ = $(PY_O) $(addprefix $(BUILD)/, $(APP_FATFS_SRC_C:.c=.o) $(APP_RTOS_SRC_C:.c=.o) $(APP_FTP_SRC_C:.c=.o) $(APP_HAL_SRC_C:.c=.o) $(APP_MISC_SRC_C:.c=.o))
  144. OBJ += $(addprefix $(BUILD)/, $(APP_MODS_SRC_C:.c=.o) $(APP_CC3100_SRC_C:.c=.o) $(APP_SL_SRC_C:.c=.o) $(APP_TELNET_SRC_C:.c=.o) $(APP_UTIL_SRC_C:.c=.o) $(APP_UTIL_SRC_S:.s=.o))
  145. OBJ += $(addprefix $(BUILD)/, $(APP_MAIN_SRC_C:.c=.o) $(APP_LIB_SRC_C:.c=.o) $(APP_STM_SRC_C:.c=.o))
  146. OBJ += $(BUILD)/pins.o
  147. # List of sources for qstr extraction
  148. SRC_QSTR += $(APP_MODS_SRC_C) $(APP_MISC_SRC_C) $(APP_STM_SRC_C)
  149. # Append any auto-generated sources that are needed by sources listed in
  150. # SRC_QSTR
  151. SRC_QSTR_AUTO_DEPS +=
  152. # Add the linker script
  153. LINKER_SCRIPT = application.lds
  154. LDFLAGS += -T $(LINKER_SCRIPT)
  155. # Add the application specific CFLAGS
  156. CFLAGS += $(APP_CPPDEFINES) $(APP_INC)
  157. # Disable strict aliasing for the simplelink driver
  158. $(BUILD)/drivers/cc3100/src/driver.o: CFLAGS += -fno-strict-aliasing
  159. # Check if we would like to debug the port code
  160. ifeq ($(BTYPE), release)
  161. CFLAGS += -DNDEBUG
  162. else
  163. ifeq ($(BTYPE), debug)
  164. CFLAGS += -DNDEBUG
  165. else
  166. $(error Invalid BTYPE specified)
  167. endif
  168. endif
  169. SHELL = bash
  170. APP_SIGN = appsign.sh
  171. UPDATE_WIPY ?= tools/update-wipy.py
  172. WIPY_IP ?= '192.168.1.1'
  173. WIPY_USER ?= 'micro'
  174. WIPY_PWD ?= 'python'
  175. all: $(BUILD)/mcuimg.bin
  176. .PHONY: deploy-ota
  177. deploy-ota: $(BUILD)/mcuimg.bin
  178. $(ECHO) "Writing $< to the board"
  179. $(Q)$(PYTHON) $(UPDATE_WIPY) --verify --ip $(WIPY_IP) --user $(WIPY_USER) --password $(WIPY_PWD) --file $<
  180. $(BUILD)/application.axf: $(OBJ) $(LINKER_SCRIPT)
  181. $(ECHO) "LINK $@"
  182. $(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
  183. $(Q)$(SIZE) $@
  184. $(BUILD)/application.bin: $(BUILD)/application.axf
  185. $(ECHO) "Create $@"
  186. $(Q)$(OBJCOPY) -O binary $< $@
  187. $(BUILD)/mcuimg.bin: $(BUILD)/application.bin
  188. $(ECHO) "Create $@"
  189. $(Q)$(SHELL) $(APP_SIGN) $(BUILD)
  190. MAKE_PINS = boards/make-pins.py
  191. BOARD_PINS = boards/$(BOARD)/pins.csv
  192. AF_FILE = boards/cc3200_af.csv
  193. PREFIX_FILE = boards/cc3200_prefix.c
  194. GEN_PINS_SRC = $(BUILD)/pins.c
  195. GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
  196. GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
  197. # Making OBJ use an order-only dependency on the generated pins.h file
  198. # has the side effect of making the pins.h file before we actually compile
  199. # any of the objects. The normal dependency generation will deal with the
  200. # case when pins.h is modified. But when it doesn't exist, we don't know
  201. # which source files might need it.
  202. $(OBJ): | $(GEN_PINS_HDR)
  203. # Call make-pins.py to generate both pins_gen.c and pins.h
  204. $(GEN_PINS_SRC) $(GEN_PINS_HDR) $(GEN_PINS_QSTR): $(BOARD_PINS) $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
  205. $(ECHO) "Create $@"
  206. $(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) > $(GEN_PINS_SRC)
  207. $(BUILD)/pins.o: $(BUILD)/pins.c
  208. $(call compile_c)