1cur_dir := $(dir $(lastword $(MAKEFILE_LIST))) 2 3#obj-y := $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)*.c $(cur_dir)*.cpp $(cur_dir)*.S)) 4obj-y := 5 6ifeq ($(ROM_BUILD),1) 7obj-y += ../../tests/rom/startup_ARMCM.S 8else 9obj-y += startup_main.S 10AFLAGS_startup_main.o += -DRAM_SIZE=$(RAM_SIZE) 11ifeq ($(A7_DSP_ENABLE),1) 12AFLAGS_startup_main.o += -D__A7_DSP_ENABLE__ 13endif 14endif 15 16ifeq ($(FACTORY_SUITE),1) 17obj-y += ../../tests/factory_suite/ 18else ifeq ($(RELIABILITY_TEST),1) 19obj-y += ../../tests/reliability_test/ 20else ifeq ($(NOSTD),1) 21obj-y += nostd_main.c 22else ifeq ($(NOAPP),1) 23obj-y += noapp_main.cpp 24else ifeq ($(MBW_TEST_ONLY),1) 25obj-y += ../../tests/mbw_test/mbw.c 26ccflags-y += -DMBW_TEST 27obj-y += ../../net/utils/vsprintf.c 28else 29obj-y += main.cpp 30endif 31 32 33ifneq ($(filter 1,$(USB_SERIAL_TEST) $(USB_SERIAL_DIRECT_XFER_TEST) $(USB_AUDIO_TEST) $(I2C_TEST) $(AF_TEST) $(VD_TEST) $(CP_TEST) $(TDM_TEST) $(SEC_ENG_TEST) $(A7_DSP_TEST) $(TRANSQ_TEST) $(PSRAM_TEST) $(PSRAMUHS_TEST) $(WIFI_TEST)),) 34ccflags-y += -Itests/hwtest -DHWTEST 35 36ifneq ($(filter 1,$(USB_SERIAL_TEST) $(USB_SERIAL_DIRECT_XFER_TEST) $(USB_AUDIO_TEST)),) 37obj-y += ../../tests/hwtest/usb_dev_test.c 38ifeq ($(USB_SERIAL_TEST),1) 39ccflags-y += -DUSB_SERIAL_TEST 40else ifeq ($(USB_SERIAL_DIRECT_XFER_TEST),1) 41ccflags-y += -DUSB_SERIAL_DIRECT_XFER_TEST 42else 43ccflags-y += -DUSB_AUDIO_TEST 44endif 45endif 46 47ifneq ($(USB_SERIAL_DIRECT_XFER_SIZE),) 48ccflags-y += -DUSB_SERIAL_DIRECT_XFER_SIZE=$(USB_SERIAL_DIRECT_XFER_SIZE) 49endif 50 51ifeq ($(I2C_TEST),1) 52obj-y += ../../tests/hwtest/i2c_test.c 53ccflags-y += -DI2C_TEST 54 55ifeq ($(I2C_TEST_DMA_MODE),1) 56CFLAGS_i2c_test.o += -DI2C_TEST_DMA_MODE 57endif 58ifeq ($(I2C_TEST_INT_MODE),1) 59CFLAGS_i2c_test.o += -DI2C_TEST_INT_MODE 60endif 61ifneq ($(I2C_SPEED),) 62CFLAGS_i2c_test.o += -DI2C_SPEED=$(I2C_SPEED) 63endif 64endif # I2C_TEST 65 66ifeq ($(AF_TEST),1) 67obj-y += ../../services/audioflinger/ ../../tests/hwtest/af_test.c 68ccflags-y += -Iservices/audioflinger -DAF_TEST 69 70ifeq ($(AF_INT_CODEC_TEST),1) 71obj-y += ../../platform/drivers/codec/ 72CFLAGS_af_test.o += -DAF_INT_CODEC_TEST 73export AF_DEVICE_INT_CODEC ?= 1 74export AF_DEVICE_I2S ?= 0 75else 76export AF_DEVICE_INT_CODEC ?= 0 77export AF_DEVICE_I2S ?= 1 78endif 79 80ifneq ($(CHAN_NUM_CAPTURE),) 81CFLAGS_af_test.o += -DCHAN_NUM_CAPTURE=$(CHAN_NUM_CAPTURE) 82endif 83ifneq ($(CHAN_SEP_BUF_CAPTURE),) 84CFLAGS_af_test.o += -DCHAN_SEP_BUF_CAPTURE=$(CHAN_SEP_BUF_CAPTURE) 85endif 86ifeq ($(FIXED_BUF_CAPTURE),1) 87CFLAGS_af_test.o += -DFIXED_BUF_CAPTURE 88endif 89endif # AF_TEST 90 91ifeq ($(VD_TEST),1) 92obj-y += ../../apps/voice_detector/voice_detector.c \ 93 ../../apps/common/app_utils.c \ 94 ../../services/audioflinger/ \ 95 ../../services/audio_dump/ \ 96 ../../platform/drivers/codec/ 97ccflags-y += -DVD_TEST \ 98 -Iapps/voice_detector \ 99 -Iapps/common \ 100 -Iservices/audio_dump/include \ 101 -Iservices/multimedia/speech/inc 102subdir-ccflags-y += -Iservices/audioflinger 103endif 104 105ifeq ($(CP_TEST),1) 106obj-y += ../../tests/hwtest/cp_test.c 107ccflags-y += -DCP_TEST 108endif 109 110ifeq ($(TDM_TEST),1) 111obj-y += ../../tests/hwtest/tdm_test.c 112ccflags-y += -DTDM_TEST 113ccflags-y += -DCHIP_HAS_I2S=$(CHIP_HAS_I2S) 114ifneq ($(CHIP_HAS_TDM),) 115ccflags-y += -DCHIP_HAS_TDM=$(CHIP_HAS_TDM) 116endif 117 118ifeq ($(CHIP_HAS_BCM),1) 119CFLAGS_se_test.o += -DCHIP_HAS_BCM 120CFLAGS_se_aes_test.o += -DCHIP_HAS_BCM 121endif 122 123ifeq ($(LIS25_TEST), 1) 124ccflags-y += -DLIS25_TEST 125obj-y += ../../tests/codec_vad/lis25ba.c 126ccflags-y += -Itests/codec_vad/ 127endif 128ifeq ($(TDM_LOOPBACK_TEST), 1) 129ccflags-y += -DTDM_LOOPBACK_TEST 130endif 131ifeq ($(TDM_PLAYBACK_ONLY_TEST), 1) 132ccflags-y += -DTDM_PLAYBACK_ONLY_TEST 133endif 134endif #TDM_TEST 135 136ifeq ($(SEC_ENG_TEST),1) 137obj-y += ../../tests/hwtest/sec_eng_test.c ../../utils/hexdump/ 138ccflags-y += -DSEC_ENG_TEST -Iutils/hexdump 139ifneq ($(filter 1,$(AES_LARGE_DATA) $(HASH_LARGE_DATA) $(HMAC_LARGE_DATA)),) 140obj-y += ../../tests/hwtest/asm_test.S 141asflags-y += -Itests/hwtest 142ifeq ($(AES_LARGE_DATA),1) 143asflags-y += -DAES_LARGE_DATA 144ccflags-y += -DAES_LARGE_DATA 145endif 146ifeq ($(HASH_LARGE_DATA),1) 147asflags-y += -DHASH_LARGE_DATA 148ccflags-y += -DHASH_LARGE_DATA 149endif 150ifeq ($(HMAC_LARGE_DATA),1) 151asflags-y += -DHMAC_LARGE_DATA 152ccflags-y += -DHMAC_LARGE_DATA 153endif 154endif 155endif 156 157$(call echo-help,INFO Please make sure DSP bin is up to date: out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).bin) 158ifeq ($(A7_DSP_TEST),1) 159obj-y += ../../tests/hwtest/a7_dsp_test.c 160CFLAGS_a7_dsp_test.o += -Iservices/transq_msg 161ifeq ($(CHIP_HAS_PSRAMUHS), 1) 162CFLAGS_a7_dsp_test.o += -DCHIP_HAS_PSRAMUHS 163ifeq ($(PSRAMUHS_ENABLE), 1) 164CFLAGS_a7_dsp_test.o += -DPSRAMUHS_ENABLE 165endif 166endif 167obj-y += ../../tests/hwtest/asm_test.S 168ccflags-y += -DA7_DSP_TEST 169AFLAGS_asm_test.o += -DA7_DSP_TEST -DDSP_BIN_NAME=$(DSP_BIN_NAME).bin -Iout/$(T) 170DSP_BIN_NAME ?= hwtest_a7_dsp 171$(obj)/../../tests/hwtest/asm_test.o : out/$(T)/$(DSP_BIN_NAME).bin 172out/$(T)/$(DSP_BIN_NAME).bin : $(srctree)/out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).bin 173 $(call CMDCPFILE,$(srctree)/out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).bin,$(srctree)/$@) 174 $(call CMDCPFILE,$(srctree)/out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).elf,$(srctree)/$(@:.bin=.elf)) 175 $(call CMDCPFILE,$(srctree)/out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).map,$(srctree)/$(@:.bin=.map)) 176 $(call CMDCPFILE,$(srctree)/out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).lst,$(srctree)/$(@:.bin=.lst)) 177$(srctree)/out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).bin : FORCE 178 $(call echo-help,) 179 $(call echo-help,INFO Please make sure DSP bin is up to date: out/$(DSP_BIN_NAME)/$(DSP_BIN_NAME).bin) 180# We cannot build $(DSP_BIN_NAME) automatically here, because the env inherited by sub-make cannot be cleaned: 181# E.g., KBUILD_SRC, TC, CHIP_HAS_CP, ... 182 $(call echo-help,) 183ifeq ($(A7_DSP_TRANSQ_AF), 1) 184CFLAGS_a7_dsp_test.o += -DA7_DSP_TRANSQ_AF -Iservices/audioflinger 185obj-y += ../../services/audioflinger/ 186obj-y += ../../platform/drivers/codec/ 187export AF_DEVICE_INT_CODEC ?= 1 188export AF_DEVICE_I2S ?= 1 189endif 190endif #A7_DSP_TEST 191 192ifeq ($(TRANSQ_TEST),1) 193obj-y += ../../tests/hwtest/transq_test.c 194ccflags-y += -DTRANSQ_TEST 195ifneq ($(RX_ROLE),) 196CFLAGS_transq_test.o += -DRX_ROLE 197endif 198ifneq ($(TRANSQ_ID),) 199CFLAGS_transq_test.o += -DTRANSQ_ID=$(TRANSQ_ID) 200endif 201endif #TRANSQ_TEST 202 203ifeq ($(PSRAM_TEST),1) 204obj-y += ../../tests/hwtest/psram_test.c 205ccflags-y += -DPSRAM_TEST -DCHIP_PSRAM_CTRL_VER=$(CHIP_PSRAM_CTRL_VER) 206endif #PSRAM_TEST 207 208ifeq ($(PSRAMUHS_TEST),1) 209obj-y += ../../tests/hwtest/psram_test.c 210ccflags-y += -DPSRAMUHS_TEST 211endif #PSRAMUHS_TEST 212 213ifeq ($(WIFI_TEST),1) 214obj-y += main_wifi_test.c 215ccflags-y += -DWIFI_TEST 216endif 217 218ifeq ($(MBW_TEST),1) 219obj-y += ../../tests/mbw_test/mbw.c 220ccflags-y += -DMBW_TEST 221endif 222 223 224 225endif # hwtest cases 226 227ifeq ($(RTOS),1) 228ifeq ($(NOAPP),1) 229obj-y += test-sntp.c 230endif 231endif 232obj-y := $(obj-y:.c=.o) 233obj-y := $(obj-y:.cpp=.o) 234obj-y := $(obj-y:.S=.o) 235 236obj-y += ../../utils/hwtimer_list/ 237 238ccflags-y += \ 239 -Iutils/hwtimer_list \ 240 -Iplatform/drivers/ana \ 241 -Iplatform/drivers/security_engine \ 242 -Iplatform/drivers/usb/usb_dev/inc \ 243 -Iapps/main \ 244 -Iapps/factory \ 245 -Iutils/list \ 246 -Iapps/audioplayers \ 247 -Iservices/bt_app \ 248 -Iapps/common \ 249 -Inet/include/\ 250 -Inet/include/byteorder/\ 251 -Inet/include/linux/\ 252 -Inet/include/unaligned/\ 253 -Inet/\ 254 -Inet/wpa_supplicant_l/wpa_supplicant/ \ 255 -Inet/wpa_supplicant_l/src/ \ 256 -Inet/wpa_supplicant_l/src/utils/ \ 257 -Inet/net_os/ \ 258 -Inet/include/os/ \ 259 -Inet/lwip/src/include/\ 260 -Inet/lwip/src/include/lwip/\ 261 -Inet/lwip/src/include/lwip/arch\ 262 -Inet/lwip/src/include/ipv4/\ 263 -Inet/lwip/src/include/lwip/apps \ 264 -Inet/include/linux/\ 265 -Iservices/nvrecord/\ 266 -Iservices/norflash_api \ 267 -Iplatform/drivers/wifi/$(CHIP)\ 268 -Iservices/nv_section/factory_section/ \ 269 -Iservices/nv_section/log_section 270 271ifneq ($(FLASH_FILL),) 272ccflags-y += -DFLASH_FILL=$(FLASH_FILL) 273endif 274 275ifneq ($(DEBUG_PORT),) 276ccflags-y += -DDEBUG_PORT=$(DEBUG_PORT) 277endif 278 279ifneq ($(FLASH_SIZE),) 280ccflags-y += -DFLASH_SIZE=$(FLASH_SIZE) 281endif 282 283ifeq ($(ROM_UTILS_ON),1) 284ccflags-y += -DROM_UTILS_ON 285endif 286 287ifeq ($(NO_PMU),1) 288ccflags-y += -DNO_PMU 289endif 290 291ifeq ($(NO_TIMER),1) 292ccflags-y += -DNO_TIMER 293endif 294 295ifeq ($(SLEEP_TEST),1) 296ccflags-y += -DSLEEP_TEST 297endif 298 299ifeq ($(RTOS),1) 300ifeq ($(KERNEL),RTX) 301ccflags-y += -Irtos/rtx/TARGET_CORTEX_M 302endif 303endif 304 305ifeq ($(DEBUG_MODE_USB_DOWNLOAD),1) 306ccflags-y += -DDEBUG_MODE_USB_DOWNLOAD 307endif 308 309ccflags-y += -Iservices/wifi_app/wifi_voice/ 310