1 2add_if_exists = $(foreach d,$(1),$(if $(wildcard $(srctree)/$(d)),$(d) ,)) 3 4# ------------------------------------------- 5# Root Option Dependencies 6# ------------------------------------------- 7export OTA_BASIC ?= 0 8export INTERCONNECTION ?= 0 9export IBRT ?= 0 10export BLE ?= 0 11export BLE_SECURITY_ENABLED ?= 0 12export TILE_DATAPATH_ENABLED ?= 0 13 14# is current system a tws system 15# currently in our SDK, system include relay tws and IBRT 16# of if relay tws or IBRT is enabled, this macro must set to 1 17export TWS_SYSTEM_ENABLED ?= 0 18 19# ai voice related configuration 20export VOICE_DATAPATH_ENABLED ?= 0 21 22export GOOGLE_SERVICE_ENABLE ?= 0 23export BISTO_ENABLE ?= 0 24export GSOUND_HOTWORD_ENABLE ?= 0 25export GFPS_ENABLE ?= 0 26 27export AMA_VOICE ?= 0 28export DMA_VOICE ?= 0 29export GMA_VOICE ?= 0 30export SMART_VOICE ?= 0 31export TENCENT_VOICE ?= 0 32export AI_VOICE ?= 0 33 34IS_MULTI_AI_ENABLE ?= 0 35 36# NOTE: the value of AMA_VOICE,DMA_VOICE, SMART_VOICE, TENCENT_VOICE, GMA_VOICE must be confirmed above 37ifneq ($(filter 1,$(AMA_VOICE) $(DMA_VOICE) $(SMART_VOICE) $(TENCENT_VOICE) $(GMA_VOICE)),) 38export AI_VOICE := 1 39endif 40 41ifeq ($(BT_ANC),1) 42export ANC_APP ?= 1 43endif 44 45ifeq ($(GOOGLE_SERVICE_ENABLE), 1) 46export BISTO_ENABLE := 1 47export GFPS_ENABLE := 1 48endif 49 50ifeq ($(BISTO_ENABLE),1) 51export OTA_BASIC := 1 52export VOICE_DATAPATH_ENABLED := 1 53export CRASH_REBOOT ?= 1 54 55export BLE_SECURITY_ENABLED := 1 56 57ifeq ($(CHIP),best1400) 58export DUMP_CRASH_LOG ?= 0 59else 60export DUMP_CRASH_LOG ?= 0 61endif 62 63export VOICE_DATAPATH_TYPE ?= gsound 64#export TRACE_DUMP2FLASH ?= 1 65export FLASH_SUSPEND ?= 1 66export BLE_ONLY_ENABLED ?= 0 67 68# todo: freddie: should enable aec? 69SPEECH_TX_AEC2FLOAT := 0 70endif # ifeq ($(BISTO_ENABLE),1) 71 72# NOTE: variable value in BLE_SWITCH must already confirmed above here 73BLE_SWITCH := \ 74 $(BISTO_ENABLE) \ 75 $(GFPS_ENABLE) \ 76 $(AMA_VOICE) \ 77 $(GMA_VOICE) \ 78 $(DMA_VOICE) \ 79 $(TILE_DATAPATH_ENABLED) \ 80 $(BLE_ONLY_ENABLED) 81 82ifneq ($(filter 1, $(BLE_SWITCH)),) 83export BLE := 1 84endif 85 86# NOTE: value of AI_VOICE and BISTO_ENABLE must already confirmed above here 87ifeq ($(filter 0,$(AI_VOICE) $(BISTO_ENABLE)),) 88IS_MULTI_AI_ENABLE := 1 89endif 90 91ifeq ($(VOICE_PROMPT),1) 92KBUILD_CPPFLAGS += -DMEDIA_PLAYER_SUPPORT 93endif 94 95ifeq ($(INTERCONNECTION),1) 96BES_OTA_BASIC := 1 97endif 98 99ifeq ($(GMA_VOICE),1) 100OTA_BASIC := 1 101endif 102 103ifneq ($(filter 1,$(OTA_BASIC) $(BES_OTA_BASIC)),) 104ifeq ($(FPGA),1) 105export OTA_CODE_OFFSET ?= 0 106else 107export OTA_CODE_OFFSET ?= 0x18000 108endif 109endif 110 111ifeq ($(IBRT),1) 112TWS_SYSTEM_ENABLED := 1 113TWS_PROMPT_SYNC := 1 114endif 115 116MIX_MIC_DURING_MUSIC_ENABLED ?= 0 117 118# make sure the value of GFPS_ENABLE and GMA_VOICE is confirmed above here 119ifneq ($(filter 1,$(GFPS_ENABLE) $(GMA_VOICE)),) 120core-y += utils/encrypt/ 121endif 122 123ifneq ($(filter apps/ tests/speech_test/ tests/ota_boot/, $(core-y)),) 124export BT_APP ?= 1 125FULL_APP_PROJECT ?= 1 126endif 127 128# ------------------------------------------- 129# CHIP selection 130# ------------------------------------------- 131 132export CHIP 133 134ifneq (,) 135else ifeq ($(CHIP),best1000) 136KBUILD_CPPFLAGS += -DCHIP_BEST1000 137export CHIP_HAS_FPU := 1 138export CHIP_HAS_USB := 1 139export CHIP_HAS_USBPHY := 0 140export CHIP_HAS_SDMMC := 1 141export CHIP_HAS_SDIO := 1 142export CHIP_HAS_PSRAM := 1 143export CHIP_HAS_SPI := 1 144export CHIP_HAS_SPILCD := 1 145export CHIP_HAS_SPIPHY := 0 146export CHIP_HAS_I2C := 1 147export CHIP_HAS_UART := 2 148export CHIP_HAS_DMA := 2 149export CHIP_HAS_SPDIF := 1 150export CHIP_HAS_TRANSQ := 0 151export CHIP_HAS_EXT_PMU := 0 152export CHIP_HAS_AUDIO_CONST_ROM := 1 153export CHIP_FLASH_CTRL_VER := 1 154export CHIP_PSRAM_CTRL_VER := 1 155export CHIP_SPI_VER := 1 156export CHIP_HAS_EC_CODEC_REF := 0 157else ifeq ($(CHIP),best1400) 158ifeq ($(CHIP_SUBTYPE),best1402) 159SUBTYPE_VALID := 1 160KBUILD_CPPFLAGS += -DCHIP_BEST1402 161export CHIP_FLASH_CTRL_VER := 3 162else 163KBUILD_CPPFLAGS += -DCHIP_BEST1400 164export CHIP_FLASH_CTRL_VER := 2 165endif 166export CHIP_HAS_FPU := 1 167export CHIP_HAS_USB := 1 168export CHIP_HAS_USBPHY := 0 169export CHIP_HAS_SDMMC := 0 170export CHIP_HAS_SDIO := 0 171export CHIP_HAS_PSRAM := 0 172export CHIP_HAS_SPI := 1 173export CHIP_HAS_SPILCD := 0 174export CHIP_HAS_SPIPHY := 0 175export CHIP_HAS_I2C := 1 176export CHIP_HAS_UART := 3 177export CHIP_HAS_DMA := 1 178export CHIP_HAS_SPDIF := 0 179export CHIP_HAS_TRANSQ := 0 180export CHIP_HAS_EXT_PMU := 0 181export CHIP_HAS_AUDIO_CONST_ROM := 0 182export CHIP_SPI_VER := 3 183export BTDUMP_ENABLE ?= 1 184export CHIP_HAS_EC_CODEC_REF := 1 185else ifeq ($(CHIP),best2000) 186KBUILD_CPPFLAGS += -DCHIP_BEST2000 187export CHIP_HAS_FPU := 1 188export CHIP_HAS_USB := 1 189export CHIP_HAS_USBPHY := 1 190export CHIP_HAS_SDMMC := 1 191export CHIP_HAS_SDIO := 1 192export CHIP_HAS_PSRAM := 1 193export CHIP_HAS_SPI := 1 194export CHIP_HAS_SPILCD := 1 195export CHIP_HAS_SPIPHY := 1 196export CHIP_HAS_I2C := 1 197export CHIP_HAS_UART := 3 198export CHIP_HAS_DMA := 2 199export CHIP_HAS_SPDIF := 2 200export CHIP_HAS_TRANSQ := 1 201export CHIP_HAS_EXT_PMU := 0 202export CHIP_HAS_AUDIO_CONST_ROM := 0 203export CHIP_FLASH_CTRL_VER := 1 204export CHIP_PSRAM_CTRL_VER := 1 205export CHIP_SPI_VER := 1 206export CHIP_HAS_EC_CODEC_REF := 0 207else ifeq ($(CHIP),haas1000) 208KBUILD_CPPFLAGS += -DCHIP_HAAS1000 -fno-exceptions 209ifeq ($(CHIP_SUBSYS),dsp) 210KBUILD_CPPFLAGS += -DCHIP_HAAS1000_DSP 211CPU := a7 212DSP_ENABLE ?= 1 213else 214CPU ?= m33 215export CHIP_HAS_CP := 1 216endif 217export CHIP_HAS_FPU := 1 218export CHIP_HAS_USB := 1 219export CHIP_HAS_USBPHY := 1 220export CHIP_HAS_SDMMC := 1 221export CHIP_HAS_SDIO := 0 222export CHIP_HAS_PSRAM := 1 223export CHIP_HAS_PSRAMUHS := 1 224export CHIP_HAS_SPI := 1 225export CHIP_HAS_SPILCD := 1 226export CHIP_HAS_SPIPHY := 1 227export CHIP_HAS_SPIDPD := 1 228export CHIP_HAS_I2C := 2 229export CHIP_HAS_UART := 3 230ifeq ($(DSP_ENABLE), 1) 231export DSP_USE_AUDMA ?= 1 232ifeq ($(LARGE_RAM), 1) 233$(error LARGE_RAM conflicts with DSP_ENABLE) 234endif 235endif 236ifeq ($(DSP_USE_AUDMA), 1) 237export CHIP_HAS_DMA := 1 238KBUILD_CPPFLAGS += -DDSP_USE_AUDMA 239else 240ifeq ($(CHIP_SUBSYS),dsp) 241export CHIP_HAS_DMA := 0 242else 243export CHIP_HAS_DMA := 2 244endif 245endif 246export CHIP_HAS_SPDIF := 1 247export CHIP_HAS_TRANSQ := 2 248export CHIP_HAS_TRNG := 1 249export CHIP_HAS_EXT_PMU := 0 250export CHIP_HAS_AUDIO_CONST_ROM := 0 251export CHIP_FLASH_CTRL_VER := 3 252export CHIP_PSRAM_CTRL_VER := 2 253export CHIP_SPI_VER := 4 254export CHIP_CACHE_VER := 2 255export CHIP_HAS_EC_CODEC_REF := 1 256export FLASH_SIZE ?= 0x1000000 257export OSC_26M_X4_AUD2BB := 0 258export USB_USE_USBPLL := 1 259OS_CLOCK_NOMINAL ?= 16000 260export A7_DSP_SPEED ?= 1100 261#780:780M, 1000:1G, 1100:1.1G 262ifeq ($(PSRAMUHS_ENABLE), 1) 263UNALIGNED_ACCESS ?= 0 264endif 265NO_PWRKEY ?= 1 266else ifeq ($(CHIP),best2300) 267KBUILD_CPPFLAGS += -DCHIP_BEST2300 268export CHIP_HAS_FPU := 1 269export CHIP_HAS_USB := 1 270export CHIP_HAS_USBPHY := 1 271export CHIP_HAS_SDMMC := 1 272export CHIP_HAS_SDIO := 0 273export CHIP_HAS_PSRAM := 0 274export CHIP_HAS_SPI := 1 275export CHIP_HAS_SPILCD := 1 276export CHIP_HAS_SPIPHY := 1 277export CHIP_HAS_I2C := 2 278export CHIP_HAS_UART := 3 279export CHIP_HAS_DMA := 2 280export CHIP_HAS_I2S := 1 281export CHIP_HAS_SPDIF := 1 282export CHIP_HAS_TRANSQ := 0 283export CHIP_HAS_EXT_PMU := 1 284export CHIP_HAS_AUDIO_CONST_ROM := 0 285export CHIP_FLASH_CTRL_VER := 2 286export CHIP_SPI_VER := 2 287export CHIP_HAS_EC_CODEC_REF := 0 288export CHIP_HAS_SCO_DMA_SNAPSHOT ?= 0 289else ifeq ($(CHIP),best2300p) 290KBUILD_CPPFLAGS += -DCHIP_BEST2300P 291export CHIP_HAS_FPU := 1 292export CHIP_HAS_USB := 1 293export CHIP_HAS_USBPHY := 1 294export CHIP_HAS_SDMMC := 1 295export CHIP_HAS_SDIO := 0 296export CHIP_HAS_PSRAM := 0 297export CHIP_HAS_SPI := 1 298export CHIP_HAS_SPILCD := 1 299export CHIP_HAS_SPIPHY := 1 300export CHIP_HAS_I2C := 2 301export CHIP_HAS_UART := 3 302export CHIP_HAS_DMA := 3 303export CHIP_HAS_I2S := 2 304export CHIP_HAS_TDM := 2 305export CHIP_HAS_SPDIF := 1 306export CHIP_HAS_TRANSQ := 0 307export CHIP_HAS_EXT_PMU := 1 308export CHIP_HAS_CP := 1 309export CHIP_HAS_AUDIO_CONST_ROM := 0 310export CHIP_FLASH_CTRL_VER := 2 311export CHIP_SPI_VER := 3 312export CHIP_CACHE_VER := 2 313export CHIP_HAS_EC_CODEC_REF := 1 314else ifeq ($(CHIP),best3001) 315ifeq ($(CHIP_SUBTYPE),best3005) 316SUBTYPE_VALID := 1 317KBUILD_CPPFLAGS += -DCHIP_BEST3005 318export CHIP_CACHE_VER := 2 319export CHIP_FLASH_CTRL_VER := 2 320else 321KBUILD_CPPFLAGS += -DCHIP_BEST3001 322export CHIP_FLASH_CTRL_VER := 1 323endif 324export CHIP_HAS_FPU := 1 325export CHIP_HAS_USB := 1 326export CHIP_HAS_USBPHY := 1 327export CHIP_HAS_SDMMC := 0 328export CHIP_HAS_SDIO := 0 329export CHIP_HAS_PSRAM := 0 330export CHIP_HAS_SPI := 1 331export CHIP_HAS_SPILCD := 0 332export CHIP_HAS_SPIPHY := 0 333export CHIP_HAS_I2C := 1 334export CHIP_HAS_UART := 2 335export CHIP_HAS_DMA := 1 336export CHIP_HAS_SPDIF := 1 337export CHIP_HAS_TRANSQ := 0 338export CHIP_HAS_EXT_PMU := 0 339export CHIP_HAS_AUDIO_CONST_ROM := 0 340export CHIP_SPI_VER := 3 341export CHIP_HAS_EC_CODEC_REF := 0 342else ifeq ($(CHIP),best3003) 343KBUILD_CPPFLAGS += -DCHIP_BEST3003 344CPU := m33 345export CHIP_HAS_FPU := 1 346export CHIP_HAS_USB := 1 347export CHIP_HAS_USBPHY := 1 348export CHIP_HAS_SDMMC := 0 349export CHIP_HAS_SDIO := 0 350export CHIP_HAS_PSRAM := 0 351export CHIP_HAS_SPI := 1 352export CHIP_HAS_SPILCD := 0 353export CHIP_HAS_SPIPHY := 0 354export CHIP_HAS_I2C := 1 355export CHIP_HAS_UART := 2 356export CHIP_HAS_DMA := 2 357export CHIP_HAS_SPDIF := 1 358export CHIP_HAS_TRANSQ := 0 359export CHIP_HAS_EXT_PMU := 0 360export CHIP_HAS_AUDIO_CONST_ROM := 0 361export CHIP_HAS_FM ?= 1 362export CHIP_CACHE_VER := 2 363export CHIP_FLASH_CTRL_VER := 2 364export CHIP_SPI_VER := 4 365export CHIP_HAS_DCO ?= 1 366else ifeq ($(CHIP),fpga1000) 367KBUILD_CPPFLAGS += -DCHIP_FPGA1000 368KBUILD_CPPFLAGS += -DCHIP_BEST1000 369export CHIP_HAS_FPU := 1 370export CHIP_HAS_USB := 1 371export CHIP_HAS_USBPHY := 0 372export CHIP_HAS_SDMMC := 1 373export CHIP_HAS_SDIO := 1 374export CHIP_HAS_PSRAM := 1 375export CHIP_HAS_SPI := 1 376export CHIP_HAS_SPILCD := 1 377export CHIP_HAS_SPIPHY := 0 378export CHIP_HAS_I2C := 1 379export CHIP_HAS_UART := 2 380export CHIP_HAS_DMA := 2 381export CHIP_HAS_SPDIF := 1 382export CHIP_HAS_TRANSQ := 0 383export CHIP_HAS_EXT_PMU := 0 384export CHIP_HAS_AUDIO_CONST_ROM := 1 385export CHIP_FLASH_CTRL_VER := 1 386export CHIP_PSRAM_CTRL_VER := 1 387export CHIP_SPI_VER := 1 388export CHIP_HAS_EC_CODEC_REF := 0 389else 390$(error Invalid CHIP: $(CHIP)) 391endif 392 393ifneq ($(CHIP_SUBTYPE),) 394ifneq ($(SUBTYPE_VALID),1) 395$(error Invalid CHIP_SUBTYPE=$(CHIP_SUBTYPE) for CHIP=$(CHIP)) 396endif 397export CHIP_SUBTYPE 398endif 399 400ifeq ($(CPU),) 401CPU := m4 402endif 403export CPU 404 405ifneq ($(filter a%,$(CPU)),) 406# Override lds file 407ifeq ($(PSRAMUHS_ENABLE), 1) 408LDS_FILE := armca_psram.lds 409else 410ifeq ($(FT_TEST_2001),1) 411LDS_FILE := armca_ft2001.lds 412else 413LDS_FILE := armca.lds 414endif 415endif 416 417ifeq ($(GEN_BOOT_SECTION),1) 418CPPFLAGS_${LDS_FILE} += -DGEN_BOOT_SECTION 419endif 420 421ifeq ($(EXEC_IN_RAM),1) 422CPPFLAGS_${LDS_FILE} += -DEXEC_IN_RAM 423else ifeq ($(EXEC_IN_PSRAM),1) 424CPPFLAGS_${LDS_FILE} += -DEXEC_IN_PSRAM 425endif 426endif 427 428export FLASH_SIZE ?= 0x100000 429ifeq ($(CHIP_HAS_PSRAM),1) 430export PSRAM_SIZE ?= 0x400000 431export PSRAM_ENABLE ?= 0 432export PSRAM_SPEED ?= 200 433#166:166M, 200:200M 434endif 435ifeq ($(CHIP_HAS_PSRAMUHS),1) 436export PSRAMUHS_ENABLE ?= 0 437export PSRAMUHS_SPEED ?= 1000 438#400:400M, 600:600M, 800:800M, 900:900M, 1000:1G 439ifeq ($(PSRAMUHS_DUAL_8BIT), 1) 440export PSRAMUHS_SIZE ?= 0x1000000 441ifeq ($(PSRAMUHS_DUAL_SWITCH), 1) 442$(error PSRAMUHS_DUAL_8BIT conflicts with PSRAMUHS_DUAL_SWITCH) 443endif 444endif 445export PSRAMUHS_SIZE ?= 0x800000 446endif 447 448ifneq ($(PSRAMUHS_SIZE),) 449KBUILD_CPPFLAGS += -DPSRAMUHS_SIZE=$(PSRAMUHS_SIZE) 450endif 451 452KBUILD_CPPFLAGS += -DCHIP_HAS_DMA=$(CHIP_HAS_DMA) 453KBUILD_CPPFLAGS += -DCHIP_HAS_UART=$(CHIP_HAS_UART) 454KBUILD_CPPFLAGS += -DCHIP_HAS_I2C=$(CHIP_HAS_I2C) 455 456ifeq ($(CHIP_HAS_USB),1) 457KBUILD_CPPFLAGS += -DCHIP_HAS_USB 458endif 459 460ifneq ($(CHIP_HAS_TRANSQ),0) 461KBUILD_CPPFLAGS += -DCHIP_HAS_TRANSQ=$(CHIP_HAS_TRANSQ) 462endif 463 464ifeq ($(CHIP_HAS_TRNG),1) 465KBUILD_CPPFLAGS += -DCHIP_HAS_TRNG 466endif 467ifeq ($(CHIP_HAS_CP),1) 468KBUILD_CPPFLAGS += -DCHIP_HAS_CP 469endif 470ifeq ($(CP_ENABLE), 1) 471KBUILD_CPPFLAGS += -DCP_ENABLE 472endif 473ifeq ($(EQ_DRC_IN_CP), 1) 474KBUILD_CPPFLAGS += -DEQ_DRC_IN_CP 475endif 476ifeq ($(CHIP_HAS_AUDIO_CONST_ROM),1) 477KBUILD_CPPFLAGS += -DCHIP_HAS_AUDIO_CONST_ROM 478endif 479 480ifeq ($(MCU_SLEEP_POWER_DOWN),1) 481KBUILD_CPPFLAGS += -DMCU_SLEEP_POWER_DOWN 482endif 483 484ifeq ($(USB_AUDIO_APP),1) 485ifneq ($(BTUSB_AUDIO_MODE),1) 486NO_OVERLAY ?= 1 487endif 488endif 489export NO_OVERLAY 490ifeq ($(NO_OVERLAY),1) 491KBUILD_CPPFLAGS += -DNO_OVERLAY 492endif 493 494ifneq ($(ROM_SIZE),) 495KBUILD_CPPFLAGS += -DROM_SIZE=$(ROM_SIZE) 496endif 497 498ifneq ($(RAM_SIZE),) 499KBUILD_CPPFLAGS += -DRAM_SIZE=$(RAM_SIZE) 500endif 501 502ifneq ($(RAMCP_BASE),) 503KBUILD_CPPFLAGS += -DRAMCP_BASE=$(RAMCP_BASE) 504endif 505 506ifneq ($(RAMCP_SIZE),) 507KBUILD_CPPFLAGS += -DRAMCP_SIZE=$(RAMCP_SIZE) 508endif 509 510ifneq ($(RAMCPX_BASE),) 511KBUILD_CPPFLAGS += -DRAMCPX_BASE=$(RAMCPX_BASE) 512endif 513 514ifneq ($(RAMCPX_SIZE),) 515KBUILD_CPPFLAGS += -DRAMCPX_SIZE=$(RAMCPX_SIZE) 516endif 517 518ifneq ($(DSP_RAM_SIZE),) 519KBUILD_CPPFLAGS += -DDSP_RAM_SIZE=$(DSP_RAM_SIZE) 520endif 521 522ifneq ($(NO_RAMCP),) 523KBUILD_CPPFLAGS += -DNO_RAMCP 524endif 525 526ifeq ($(AUDIO_SECTION_ENABLE),1) 527KBUILD_CPPFLAGS += -DAUDIO_SECTION_ENABLE 528# depend on length of (ANC + AUDIO + SPEECH) in aud_section.c 529AUD_SECTION_SIZE ?= 0x8000 530ifeq ($(ANC_APP),1) 531$(error Can not enable AUDIO_SECTION_ENABLE and ANC_APP together) 532endif 533endif 534 535ifeq ($(ANC_APP),1) 536ifeq ($(CHIP),best1000) 537AUD_SECTION_SIZE ?= 0x8000 538else 539AUD_SECTION_SIZE ?= 0x10000 540endif 541ifeq ($(ANC_FB_CHECK),1) 542KBUILD_CPPFLAGS += -DANC_FB_CHECK 543endif 544else 545AUD_SECTION_SIZE ?= 0 546endif 547 548ifeq ($(TWS),1) 549LARGE_RAM ?= 1 550endif 551 552USERDATA_SECTION_SIZE ?= 0x1000 553 554export PERSIST_DATA_SECTION_SIZE ?= 0 555KBUILD_CPPFLAGS += -DPERSIST_DATA_SECTION_SIZE=$(PERSIST_DATA_SECTION_SIZE) 556 557FACTORY_SECTION_SIZE ?= 0x1000 558 559export DUMP_NORMAL_LOG ?= 0 560ifeq ($(DUMP_NORMAL_LOG),1) 561ifeq ($(FLASH_SIZE),0x40000) # 2M bits 562LOG_DUMP_SECTION_SIZE ?= 0x4000 563endif 564ifeq ($(FLASH_SIZE),0x80000) # 4M bits 565LOG_DUMP_SECTION_SIZE ?= 0x8000 566endif 567ifeq ($(FLASH_SIZE),0x100000) # 8M bits 568LOG_DUMP_SECTION_SIZE ?= 0x10000 569endif 570ifeq ($(FLASH_SIZE),0x200000) # 16M bits 571LOG_DUMP_SECTION_SIZE ?= 0x80000 572endif 573ifeq ($(FLASH_SIZE),0x400000) # 32M bits 574LOG_DUMP_SECTION_SIZE ?= 0x200000 575endif 576ifeq ($(FLASH_SIZE),0x800000) # 64M bits 577LOG_DUMP_SECTION_SIZE ?= 0x400000 578endif 579KBUILD_CPPFLAGS += -DDUMP_LOG_ENABLE 580else 581LOG_DUMP_SECTION_SIZE ?= 0 582endif 583 584FILE_SYSTEM_SECTION_SIZE ?= 0 585 586APP_USE_LED_INDICATE_IBRT_STATUS ?= 0 587ifeq ($(APP_USE_LED_INDICATE_IBRT_STATUS),1) 588KBUILD_CPPFLAGS += -D__APP_USE_LED_INDICATE_IBRT_STATUS__ 589endif 590 591ifeq ($(DUMP_CRASH_LOG),1) 592CRASH_DUMP_SECTION_SIZE ?= 0x4000 593KBUILD_CPPFLAGS += -DDUMP_CRASH_ENABLE 594else 595CRASH_DUMP_SECTION_SIZE ?= 0 596endif 597 598export CORE_DUMP_TO_FLASH ?= 0 599ifeq ($(CORE_DUMP_TO_FLASH),1) 600CORE_DUMP_SECTION_SIZE ?= 0x100000 601KBUILD_CPPFLAGS += -DCORE_DUMP_TO_FLASH 602else 603CORE_DUMP_SECTION_SIZE ?= 0 604endif 605 606CUSTOM_PARAMETER_SECTION_SIZE ?= 0x1000 607 608ifeq ($(OTA_BASIC),1) 609OTA_UPGRADE_LOG_SIZE ?= 0x1000 610else 611OTA_UPGRADE_LOG_SIZE ?= 0 612endif 613 614export LDS_SECTION_FLAGS := \ 615 -DOTA_UPGRADE_LOG_SIZE=$(OTA_UPGRADE_LOG_SIZE) \ 616 -DLOG_DUMP_SECTION_SIZE=$(LOG_DUMP_SECTION_SIZE) \ 617 -DCRASH_DUMP_SECTION_SIZE=$(CRASH_DUMP_SECTION_SIZE) \ 618 -DCORE_DUMP_SECTION_SIZE=$(CORE_DUMP_SECTION_SIZE) \ 619 -DCUSTOM_PARAMETER_SECTION_SIZE=$(CUSTOM_PARAMETER_SECTION_SIZE) \ 620 -DAUD_SECTION_SIZE=$(AUD_SECTION_SIZE) \ 621 -DUSERDATA_SECTION_SIZE=$(USERDATA_SECTION_SIZE) \ 622 -DPERSIST_DATA_SECTION_SIZE=$(PERSIST_DATA_SECTION_SIZE) \ 623 -DFACTORY_SECTION_SIZE=$(FACTORY_SECTION_SIZE) \ 624 -DFILE_SYSTEM_SECTION_SIZE=$(FILE_SYSTEM_SECTION_SIZE) 625 626CPPFLAGS_${LDS_FILE} += \ 627 -DLINKER_SCRIPT \ 628 -DFLASH_SIZE=$(FLASH_SIZE) \ 629 -Iplatform/hal 630 631CPPFLAGS_${LDS_FILE} += $(LDS_SECTION_FLAGS) 632 633ifneq ($(PSRAM_SIZE),) 634CPPFLAGS_${LDS_FILE} +=-DPSRAM_SIZE=$(PSRAM_SIZE) 635endif 636 637ifneq ($(OTA_BOOT_SIZE),) 638export OTA_BOOT_SIZE 639CPPFLAGS_${LDS_FILE} += -DOTA_BOOT_SIZE=$(OTA_BOOT_SIZE) 640endif 641 642ifneq ($(OTA_CODE_OFFSET),) 643export OTA_CODE_OFFSET 644CPPFLAGS_${LDS_FILE} += -DOTA_CODE_OFFSET=$(OTA_CODE_OFFSET) 645endif 646 647ifneq ($(OTA_REMAP_OFFSET),) 648export OTA_REMAP_OFFSET 649CPPFLAGS_${LDS_FILE} += -DOTA_REMAP_OFFSET=$(OTA_REMAP_OFFSET) 650endif 651 652ifneq ($(FLASH_REGION_SIZE),) 653CPPFLAGS_${LDS_FILE} += -DFLASH_REGION_SIZE=$(FLASH_REGION_SIZE) 654endif 655 656ifneq ($(SLAVE_BIN_FLASH_OFFSET),) 657export SLAVE_BIN_FLASH_OFFSET 658CPPFLAGS_${LDS_FILE} += -DSLAVE_BIN_FLASH_OFFSET=$(SLAVE_BIN_FLASH_OFFSET) 659endif 660 661ifeq ($(BOOT_CODE_IN_RAM),1) 662CPPFLAGS_${LDS_FILE} += -DBOOT_CODE_IN_RAM 663endif 664 665ifeq ($(LARGE_RAM),1) 666KBUILD_CPPFLAGS += -DLARGE_RAM 667endif 668 669ifeq ($(CHIP_HAS_EXT_PMU),1) 670export PMU_IRQ_UNIFIED ?= 1 671endif 672 673export NO_DEBUG_RELEASE ?= 0 674ifeq ($(NO_DEBUG_RELEASE),0) 675KBUILD_CFLAGS += -g 676endif 677 678# ------------------------------------------- 679# Standard C library 680# ------------------------------------------- 681 682export NOSTD 683export LIBC_ROM 684 685ifeq ($(NOSTD),1) 686 687ifeq ($(MBED),1) 688$(error Invalid configuration: MBED needs standard C library support) 689endif 690ifeq ($(RTOS),1) 691$(error Invalid configuration: RTOS needs standard C library support) 692endif 693 694ifneq ($(NO_LIBC),1) 695core-y += utils/libc/ 696endif 697 698SPECS_CFLAGS := 699 700LIB_LDFLAGS := $(filter-out -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys,$(LIB_LDFLAGS)) 701 702KBUILD_CPPFLAGS += -ffreestanding -Iutils/libc/inc 703ifeq ($(TOOLCHAIN),armclang) 704# 1) Avoid -nostdinc 705# CMSIS header files need arm_compat.h, which is one of toolchain's standard header files 706# 2) Always -nostdlib for compiling C/C++ files 707# Never convert standard API calls to non-standard library calls, but just emit standard API calls 708# 3) Avoid -nostdlib for linking final image 709# Some 64-bit calculations and math functions need toolchain's standard library 710KBUILD_CPPFLAGS += -nostdlib 711else 712KBUILD_CPPFLAGS += -nostdinc 713CFLAGS_IMAGE += -nostdlib 714endif 715 716KBUILD_CPPFLAGS += -DNOSTD 717 718else # NOSTD != 1 719 720ifeq ($(LIBC_ROM),1) 721core-y += utils/libc/ 722endif 723 724ifeq ($(TOOLCHAIN),armclang) 725LIB_LDFLAGS := $(filter-out -lsupc++,$(LIB_LDFLAGS)) 726else 727SPECS_CFLAGS := --specs=nosys.specs 728 729LIB_LDFLAGS += -lm -lc -lgcc -lnosys 730endif 731 732endif # NOSTD != 1 733 734# ------------------------------------------- 735# RTOS library 736# ------------------------------------------- 737 738export RTOS 739 740ifeq ($(RTOS),1) 741 742KERNEL ?= RTX 743export KERNEL 744 745ifneq ($(CPU), m4) 746ifeq ($(KERNEL), RTX) 747$(error RTX doesn't support $(CPU)) 748endif 749endif 750 751VALID_KERNEL_LIST := RTX RTX5 FREERTOS RHINO 752 753ifeq ($(filter $(VALID_KERNEL_LIST),$(KERNEL)),) 754$(error Bad KERNEL=$(KERNEL). Valid values are: $(VALID_KERNEL_LIST)) 755endif 756 757core-y += rtos/ 758 759KBUILD_CPPFLAGS += -DRTOS 760KBUILD_CPPFLAGS += -DKERNEL_$(KERNEL) 761 762export APPLICATION_HEAP_SIZE ?= 0x80000 763KBUILD_CPPFLAGS += -D_APPLICATION_HEAP_SIZE_=$(APPLICATION_HEAP_SIZE) 764ifeq ($(KERNEL),RTX) 765KBUILD_CPPFLAGS += \ 766 -Iinclude/rtos/rtx/ \ 767 -Irtos/rtx/TARGET_CORTEX_M 768KBUILD_CPPFLAGS += -D__RTX_CPU_STATISTICS__=1 769#KBUILD_CPPFLAGS += -DTASK_HUNG_CHECK_ENABLED=1 770else ifeq ($(KERNEL),RTX5) 771OS_IDLESTKSIZE ?= 1024 772KBUILD_CPPFLAGS += \ 773 -Iinclude/rtos/rtx5/ 774KBUILD_CPPFLAGS += -D__RTX_CPU_STATISTICS__=1 775#KBUILD_CPPFLAGS += -DTASK_HUNG_CHECK_ENABLED=1 776else ifeq ($(KERNEL),RHINO) 777KBUILD_CPPFLAGS += \ 778 -Irtos/rhino \ 779 -Irtos/rhino/include \ 780 -Irtos/rhino/cmsis 781ifneq ($(CPU),a7) 782KBUILD_CPPFLAGS += \ 783 -Irtos/rhino/arch/arm/armv7m/include 784else 785KBUILD_CPPFLAGS += \ 786 -Irtos/rhino/arch/arm/armv7a/include \ 787 -Irtos/rhino/smp 788endif 789else #!rtx 790ifeq ($(KERNEL),FREERTOS) 791KBUILD_CPPFLAGS += \ 792 -Iinclude/rtos/freertos/ 793endif #freertos 794endif #rtx 795 796ifeq ($(BLE),0) 797KBUILD_CPPFLAGS += -DBESBT_STACK_SIZE=1024*5+512 798else 799KBUILD_CPPFLAGS += -DBESBT_STACK_SIZE=1024*8+512 800endif 801 802ifeq ($(BLE_SECURITY_ENABLED), 1) 803KBUILD_CPPFLAGS += -DCFG_APP_SEC 804endif 805 806ifeq ($(TWS),1) 807OS_TASKCNT ?= 12 808OS_SCHEDULERSTKSIZE ?= 768 809OS_IDLESTKSIZE ?= 512 810else 811OS_TASKCNT ?= 20 812OS_SCHEDULERSTKSIZE ?= 512 813OS_IDLESTKSIZE ?= 256 814endif 815 816ifeq ($(CPU),m33) 817OS_CLOCK_NOMINAL ?= 16000 818else 819OS_CLOCK_NOMINAL ?= 32000 820endif 821OS_FIFOSZ ?= 24 822 823export OS_TASKCNT 824export OS_SCHEDULERSTKSIZE 825export OS_IDLESTKSIZE 826export OS_CLOCK_NOMINAL 827export OS_FIFOSZ 828 829endif 830 831# ------------------------------------------- 832# MBED library 833# ------------------------------------------- 834 835export MBED 836 837ifeq ($(MBED),1) 838 839core-y += mbed/ 840 841KBUILD_CPPFLAGS += -DMBED 842 843KBUILD_CPPFLAGS += \ 844 -Imbed/api \ 845 -Imbed/common \ 846 847endif 848 849# ------------------------------------------- 850# DEBUG functions 851# ------------------------------------------- 852 853export DEBUG 854 855ifeq ($(CHIP),best1400) 856OPT_LEVEL ?= s 857endif 858 859ifneq ($(OPT_LEVEL),) 860KBUILD_CFLAGS += -O$(OPT_LEVEL) 861else 862KBUILD_CFLAGS += -O2 863endif 864 865ifeq ($(DEBUG),1) 866 867KBUILD_CPPFLAGS += -DDEBUG 868 869else 870 871KBUILD_CPPFLAGS += -DNDEBUG 872 873REL_TRACE_ENABLE ?= 1 874ifeq ($(REL_TRACE_ENABLE),1) 875KBUILD_CPPFLAGS += -DREL_TRACE_ENABLE 876endif 877 878endif 879 880ifeq ($(NO_CHK_TRC_FMT),1) 881KBUILD_CPPFLAGS += -DNO_CHK_TRC_FMT 882else 883# Typedef int32_t to int, and typedef uint32_t to unsigned int 884KBUILD_CPPFLAGS += -U__INT32_TYPE__ -D__INT32_TYPE__=int -U__UINT32_TYPE__ 885endif 886 887ifeq ($(MERGE_CONST),1) 888ifeq ($(TOOLCHAIN),armclang) 889$(error MERGE_CONST is not supported in $(TOOLCHAIN)) 890else 891KBUILD_CPPFLAGS += -fmerge-constants -fmerge-all-constants 892endif 893endif 894 895export CORE_DUMP ?= 0 896ifeq ($(CORE_DUMP),1) 897core-y += utils/crash_catcher/ utils/xyzmodem/ 898endif 899 900# ------------------------------------------- 901# SIMU functions 902# ------------------------------------------- 903 904export SIMU 905 906ifeq ($(SIMU),1) 907 908KBUILD_CPPFLAGS += -DSIMU 909 910endif 911 912# ------------------------------------------- 913# FPGA functions 914# ------------------------------------------- 915 916export FPGA 917 918ifeq ($(FPGA),1) 919 920KBUILD_CPPFLAGS += -DFPGA 921 922endif 923 924# ------------------------------------------- 925# ROM_BUILD functions 926# ------------------------------------------- 927 928export ROM_BUILD 929 930ifeq ($(ROM_BUILD),1) 931 932KBUILD_CPPFLAGS += -DROM_BUILD 933 934endif 935 936# Limit the length of REVISION_INFO if ROM_BUILD or using rom.lds 937ifneq ($(filter 1,$(ROM_BUILD))$(filter rom.lds,$(LDS_FILE)),) 938ifeq ($(CHIP),best1000) 939REVISION_INFO := x 940else 941REVISION_INFO := $(GIT_REVISION) 942endif 943endif 944 945# ------------------------------------------- 946# PROGRAMMER functions 947# ------------------------------------------- 948 949export PROGRAMMER 950 951ifeq ($(PROGRAMMER),1) 952 953KBUILD_CPPFLAGS += -DPROGRAMMER 954 955endif 956 957# ------------------------------------------- 958# ROM_UTILS functions 959# ------------------------------------------- 960 961export ROM_UTILS_ON ?= 0 962ifeq ($(ROM_UTILS_ON),1) 963KBUILD_CPPFLAGS += -DROM_UTILS_ON 964core-y += utils/rom_utils/ 965endif 966 967# ------------------------------------------- 968# Features 969# ------------------------------------------- 970 971export DEBUG_PORT ?= 1 972 973ifneq ($(filter best1000 best2000,$(CHIP)),) 974export AUD_SECTION_STRUCT_VERSION ?= 1 975else 976export AUD_SECTION_STRUCT_VERSION ?= 2 977endif 978 979ifneq ($(AUD_SECTION_STRUCT_VERSION),) 980KBUILD_CPPFLAGS += -DAUD_SECTION_STRUCT_VERSION=$(AUD_SECTION_STRUCT_VERSION) 981endif 982 983export FLASH_CHIP 984ifneq ($(FLASH_CHIP),) 985VALID_FLASH_CHIP_LIST := ALL \ 986 GD25LQ64C GD25LQ32C GD25LQ16C GD25Q32C GD25Q80C GD25Q40C GD25Q20C \ 987 P25Q64L P25Q32L P25Q16L P25Q80H P25Q21H \ 988 XT25Q08B \ 989 EN25S80B 990ifneq ($(filter-out $(VALID_FLASH_CHIP_LIST),$(FLASH_CHIP)),) 991$(error Invalid FLASH_CHIP: $(filter-out $(VALID_FLASH_CHIP_LIST),$(FLASH_CHIP))) 992endif 993endif 994 995NV_REC_DEV_VER ?= 2 996 997export NO_SLEEP ?= 0 998 999export FAULT_DUMP ?= 1 1000 1001export USE_TRACE_ID ?= 0 1002ifeq ($(USE_TRACE_ID),1) 1003export TRACE_STR_SECTION ?= 1 1004endif 1005 1006export CRASH_BOOT ?= 0 1007 1008export OSC_26M_X4_AUD2BB ?= 0 1009ifeq ($(OSC_26M_X4_AUD2BB),1) 1010export ANA_26M_X4_ENABLE ?= 1 1011export FLASH_LOW_SPEED ?= 0 1012endif 1013 1014export AUDIO_CODEC_ASYNC_CLOSE ?= 0 1015 1016# Enable the workaround for BEST1000 version C & earlier chips 1017export CODEC_PLAY_BEFORE_CAPTURE ?= 0 1018 1019export AUDIO_INPUT_CAPLESSMODE ?= 0 1020 1021export AUDIO_INPUT_LARGEGAIN ?= 0 1022 1023export AUDIO_INPUT_MONO ?= 0 1024 1025export AUDIO_OUTPUT_MONO ?= 0 1026 1027export AUDIO_OUTPUT_VOLUME_DEFAULT ?= 10 1028 1029export AUDIO_OUTPUT_INVERT_RIGHT_CHANNEL ?= 0 1030 1031export AUDIO_OUTPUT_INVERT_ALL_CHANNEL ?= 0 1032 1033export AUDIO_OUTPUT_CALIB_GAIN_MISSMATCH ?= 0 1034 1035ifeq ($(USB_AUDIO_APP),1) 1036export CODEC_HIGH_QUALITY ?= 1 1037endif 1038ifneq ($(filter best2300 best2300p,$(CHIP)),) 1039ifeq ($(ANC_APP),1) 1040export CODEC_HIGH_QUALITY ?= 1 1041endif 1042endif 1043 1044ifeq ($(CHIP),best1000) 1045AUDIO_OUTPUT_DIFF ?= 1 1046AUDIO_OUTPUT_DC_CALIB ?= $(AUDIO_OUTPUT_DIFF) 1047AUDIO_OUTPUT_SMALL_GAIN_ATTN ?= 1 1048AUDIO_OUTPUT_SW_GAIN ?= 1 1049ANC_L_R_MISALIGN_WORKAROUND ?= 1 1050else ifeq ($(CHIP),best2000) 1051ifeq ($(CODEC_HIGH_QUALITY),1) 1052export VCODEC_VOLT ?= 2.5V 1053else 1054export VCODEC_VOLT ?= 1.6V 1055endif 1056AUDIO_OUTPUT_DIFF ?= 0 1057ifeq ($(VCODEC_VOLT),2.5V) 1058AUDIO_OUTPUT_DC_CALIB ?= 0 1059AUDIO_OUTPUT_DC_CALIB_ANA ?= 1 1060else 1061AUDIO_OUTPUT_DC_CALIB ?= 1 1062AUDIO_OUTPUT_DC_CALIB_ANA ?= 0 1063endif 1064ifneq ($(AUDIO_OUTPUT_DIFF),1) 1065# Class-G module still needs improving 1066#DAC_CLASSG_ENABLE ?= 1 1067endif 1068else ifeq ($(CHIP),haas1000) 1069export VCODEC_VOLT ?= 1.8V 1070AUDIO_OUTPUT_DC_CALIB ?= 0 1071AUDIO_OUTPUT_DC_CALIB_ANA ?= 1 1072else ifneq ($(filter best3001 best3003 best3005,$(CHIP)),) 1073export VCODEC_VOLT ?= 2.5V 1074AUDIO_OUTPUT_DC_CALIB ?= 1 1075AUDIO_OUTPUT_DC_CALIB_ANA ?= 0 1076else 1077AUDIO_OUTPUT_DC_CALIB ?= 0 1078AUDIO_OUTPUT_DC_CALIB_ANA ?= 1 1079endif 1080 1081ifeq ($(AUDIO_OUTPUT_DC_CALIB)-$(AUDIO_OUTPUT_DC_CALIB_ANA),1-1) 1082$(error AUDIO_OUTPUT_DC_CALIB and AUDIO_OUTPUT_DC_CALIB_ANA cannot be enabled at the same time) 1083endif 1084 1085export AUDIO_OUTPUT_DIFF 1086 1087export AUDIO_OUTPUT_DC_CALIB 1088 1089export AUDIO_OUTPUT_DC_CALIB_ANA 1090 1091export AUDIO_OUTPUT_SMALL_GAIN_ATTN 1092 1093export AUDIO_OUTPUT_SW_GAIN 1094 1095export ANC_L_R_MISALIGN_WORKAROUND 1096 1097export DAC_CLASSG_ENABLE 1098 1099export AF_DEVICE_I2S ?= 0 1100 1101export AF_DEVICE_TDM ?= 0 1102 1103export AF_ADC_I2S_SYNC ?= 0 1104ifeq ($(AF_ADC_I2S_SYNC),1) 1105KBUILD_CPPFLAGS += -DAF_ADC_I2S_SYNC 1106export AF_DEVICE_I2S = 1 1107export INT_LOCK_EXCEPTION ?= 1 1108endif 1109 1110export BONE_SENSOR_TDM ?= 0 1111ifeq ($(BONE_SENSOR_TDM),1) 1112KBUILD_CPPFLAGS += -DBONE_SENSOR_TDM 1113KBUILD_CPPFLAGS += -DI2C_TASK_MODE 1114export AF_DEVICE_I2S = 1 1115export AF_DEVICE_TDM = 1 1116KBUILD_CPPFLAGS += -DI2S_MCLK_FROM_SPDIF 1117KBUILD_CPPFLAGS += -DI2S_MCLK_IOMUX_INDEX=13 1118KBUILD_CPPFLAGS += -DCLKOUT_IOMUX_INDEX=13 1119endif 1120 1121ifeq ($(ANC_APP),1) 1122export ANC_FF_ENABLED ?= 1 1123endif 1124 1125ifeq ($(CHIP),best1400) 1126export AUDIO_RESAMPLE ?= 1 1127export PMU_IRQ_UNIFIED ?= 1 1128else ifeq ($(CHIP),haas1000) 1129export AUDIO_RESAMPLE ?= 1 1130else 1131export AUDIO_RESAMPLE ?= 0 1132endif 1133 1134ifeq ($(AUDIO_RESAMPLE),1) 1135ifeq ($(CHIP),best1000) 1136export SW_PLAYBACK_RESAMPLE ?= 1 1137export SW_CAPTURE_RESAMPLE ?= 1 1138export NO_SCO_RESAMPLE ?= 1 1139endif # CHIP is best1000 1140ifeq ($(CHIP),best2000) 1141export SW_CAPTURE_RESAMPLE ?= 1 1142export SW_SCO_RESAMPLE ?= 1 1143export NO_SCO_RESAMPLE ?= 0 1144endif # CHIP is best2000 1145ifeq ($(BT_ANC),1) 1146ifeq ($(NO_SCO_RESAMPLE),1) 1147$(error BT_ANC and NO_SCO_RESAMPLE cannot be enabled at the same time) 1148endif 1149endif # BT_ANC 1150endif # AUDIO_RESAMPLE 1151 1152export HW_FIR_DSD_PROCESS ?= 0 1153 1154export HW_FIR_EQ_PROCESS ?= 0 1155 1156export SW_IIR_EQ_PROCESS ?= 0 1157ifeq ($(SW_IIR_EQ_PROCESS),1) 1158export A2DP_EQ_24BIT = 1 1159endif 1160 1161export HW_IIR_EQ_PROCESS ?= 0 1162 1163export HW_DAC_IIR_EQ_PROCESS ?= 0 1164 1165export AUDIO_DRC ?= 0 1166 1167export AUDIO_DRC2 ?= 0 1168 1169export HW_DC_FILTER_WITH_IIR ?= 0 1170ifeq ($(HW_DC_FILTER_WITH_IIR),1) 1171KBUILD_CPPFLAGS += -DHW_DC_FILTER_WITH_IIR 1172export HW_FILTER_CODEC_IIR ?= 1 1173endif 1174 1175ifeq ($(USB_AUDIO_APP),1) 1176export ANDROID_ACCESSORY_SPEC ?= 1 1177export FIXED_CODEC_ADC_VOL ?= 0 1178 1179ifneq ($(BTUSB_AUDIO_MODE),1) 1180NO_PWRKEY ?= 1 1181NO_GROUPKEY ?= 1 1182endif 1183endif 1184 1185export NO_PWRKEY 1186 1187export NO_GROUPKEY 1188 1189ifneq ($(CHIP),best1000) 1190ifneq ($(CHIP)-$(TWS),best2000-1) 1191# For bt 1192export A2DP_EQ_24BIT ?= 1 1193# For usb audio 1194export AUDIO_PLAYBACK_24BIT ?= 1 1195endif 1196endif 1197 1198ifeq ($(CHIP),best1000) 1199 1200ifeq ($(AUD_PLL_DOUBLE),1) 1201KBUILD_CPPFLAGS += -DAUD_PLL_DOUBLE 1202endif 1203 1204ifeq ($(DUAL_AUX_MIC),1) 1205ifeq ($(AUDIO_INPUT_MONO),1) 1206$(error Invalid talk mic configuration) 1207endif 1208KBUILD_CPPFLAGS += -D_DUAL_AUX_MIC_ 1209endif 1210 1211endif # best1000 1212 1213ifeq ($(CAPTURE_ANC_DATA),1) 1214KBUILD_CPPFLAGS += -DCAPTURE_ANC_DATA 1215endif 1216 1217ifeq ($(AUDIO_ANC_TT_HW),1) 1218KBUILD_CPPFLAGS += -DAUDIO_ANC_TT_HW 1219endif 1220 1221ifeq ($(AUDIO_ANC_FB_MC_HW),1) 1222KBUILD_CPPFLAGS += -DAUDIO_ANC_FB_MC_HW 1223endif 1224 1225ifeq ($(AUDIO_ANC_FB_MC),1) 1226ifeq ($(AUDIO_RESAMPLE),1) 1227$(error AUDIO_ANC_FB_MC conflicts with AUDIO_RESAMPLE) 1228endif 1229KBUILD_CPPFLAGS += -DAUDIO_ANC_FB_MC 1230endif 1231 1232ifeq ($(BT_ANC),1) 1233KBUILD_CPPFLAGS += -D__BT_ANC__ 1234endif 1235 1236export ANC_NOISE_TRACKER ?= 0 1237ifeq ($(ANC_NOISE_TRACKER),1) 1238ifeq ($(IBRT),1) 1239KBUILD_CPPFLAGS += -DANC_NOISE_TRACKER_CHANNEL_NUM=1 1240else 1241KBUILD_CPPFLAGS += -DANC_NOISE_TRACKER_CHANNEL_NUM=2 1242endif 1243endif 1244 1245ifeq ($(ANC_WNR_ENABLED),1) 1246KBUILD_CPPFLAGS += -DGLOBAL_SRAM_CMSIS_FFT 1247endif 1248 1249ifeq ($(KWS_ALEXA),1) 1250KBUILD_CPPFLAGS += -DKWS_BES 1251KBUILD_CPPFLAGS += -DGLOBAL_SRAM_KISS_FFT 1252KBUILD_CPPFLAGS += -DGLOBAL_SRAM_CMSIS_FFT 1253endif 1254 1255export BTUSB_AUDIO_MODE ?= 0 1256ifeq ($(BTUSB_AUDIO_MODE),1) 1257KBUILD_CPPFLAGS += -DBTUSB_AUDIO_MODE 1258endif 1259 1260export BT_USB_AUDIO_DUAL_MODE ?= 0 1261ifeq ($(BT_USB_AUDIO_DUAL_MODE),1) 1262KBUILD_CPPFLAGS += -DBT_USB_AUDIO_DUAL_MODE 1263endif 1264 1265ifeq ($(WATCHER_DOG),1) 1266KBUILD_CPPFLAGS += -D__WATCHER_DOG_RESET__ 1267endif 1268 1269export ULTRA_LOW_POWER ?= 0 1270ifeq ($(ULTRA_LOW_POWER),1) 1271export FLASH_LOW_SPEED ?= 1 1272export PSRAM_LOW_SPEED ?= 1 1273endif 1274 1275export USB_HIGH_SPEED ?= 0 1276ifeq ($(CHIP),best2000) 1277ifeq ($(USB_HIGH_SPEED),1) 1278export AUDIO_USE_BBPLL ?= 1 1279endif 1280ifeq ($(AUDIO_USE_BBPLL),1) 1281ifeq ($(MCU_HIGH_PERFORMANCE_MODE),1) 1282$(error MCU_HIGH_PERFORMANCE_MODE conflicts with AUDIO_USE_BBPLL) 1283endif 1284else # !AUDIO_USE_BBPLL 1285ifeq ($(USB_HIGH_SPEED),1) 1286$(error AUDIO_USE_BBPLL must be used with USB_HIGH_SPEED) 1287endif 1288endif # !AUDIO_USE_BBPLL 1289endif # best2000 1290 1291ifeq ($(SIMPLE_TASK_SWITCH),1) 1292KBUILD_CPPFLAGS += -DSIMPLE_TASK_SWITCH 1293endif 1294 1295ifeq ($(ASSERT_SHOW_FILE_FUNC),1) 1296KBUILD_CPPFLAGS += -DASSERT_SHOW_FILE_FUNC 1297else 1298ifeq ($(ASSERT_SHOW_FILE),1) 1299KBUILD_CPPFLAGS += -DASSERT_SHOW_FILE 1300else 1301ifeq ($(ASSERT_SHOW_FUNC),1) 1302KBUILD_CPPFLAGS += -DASSERT_SHOW_FUNC 1303endif 1304endif 1305endif 1306 1307ifeq ($(CALIB_SLOW_TIMER),1) 1308KBUILD_CPPFLAGS += -DCALIB_SLOW_TIMER 1309endif 1310 1311ifeq ($(INT_LOCK_EXCEPTION),1) 1312KBUILD_CPPFLAGS += -DINT_LOCK_EXCEPTION 1313endif 1314 1315export APP_ANC_TEST ?= 0 1316ifeq ($(APP_ANC_TEST),1) 1317KBUILD_CPPFLAGS += -DAPP_ANC_TEST 1318KBUILD_CPPFLAGS += -DANC_PROD_TEST 1319endif 1320 1321USER_REBOOT_PLAY_MUSIC_AUTO ?= 0 1322ifeq ($(USER_REBOOT_PLAY_MUSIC_AUTO),1) 1323KBUILD_CPPFLAGS += -DUSER_REBOOT_PLAY_MUSIC_AUTO 1324export USER_REBOOT_PLAY_MUSIC_AUTO ?= 1 1325endif 1326 1327export TEST_OVER_THE_AIR ?= 0 1328ifeq ($(TEST_OVER_THE_AIR),1) 1329KBUILD_CPPFLAGS += -DTEST_OVER_THE_AIR_ENANBLED=1 1330endif 1331 1332ifeq ($(USE_TRACE_ID),1) 1333KBUILD_CPPFLAGS += -DUSE_TRACE_ID 1334endif 1335 1336ifeq ($(TRACE_STR_SECTION),1) 1337KBUILD_CPPFLAGS += -DTRACE_STR_SECTION 1338CPPFLAGS_${LDS_FILE} += -DTRACE_STR_SECTION 1339endif 1340 1341USE_THIRDPARTY ?= 0 1342ifeq ($(USE_THIRDPARTY),1) 1343KBUILD_CPPFLAGS += -D__THIRDPARTY 1344core-y += thirdparty/ 1345endif 1346 1347export PC_CMD_UART ?= 0 1348ifneq ($(PC_CMD_UART),0) 1349KBUILD_CPPFLAGS += -D__PC_CMD_UART__=$(PC_CMD_UART) 1350endif 1351 1352ifeq ($(VOICE_DETECTOR_EN),1) 1353KBUILD_CPPFLAGS += -DVOICE_DETECTOR_EN 1354endif 1355 1356ifeq ($(USB_ANC_MC_EQ_TUNING),1) 1357KBUILD_CPPFLAGS += -DUSB_ANC_MC_EQ_TUNING -DANC_PROD_TEST 1358endif 1359 1360export AUTO_TEST ?= 0 1361ifeq ($(AUTO_TEST),1) 1362KBUILD_CFLAGS += -D_AUTO_TEST_ 1363endif 1364 1365ifeq ($(RB_CODEC),1) 1366CPPFLAGS_${LDS_FILE} += -DRB_CODEC 1367endif 1368 1369ifneq ($(DATA_BUF_START),) 1370CPPFLAGS_${LDS_FILE} += -DDATA_BUF_START=$(DATA_BUF_START) 1371endif 1372 1373ifeq ($(USER_SECURE_BOOT),1) 1374core-y += utils/user_secure_boot/ \ 1375 utils/system_info/ 1376endif 1377 1378ifeq ($(MAX_DAC_OUTPUT),-60db) 1379MAX_DAC_OUTPUT_FLAGS := -DMAX_DAC_OUTPUT_M60DB 1380else 1381ifeq ($(MAX_DAC_OUTPUT),3.75mw) 1382MAX_DAC_OUTPUT_FLAGS := -DMAX_DAC_OUTPUT_3P75MW 1383else 1384ifeq ($(MAX_DAC_OUTPUT),5mw) 1385MAX_DAC_OUTPUT_FLAGS := -DMAX_DAC_OUTPUT_5MW 1386else 1387ifeq ($(MAX_DAC_OUTPUT),10mw) 1388MAX_DAC_OUTPUT_FLAGS := -DMAX_DAC_OUTPUT_10MW 1389else 1390ifneq ($(MAX_DAC_OUTPUT),30mw) 1391ifneq ($(MAX_DAC_OUTPUT),) 1392$(error Invalid MAX_DAC_OUTPUT value: $(MAX_DAC_OUTPUT) (MUST be one of: -60db 3.75mw 5mw 10mw 30mw)) 1393endif 1394endif 1395endif 1396endif 1397endif 1398endif 1399export MAX_DAC_OUTPUT_FLAGS 1400 1401# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 1402# BT features 1403# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1404ifeq ($(BT_APP),1) 1405 1406export BT_IF_INCLUDES ?= 1407export BT_PROFILES_INCLUDES ?= 1408export ENHANCED_STACK ?= 0 1409 1410export INTERSYS_NO_THREAD ?= 0 1411 1412export INTERSYS_DEBUG ?= 0 1413ifeq ($(INTERSYS_DEBUG),1) 1414 KBUILD_CPPFLAGS += -DINTERSYS_DEBUG=1 1415endif 1416 1417export BT_DEBUG_TPORTS ?= 0 1418ifeq ($(BT_DEBUG_TPORTS),1) 1419 KBUILD_CPPFLAGS += -D__BT_DEBUG_TPORTS__ 1420endif 1421 1422export SNOOP_DATA_EXCHANGE_VIA_BLE ?= 0 1423ifeq ($(SNOOP_DATA_EXCHANGE_VIA_BLE),1) 1424 KBUILD_CPPFLAGS += -DSNOOP_DATA_EXCHANGE_VIA_BLE 1425endif 1426 1427export SYNC_BT_CTLR_PROFILE ?= 0 1428ifeq ($(SYNC_BT_CTLR_PROFILE),1) 1429 KBUILD_CPPFLAGS += -DSYNC_BT_CTLR_PROFILE 1430endif 1431 1432export PROFILE_DEBUG ?= 0 1433ifeq ($(PROFILE_DEBUG),1) 1434 KBUILD_CPPFLAGS += -DXA_DEBUG=1 1435endif 1436 1437ifeq ($(ENHANCED_STACK),1) 1438BT_IF_INCLUDES += \ 1439 -Iservices/bt_if_enhanced/inc 1440BT_PROFILES_INCLUDES += \ 1441 -Iservices/bt_profiles_enhanced/inc 1442else 1443BT_IF_INCLUDES += \ 1444 -Iservices/bt_if/inc 1445BT_PROFILES_INCLUDES += \ 1446 -Iservices/bt_profiles/inc \ 1447 -Iservices/bt_profiles/inc/sys 1448endif 1449 1450ifeq ($(ENHANCED_STACK),1) 1451KBUILD_CFLAGS += -DENHANCED_STACK 1452#KBUILD_CPPFLAGS += -D__A2DP_AVDTP_CP__ -D__A2DP_AVDTP_DR__ 1453#KBUILD_CPPFLAGS += -D__A2DP_AVDTP_DR__ 1454KBUILD_CPPFLAGS += -D__BLE_TX_USE_BT_TX_QUEUE__ 1455ifeq ($(BISTO_ENABLE),1) 1456ifeq ($(IBRT),0) 1457KBUILD_CPPFLAGS += -D__BTMAP_ENABLE__ #disbled before IBRT MAP role switch feature is ready 1458endif 1459endif 1460endif 1461 1462ifneq ($(filter-out 2M 3M,$(BT_RF_PREFER)),) 1463$(error Invalid BT_RF_PREFER=$(BT_RF_PREFER)) 1464endif 1465ifneq ($(BT_RF_PREFER),) 1466RF_PREFER := $(subst .,P,$(BT_RF_PREFER)) 1467KBUILD_CPPFLAGS += -D__$(RF_PREFER)_PACK__ 1468endif 1469 1470export AUDIO_SCO_BTPCM_CHANNEL ?= 1 1471ifeq ($(AUDIO_SCO_BTPCM_CHANNEL),1) 1472KBUILD_CPPFLAGS += -D_SCO_BTPCM_CHANNEL_ 1473endif 1474 1475export BT_ONE_BRING_TWO ?= 0 1476ifeq ($(BT_ONE_BRING_TWO),1) 1477KBUILD_CPPFLAGS += -D__BT_ONE_BRING_TWO__ 1478endif 1479 1480export A2DP_PLAYER_USE_BT_TRIGGER ?= 1 1481ifeq ($(A2DP_PLAYER_USE_BT_TRIGGER),1) 1482KBUILD_CPPFLAGS += -D__A2DP_PLAYER_USE_BT_TRIGGER__ 1483endif 1484 1485export BT_SELECT_PROF_DEVICE_ID ?= 0 1486ifeq ($(BT_ONE_BRING_TWO),1) 1487ifeq ($(BT_SELECT_PROF_DEVICE_ID),1) 1488KBUILD_CPPFLAGS += -D__BT_SELECT_PROF_DEVICE_ID__ 1489endif 1490endif 1491 1492export SBC_FUNC_IN_ROM ?= 0 1493ifeq ($(SBC_FUNC_IN_ROM),1) 1494 1495KBUILD_CPPFLAGS += -D__SBC_FUNC_IN_ROM__ 1496 1497ifeq ($(CHIP),best2000) 1498UNALIGNED_ACCESS ?= 1 1499KBUILD_CPPFLAGS += -D__SBC_FUNC_IN_ROM_VBEST2000_ONLYSBC__ 1500KBUILD_CPPFLAGS += -D__SBC_FUNC_IN_ROM_VBEST2000__ 1501endif 1502endif 1503 1504export HFP_1_6_ENABLE ?= 0 1505ifeq ($(HFP_1_6_ENABLE),1) 1506KBUILD_CPPFLAGS += -DHFP_1_6_ENABLE 1507ifeq ($(MSBC_16K_SAMPLE_RATE),0) 1508KBUILD_CPPFLAGS += -DMSBC_8K_SAMPLE_RATE 1509export DSP_LIB ?= 1 1510endif 1511endif 1512 1513export A2DP_AAC_ON ?= 0 1514ifeq ($(A2DP_AAC_ON),1) 1515KBUILD_CPPFLAGS += -DA2DP_AAC_ON 1516KBUILD_CPPFLAGS += -D__ACC_FRAGMENT_COMPATIBLE__ 1517endif 1518 1519export A2DP_LHDC_ON ?= 0 1520ifeq ($(A2DP_LHDC_ON),1) 1521KBUILD_CPPFLAGS += -DA2DP_LHDC_ON 1522export A2DP_LHDC_V3 ?= 0 1523ifeq ($(A2DP_LHDC_V3),1) 1524KBUILD_CPPFLAGS += -DA2DP_LHDC_V3 1525endif 1526core-y += thirdparty/audio_codec_lib/liblhdc-dec/ 1527endif 1528ifeq ($(USER_SECURE_BOOT),1) 1529KBUILD_CPPFLAGS += -DUSER_SECURE_BOOT 1530endif 1531 1532export A2DP_SCALABLE_ON ?= 0 1533ifeq ($(A2DP_SCALABLE_ON),1) 1534KBUILD_CPPFLAGS += -DA2DP_SCALABLE_ON 1535KBUILD_CPPFLAGS += -DGLOBAL_SRAM_KISS_FFT 1536#KBUILD_CPPFLAGS += -DA2DP_SCALABLE_UHQ_SUPPORT 1537core-y += thirdparty/audio_codec_lib/scalable/ 1538endif 1539 1540export A2DP_LDAC_ON ?= 0 1541ifeq ($(A2DP_LDAC_ON),1) 1542KBUILD_CPPFLAGS += -DA2DP_LDAC_ON 1543core-y += thirdparty/audio_codec_lib/ldac/ 1544endif 1545 1546export A2DP_CP_ACCEL ?= 0 1547ifeq ($(A2DP_CP_ACCEL),1) 1548KBUILD_CPPFLAGS += -DA2DP_CP_ACCEL 1549endif 1550 1551export SCO_CP_ACCEL ?= 0 1552ifeq ($(SCO_CP_ACCEL),1) 1553KBUILD_CPPFLAGS += -DSCO_CP_ACCEL 1554# spx fft will share buffer which is not fit for dual cores. 1555KBUILD_CPPFLAGS += -DUSE_CMSIS_F32_FFT 1556endif 1557 1558export SCO_TRACE_CP_ACCEL ?= 0 1559ifeq ($(SCO_TRACE_CP_ACCEL),1) 1560KBUILD_CPPFLAGS += -DSCO_TRACE_CP_ACCEL 1561endif 1562 1563ifeq ($(BT_XTAL_SYNC),1) 1564KBUILD_CPPFLAGS += -DBT_XTAL_SYNC_NEW_METHOD 1565KBUILD_CPPFLAGS += -DFIXED_BIT_OFFSET_TARGET 1566endif 1567 1568ifeq ($(APP_LINEIN_A2DP_SOURCE),1) 1569KBUILD_CPPFLAGS += -DAPP_LINEIN_A2DP_SOURCE 1570endif 1571 1572ifeq ($(HSP_ENABLE),1) 1573KBUILD_CPPFLAGS += -D__HSP_ENABLE__ 1574endif 1575 1576ifeq ($(APP_I2S_A2DP_SOURCE),1) 1577KBUILD_CPPFLAGS += -DAPP_I2S_A2DP_SOURCE 1578endif 1579 1580export TX_RX_PCM_MASK ?= 0 1581ifeq ($(TX_RX_PCM_MASK),1) 1582KBUILD_CPPFLAGS += -DTX_RX_PCM_MASK 1583endif 1584 1585export PCM_FAST_MODE ?= 0 1586ifeq ($(PCM_FAST_MODE),1) 1587KBUILD_CPPFLAGS += -DPCM_FAST_MODE 1588endif 1589 1590export LOW_DELAY_SCO ?= 0 1591ifeq ($(LOW_DELAY_SCO),1) 1592KBUILD_CPPFLAGS += -DLOW_DELAY_SCO 1593endif 1594 1595export CVSD_BYPASS ?= 0 1596ifeq ($(CVSD_BYPASS),1) 1597KBUILD_CPPFLAGS += -DCVSD_BYPASS 1598endif 1599 1600export SCO_DMA_SNAPSHOT ?= 0 1601ifeq ($(SCO_DMA_SNAPSHOT),1) 1602KBUILD_CPPFLAGS += -DSCO_DMA_SNAPSHOT 1603endif 1604 1605export SCO_OPTIMIZE_FOR_RAM ?= 0 1606ifeq ($(SCO_OPTIMIZE_FOR_RAM),1) 1607KBUILD_CPPFLAGS += -DSCO_OPTIMIZE_FOR_RAM 1608endif 1609 1610export AAC_TEXT_PARTIAL_IN_FLASH ?= 0 1611ifeq ($(AAC_TEXT_PARTIAL_IN_FLASH),1) 1612KBUILD_CPPFLAGS += -DAAC_TEXT_PARTIAL_IN_FLASH 1613endif 1614 1615ifeq ($(SUPPORT_BATTERY_REPORT),1) 1616KBUILD_CPPFLAGS += -DSUPPORT_BATTERY_REPORT 1617endif 1618 1619ifeq ($(SUPPORT_HF_INDICATORS),1) 1620KBUILD_CPPFLAGS += -DSUPPORT_HF_INDICATORS 1621endif 1622 1623ifeq ($(SUPPORT_SIRI),1) 1624KBUILD_CPPFLAGS += -DSUPPORT_SIRI 1625endif 1626 1627export BQB_PROFILE_TEST ?= 0 1628ifeq ($(BQB_PROFILE_TEST),1) 1629KBUILD_CPPFLAGS += -D__BQB_PROFILE_TEST__ 1630endif 1631 1632export AUDIO_SPECTRUM ?= 0 1633ifeq ($(AUDIO_SPECTRUM),1) 1634KBUILD_CPPFLAGS += -D__AUDIO_SPECTRUM__ 1635KBUILD_CPPFLAGS += -DGLOBAL_SRAM_KISS_FFT 1636endif 1637 1638export INTERCONNECTION ?= 0 1639ifeq ($(INTERCONNECTION),1) 1640KBUILD_CPPFLAGS += -D__INTERCONNECTION__ 1641endif 1642 1643export INTERACTION ?= 0 1644ifeq ($(INTERACTION),1) 1645KBUILD_CPPFLAGS += -D__INTERACTION__ 1646endif 1647 1648export INTERACTION_FASTPAIR ?= 0 1649ifeq ($(INTERACTION_FASTPAIR),1) 1650KBUILD_CPPFLAGS += -D__INTERACTION_FASTPAIR__ 1651KBUILD_CPPFLAGS += -D__INTERACTION_CUSTOMER_AT_COMMAND__ 1652endif 1653 1654ifeq ($(SUSPEND_ANOTHER_DEV_A2DP_STREAMING_WHEN_CALL_IS_COMING),1) 1655KBUILD_CPPFLAGS += -DSUSPEND_ANOTHER_DEV_A2DP_STREAMING_WHEN_CALL_IS_COMING 1656endif 1657 1658export TWS_PROMPT_SYNC ?= 0 1659ifeq ($(TWS_PROMPT_SYNC), 1) 1660export MIX_AUDIO_PROMPT_WITH_A2DP_MEDIA_ENABLED = 1 1661KBUILD_CPPFLAGS += -DTWS_PROMPT_SYNC 1662endif 1663 1664export MIX_AUDIO_PROMPT_WITH_A2DP_MEDIA_ENABLED ?= 1 1665ifeq ($(MIX_AUDIO_PROMPT_WITH_A2DP_MEDIA_ENABLED), 1) 1666KBUILD_CPPFLAGS += -DMIX_AUDIO_PROMPT_WITH_A2DP_MEDIA_ENABLED 1667export RESAMPLE_ANY_SAMPLE_RATE ?= 1 1668endif 1669 1670export LBRT ?= 0 1671ifeq ($(LBRT),1) 1672KBUILD_CPPFLAGS += -DLBRT 1673endif 1674 1675export IBRT ?= 0 1676ifeq ($(IBRT),1) 1677KBUILD_CPPFLAGS += -DIBRT 1678KBUILD_CPPFLAGS += -DIBRT_BLOCKED 1679KBUILD_CPPFLAGS += -DIBRT_NOT_USE 1680endif 1681 1682ifeq ($(TWS_SYSTEM_ENABLED),1) 1683KBUILD_CPPFLAGS += -DTWS_SYSTEM_ENABLED 1684endif 1685 1686export BES_AUD ?= 0 1687ifeq ($(BES_AUD),1) 1688KBUILD_CPPFLAGS += -DBES_AUD 1689endif 1690 1691export IBRT_SEARCH_UI ?= 0 1692ifeq ($(IBRT_SEARCH_UI),1) 1693KBUILD_CPPFLAGS += -DIBRT_SEARCH_UI 1694endif 1695 1696endif # BT_APP 1697 1698# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 1699# BLE features 1700# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1701ifeq ($(BLE),1) 1702 1703KBUILD_CPPFLAGS += -DBLE_ENABLE 1704 1705KBUILD_CPPFLAGS += -D__IAG_BLE_INCLUDE__ 1706 1707IS_USE_BLE_DUAL_CONNECTION ?= 1 1708 1709ifeq ($(IS_USE_BLE_DUAL_CONNECTION),1) 1710KBUILD_CPPFLAGS += -DBLE_CONNECTION_MAX=2 1711else 1712KBUILD_CPPFLAGS += -DBLE_CONNECTION_MAX=1 1713endif 1714 1715ifeq ($(IS_ENABLE_DEUGGING_MODE),1) 1716KBUILD_CPPFLAGS += -DIS_ENABLE_DEUGGING_MODE 1717endif 1718 1719endif # BLE 1720 1721# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 1722# Speech features 1723# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1724export SPEECH_TX_24BIT ?= 0 1725ifeq ($(SPEECH_TX_24BIT),1) 1726KBUILD_CPPFLAGS += -DSPEECH_TX_24BIT 1727endif 1728 1729export SPEECH_TX_DC_FILTER ?= 0 1730ifeq ($(SPEECH_TX_DC_FILTER),1) 1731KBUILD_CPPFLAGS += -DSPEECH_TX_DC_FILTER 1732KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1733endif 1734 1735export SPEECH_TX_MIC_CALIBRATION ?= 0 1736ifeq ($(SPEECH_TX_MIC_CALIBRATION),1) 1737KBUILD_CPPFLAGS += -DSPEECH_TX_MIC_CALIBRATION 1738endif 1739 1740export SPEECH_TX_MIC_FIR_CALIBRATION ?= 0 1741ifeq ($(SPEECH_TX_MIC_FIR_CALIBRATION),1) 1742KBUILD_CPPFLAGS += -DSPEECH_TX_MIC_FIR_CALIBRATION 1743endif 1744 1745export SPEECH_TX_AEC_CODEC_REF ?= 0 1746 1747export SPEECH_TX_AEC ?= 0 1748ifeq ($(SPEECH_TX_AEC),1) 1749KBUILD_CPPFLAGS += -DSPEECH_TX_AEC 1750KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1751ifeq ($(CHIP_HAS_EC_CODEC_REF),1) 1752export SPEECH_TX_AEC_CODEC_REF := 1 1753endif 1754endif 1755 1756export SPEECH_TX_AEC2 ?= 0 1757ifeq ($(SPEECH_TX_AEC2),1) 1758$(error SPEECH_TX_AEC2 is not supported now, use SPEECH_TX_AEC2FLOAT instead) 1759KBUILD_CPPFLAGS += -DSPEECH_TX_AEC2 1760KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1761ifeq ($(CHIP_HAS_EC_CODEC_REF),1) 1762export SPEECH_TX_AEC_CODEC_REF := 1 1763endif 1764endif 1765 1766export SPEECH_TX_AEC3 ?= 0 1767ifeq ($(SPEECH_TX_AEC3),1) 1768KBUILD_CPPFLAGS += -DSPEECH_TX_AEC3 1769KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1770ifeq ($(CHIP_HAS_EC_CODEC_REF),1) 1771export SPEECH_TX_AEC_CODEC_REF := 1 1772endif 1773endif 1774 1775export SPEECH_TX_AEC2FLOAT ?= 0 1776ifeq ($(SPEECH_TX_AEC2FLOAT),1) 1777KBUILD_CPPFLAGS += -DSPEECH_TX_AEC2FLOAT 1778KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1779export DSP_LIB ?= 1 1780ifeq ($(CHIP_HAS_EC_CODEC_REF),1) 1781export SPEECH_TX_AEC_CODEC_REF := 1 1782endif 1783endif 1784 1785ifeq ($(SCO_DMA_SNAPSHOT),0) 1786export SPEECH_TX_AEC_CODEC_REF := 0 1787endif 1788 1789export SPEECH_TX_NS ?= 0 1790ifeq ($(SPEECH_TX_NS),1) 1791KBUILD_CPPFLAGS += -DSPEECH_TX_NS 1792KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1793endif 1794 1795export SPEECH_TX_NS2 ?= 0 1796ifeq ($(SPEECH_TX_NS2),1) 1797KBUILD_CPPFLAGS += -DSPEECH_TX_NS2 1798KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1799KBUILD_CPPFLAGS += -DLC_MMSE_FRAME_LENGTH=$(LC_MMSE_FRAME_LENGTH) 1800endif 1801 1802export SPEECH_TX_NS2FLOAT ?= 0 1803ifeq ($(SPEECH_TX_NS2FLOAT),1) 1804KBUILD_CPPFLAGS += -DSPEECH_TX_NS2FLOAT 1805KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1806export DSP_LIB ?= 1 1807endif 1808 1809export SPEECH_TX_NS3 ?= 0 1810ifeq ($(SPEECH_TX_NS3),1) 1811KBUILD_CPPFLAGS += -DSPEECH_TX_NS3 1812KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1813endif 1814 1815export SPEECH_TX_WNR ?= 0 1816ifeq ($(SPEECH_TX_WNR),1) 1817KBUILD_CPPFLAGS += -DSPEECH_TX_WNR 1818KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1819endif 1820 1821export SPEECH_CS_VAD ?= 0 1822ifeq ($(SPEECH_CS_VAD),1) 1823KBUILD_CPPFLAGS += -DSPEECH_CS_VAD 1824KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1825endif 1826 1827export SPEECH_CODEC_CAPTURE_CHANNEL_NUM ?= 1 1828 1829export SPEECH_TX_2MIC_NS ?= 0 1830ifeq ($(SPEECH_TX_2MIC_NS),1) 1831KBUILD_CPPFLAGS += -DSPEECH_TX_2MIC_NS 1832KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1833export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1834endif 1835 1836export SPEECH_TX_2MIC_NS2 ?= 0 1837ifeq ($(SPEECH_TX_2MIC_NS2),1) 1838KBUILD_CPPFLAGS += -DSPEECH_TX_2MIC_NS2 1839KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1840KBUILD_CPPFLAGS += -DCOH_FRAME_LENGTH=$(COH_FRAME_LENGTH) 1841export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1842endif 1843 1844export SPEECH_TX_2MIC_NS3 ?= 0 1845ifeq ($(SPEECH_TX_2MIC_NS3),1) 1846KBUILD_CPPFLAGS += -DSPEECH_TX_2MIC_NS3 1847KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1848export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1849endif 1850 1851export SPEECH_TX_2MIC_NS4 ?= 0 1852ifeq ($(SPEECH_TX_2MIC_NS4),1) 1853KBUILD_CPPFLAGS += -DSPEECH_TX_2MIC_NS4 1854KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1855 1856ifeq ($(BONE_SENSOR_TDM),1) 1857# Get 1 channel from sensor 1858export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 1 1859else 1860export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1861endif 1862 1863endif 1864 1865export SPEECH_TX_2MIC_NS5 ?= 0 1866ifeq ($(SPEECH_TX_2MIC_NS5),1) 1867KBUILD_CPPFLAGS += -DSPEECH_TX_2MIC_NS5 1868KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1869export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1870endif 1871 1872export SPEECH_TX_3MIC_NS ?= 0 1873ifeq ($(SPEECH_TX_3MIC_NS),1) 1874KBUILD_CPPFLAGS += -DSPEECH_TX_3MIC_NS 1875KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1876ifeq ($(BONE_SENSOR_TDM),1) 1877# Get 1 channel from sensor 1878export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1879else 1880export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 3 1881endif 1882endif 1883 1884export SPEECH_TX_3MIC_NS3 ?= 0 1885ifeq ($(SPEECH_TX_3MIC_NS3),1) 1886KBUILD_CPPFLAGS += -DSPEECH_TX_3MIC_NS3 1887KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1888# Get 1 channel from sensor 1889export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 3 1890endif 1891 1892export SPEECH_TX_THIRDPARTY_ALANGO ?= 0 1893ifeq ($(SPEECH_TX_THIRDPARTY_ALANGO),1) 1894export SPEECH_TX_THIRDPARTY := 1 1895core-y += thirdparty/alango_lib/ 1896endif 1897 1898export SPEECH_TX_THIRDPARTY ?= 0 1899ifeq ($(SPEECH_TX_THIRDPARTY),1) 1900KBUILD_CPPFLAGS += -DSPEECH_TX_THIRDPARTY 1901KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1902# Get 1 channel from sensor 1903export SPEECH_CODEC_CAPTURE_CHANNEL_NUM = 2 1904ifeq ($(CHIP_HAS_EC_CODEC_REF),1) 1905export SPEECH_TX_AEC_CODEC_REF := 1 1906endif 1907endif 1908 1909export SPEECH_TX_NOISE_GATE ?= 0 1910ifeq ($(SPEECH_TX_NOISE_GATE),1) 1911KBUILD_CPPFLAGS += -DSPEECH_TX_NOISE_GATE 1912KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1913endif 1914 1915export SPEECH_TX_COMPEXP ?= 0 1916ifeq ($(SPEECH_TX_COMPEXP),1) 1917KBUILD_CPPFLAGS += -DSPEECH_TX_COMPEXP 1918KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1919endif 1920 1921export SPEECH_TX_AGC ?= 0 1922ifeq ($(SPEECH_TX_AGC),1) 1923KBUILD_CPPFLAGS += -DSPEECH_TX_AGC 1924KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1925endif 1926 1927export SPEECH_TX_EQ ?= 0 1928ifeq ($(SPEECH_TX_EQ),1) 1929KBUILD_CPPFLAGS += -DSPEECH_TX_EQ 1930KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1931export DSP_LIB ?= 1 1932endif 1933 1934export SPEECH_TX_POST_GAIN ?= 0 1935ifeq ($(SPEECH_TX_POST_GAIN),1) 1936KBUILD_CPPFLAGS += -DSPEECH_TX_POST_GAIN 1937endif 1938 1939export SPEECH_RX_24BIT ?= 1 1940 1941export SPEECH_RX_NS ?= 0 1942ifeq ($(SPEECH_RX_NS),1) 1943KBUILD_CPPFLAGS += -DSPEECH_RX_NS 1944KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1945endif 1946 1947export SPEECH_RX_NS2 ?= 0 1948ifeq ($(SPEECH_RX_NS2),1) 1949KBUILD_CPPFLAGS += -DSPEECH_RX_NS2 1950KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1951endif 1952 1953export SPEECH_RX_NS2FLOAT ?= 0 1954ifeq ($(SPEECH_RX_NS2FLOAT),1) 1955KBUILD_CPPFLAGS += -DSPEECH_RX_NS2FLOAT 1956KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1957export DSP_LIB ?= 1 1958endif 1959 1960export SPEECH_RX_NS3 ?= 0 1961ifeq ($(SPEECH_RX_NS3),1) 1962KBUILD_CPPFLAGS += -DSPEECH_RX_NS3 1963KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1964endif 1965 1966export SPEECH_RX_AGC ?= 0 1967ifeq ($(SPEECH_RX_AGC),1) 1968KBUILD_CPPFLAGS += -DSPEECH_RX_AGC 1969KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1970endif 1971 1972export SPEECH_RX_EQ ?= 0 1973ifeq ($(SPEECH_RX_EQ),1) 1974KBUILD_CPPFLAGS += -DSPEECH_RX_EQ 1975KBUILD_CPPFLAGS += -DHFP_DISABLE_NREC 1976export DSP_LIB ?= 1 1977endif 1978 1979export SPEECH_RX_POST_GAIN ?= 0 1980ifeq ($(SPEECH_RX_POST_GAIN),1) 1981KBUILD_CPPFLAGS += -DSPEECH_RX_POST_GAIN 1982endif 1983 1984export SPEECH_PROCESS_FRAME_MS ?= 16 1985ifeq ($(SPEECH_CODEC_CAPTURE_CHANNEL_NUM),1) 1986export SPEECH_PROCESS_FRAME_MS = 15 1987endif 1988ifeq ($(SPEECH_TX_2MIC_NS2),1) 1989export SPEECH_PROCESS_FRAME_MS = 15 1990endif 1991ifeq ($(SPEECH_TX_THIRDPARTY),1) 1992export SPEECH_PROCESS_FRAME_MS = 15 1993endif 1994 1995export SPEECH_SCO_FRAME_MS ?= 15 1996 1997export SPEECH_SIDETONE ?= 0 1998ifeq ($(SPEECH_SIDETONE),1) 1999KBUILD_CPPFLAGS += -DSPEECH_SIDETONE 2000ifeq ($(CHIP),best2000) 2001# Disable SCO resample 2002export SW_SCO_RESAMPLE := 0 2003export NO_SCO_RESAMPLE := 1 2004endif 2005endif 2006 2007ifeq ($(THIRDPARTY_LIB),aispeech) 2008export DSP_LIB ?= 1 2009endif 2010 2011ifeq ($(AQE_KWS),1) 2012export AQE_KWS 2013export NN_LIB := 0 2014KBUILD_CPPFLAGS += -DAQE_KWS 2015KBUILD_CPPFLAGS += -DAQE_KWS_$(AQE_KWS_NAME) 2016KBUILD_CPPFLAGS += -DGLOBAL_SRAM_CMSIS_FFT 2017endif 2018 2019# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2020# Features for full application projects 2021# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2022ifeq ($(FULL_APP_PROJECT),1) 2023 2024export BESLIB_INFO := $(GIT_REVISION) 2025 2026export SPEECH_LIB ?= 1 2027 2028export FLASH_PROTECTION ?= 1 2029 2030export APP_TEST_AUDIO ?= 0 2031 2032export APP_TEST_MODE ?= 0 2033ifeq ($(APP_TEST_MODE),1) 2034KBUILD_CPPFLAGS += -DAPP_TEST_MODE 2035endif 2036 2037export VOICE_PROMPT ?= 1 2038 2039export AUDIO_QUEUE_SUPPORT ?= 1 2040 2041export VOICE_RECOGNITION ?= 0 2042 2043export ENGINEER_MODE ?= 1 2044ifeq ($(ENGINEER_MODE),1) 2045FACTORY_MODE := 1 2046endif 2047ifeq ($(FACTORY_MODE),1) 2048KBUILD_CPPFLAGS += -D__FACTORY_MODE_SUPPORT__ 2049endif 2050 2051export NEW_NV_RECORD_ENALBED ?= 1 2052ifeq ($(NEW_NV_RECORD_ENALBED),1) 2053export NV_EXTENSION_MIRROR_RAM_SIZE ?= 0x500 2054KBUILD_CPPFLAGS += -DNEW_NV_RECORD_ENALBED 2055KBUILD_CPPFLAGS += -DNV_EXTENSION_MIRROR_RAM_SIZE=$(NV_EXTENSION_MIRROR_RAM_SIZE) 2056KBUILD_CPPFLAGS += -Iservices/nv_section/userdata_section 2057ifeq ($(BES_BLE_MESH_ENABLE),1) 2058KBUILD_CPPFLAGS += -DTGENIE_MESH_DATA_SECTION 2059endif 2060endif 2061 2062ifeq ($(HEAR_THRU_PEAK_DET),1) 2063KBUILD_CPPFLAGS += -D__HEAR_THRU_PEAK_DET__ 2064endif 2065 2066KBUILD_CPPFLAGS += -DSPEECH_PROCESS_FRAME_MS=$(SPEECH_PROCESS_FRAME_MS) 2067KBUILD_CPPFLAGS += -DSPEECH_SCO_FRAME_MS=$(SPEECH_SCO_FRAME_MS) 2068 2069KBUILD_CPPFLAGS += -DMULTIPOINT_DUAL_SLAVE 2070 2071endif # FULL_APP_PROJECT 2072 2073ifeq ($(SPEECH_LIB),1) 2074 2075export DSP_LIB ?= 1 2076 2077ifeq ($(USB_AUDIO_APP),1) 2078ifneq ($(USB_AUDIO_SEND_CHAN),$(SPEECH_CODEC_CAPTURE_CHANNEL_NUM)) 2079$(info ) 2080$(info CAUTION: Change USB_AUDIO_SEND_CHAN($(USB_AUDIO_SEND_CHAN)) to SPEECH_CODEC_CAPTURE_CHANNEL_NUM($(SPEECH_CODEC_CAPTURE_CHANNEL_NUM))) 2081$(info ) 2082export USB_AUDIO_SEND_CHAN := $(SPEECH_CODEC_CAPTURE_CHANNEL_NUM) 2083ifneq ($(USB_AUDIO_SEND_CHAN),$(SPEECH_CODEC_CAPTURE_CHANNEL_NUM)) 2084$(error ERROR: Failed to change USB_AUDIO_SEND_CHAN($(USB_AUDIO_SEND_CHAN))) 2085endif 2086endif 2087endif 2088 2089KBUILD_CPPFLAGS += -DSPEECH_CODEC_CAPTURE_CHANNEL_NUM=$(SPEECH_CODEC_CAPTURE_CHANNEL_NUM) 2090KBUILD_CPPFLAGS += -DSPEECH_ASR_CAPTURE_CHANNEL_NUM=$(SPEECH_ASR_CAPTURE_CHANNEL_NUM) 2091endif # SPEECH_LIB 2092 2093export USB_AUDIO_SPEECH ?= 0 2094ifeq ($(USB_AUDIO_SPEECH),1) 2095export USB_AUDIO_DYN_CFG := 0 2096export KEEP_SAME_LATENCY := 1 2097endif 2098 2099# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2100# BISTO feature 2101# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2102ifeq ($(BISTO_ENABLE),1) 2103 2104KBUILD_CFLAGS += -DBISTO_ENABLED 2105 2106KBUILD_CPPFLAGS += -DCFG_SW_KEY_LPRESS_THRESH_MS=1000 2107 2108KBUILD_CPPFLAGS += -DDEBUG_BLE_DATAPATH=0 2109 2110KBUILD_CPPFLAGS += -DGSOUND_OTA_ENABLED 2111 2112KBUILD_CFLAGS += -DCRC32_OF_IMAGE 2113 2114#export OPUS_CODEC ?= 1 2115#ENCODING_ALGORITHM_OPUS 2 2116#ENCODING_ALGORITHM_SBC 3 2117#KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=3 2118 2119# As MIX_MIC_DURING_MUSIC uses the isolated audio stream, if define MIX_MIC_DURING_MUSIC, 2120# the isolated audio stream must be enabled 2121KBUILD_CPPFLAGS += -DISOLATED_AUDIO_STREAM_ENABLED=1 2122 2123ASSERT_SHOW_FILE_FUNC ?= 1 2124 2125#KBUILD_CPPFLAGS += -DSAVING_AUDIO_DATA_TO_SD_ENABLED=1 2126 2127KBUILD_CPPFLAGS += -DIS_GSOUND_BUTTION_HANDLER_WORKAROUND_ENABLED 2128 2129ifeq ($(GSOUND_HOTWORD_ENABLE), 1) 2130KBUILD_CFLAGS += -DGSOUND_HOTWORD_ENABLED 2131endif 2132 2133endif # BISTO_ENABLE 2134 2135# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2136# GFPS feature 2137# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2138ifeq ($(GFPS_ENABLE),1) 2139 2140KBUILD_CPPFLAGS += -DGFPS_ENABLED 2141export BLE_SECURITY_ENABLED := 1 2142 2143# this macro is used to determain if the resolveable private address is used for BLE 2144KBUILD_CPPFLAGS += -DBLE_USE_RPA 2145 2146endif # GFPS 2147 2148# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2149# AMA feature 2150# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2151ifeq ($(AMA_VOICE),1) 2152 2153KBUILD_CPPFLAGS += -D__AMA_VOICE__ 2154KBUILD_CPPFLAGS += -DBLE_USE_RPA 2155 2156ifeq ($(CHIP),best1400) 2157KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=3 2158export OPUS_CODEC ?= 0 2159else 2160KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=2 2161export OPUS_CODEC := 1 2162endif 2163endif # AMA_VOICE 2164 2165# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2166# DMA feature 2167# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2168ifeq ($(DMA_VOICE),1) 2169KBUILD_CPPFLAGS += -D__DMA_VOICE__ 2170 2171KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=2 2172export OPUS_CODEC := 1 2173export LIBC_ROM := 0 2174ifeq ($(LIBC_ROM),1) 2175$(error LIBC_ROM should be 0 when DMA_VOICE=1) 2176endif 2177endif # DMA_VOICE 2178 2179# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2180# GMA feature 2181# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2182ifeq ($(GMA_VOICE),1) 2183export AI_VOICE ?= 1 2184KBUILD_CPPFLAGS += -D__GMA_VOICE__ 2185 2186#KBUILD_CPPFLAGS += -DKEYWORD_WAKEUP_ENABLED=0 2187#KBUILD_CPPFLAGS += -DPUSH_AND_HOLD_ENABLED=1 2188#KBUILD_CPPFLAGS += -DAI_32KBPS_VOICE=0 2189KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=2 2190export OPUS_CODEC := 1 2191 2192KBUILD_CPPFLAGS += -D__GMA_OTA_TWS__ 2193#KBUILD_CPPFLAGS += -DMCU_HIGH_PERFORMANCE_MODE 2194endif 2195 2196# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2197# SMART_VOICE feature 2198# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2199ifeq ($(SMART_VOICE),1) 2200KBUILD_CPPFLAGS += -D__SMART_VOICE__ 2201KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=2 2202export OPUS_CODEC := 1 2203#SPEECH_CODEC_CAPTURE_CHANNEL_NUM ?= 2 2204#KBUILD_CPPFLAGS += -DMCU_HIGH_PERFORMANCE_MODE 2205#KBUILD_CPPFLAGS += -DSPEECH_CAPTURE_TWO_CHANNEL 2206endif # SMART_VOICE 2207 2208# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2209# TENCENT_VOICE feature 2210# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2211ifeq ($(TENCENT_VOICE),1) 2212KBUILD_CPPFLAGS += -D__TENCENT_VOICE__ 2213KBUILD_CPPFLAGS += -DVOB_ENCODING_ALGORITHM=2 2214export OPUS_CODEC := 1 2215endif # TENCENT_VOICE 2216 2217# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2218# AI_VOICE feature 2219# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2220ifeq ($(AI_VOICE),1) 2221OSC_26M_X4_AUD2BB := 0 2222KBUILD_CPPFLAGS += -D__AI_VOICE__ 2223KBUILD_CPPFLAGS += -DNO_ENCODING=0 2224KBUILD_CPPFLAGS += -DENCODING_ALGORITHM_ADPCM=1 2225KBUILD_CPPFLAGS += -DENCODING_ALGORITHM_OPUS=2 2226KBUILD_CPPFLAGS += -DENCODING_ALGORITHM_SBC=3 2227ifeq ($(OPUS_CODEC),1) 2228KBUILD_CPPFLAGS += -DOPUS_IN_OVERLAY 2229endif 2230 2231ifeq ($(filter -DISOLATED_AUDIO_STREAM_ENABLED=1,$(KBUILD_CPPFLAGS)),) 2232KBUILD_CPPFLAGS += -DISOLATED_AUDIO_STREAM_ENABLED=1 2233endif 2234 2235ifneq ($(filter -DVOB_ENCODING_ALGORITHM=2,$(KBUILD_CPPFLAGS)),) 2236ifneq ($(USE_KNOWLES),1) 2237ifneq ($(ALEXA_WWE),1) 2238export AF_STACK_SIZE ?= 16384 2239endif 2240endif 2241endif 2242endif # AI_VOICE 2243 2244ifeq ($(USE_KNOWLES),1) 2245KBUILD_CPPFLAGS += -D__KNOWLES 2246KBUILD_CPPFLAGS += -DIDLE_ALEXA_KWD 2247export THIRDPARTY_LIB := knowles_uart 2248endif 2249 2250# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2251# MULTI_AI feature 2252# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2253ifeq ($(IS_MULTI_AI_ENABLE),1) 2254KBUILD_CPPFLAGS += -DIS_MULTI_AI_ENABLED 2255endif # MULTI_AI 2256 2257# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2258# VOICE_DATAPATH feature 2259# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2260ifeq ($(VOICE_DATAPATH_ENABLED),1) 2261KBUILD_CPPFLAGS += -DVOICE_DATAPATH 2262endif # VOICE_DATAPATH 2263 2264# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2265# TILE feature 2266# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2267ifeq ($(TILE_DATAPATH_ENABLED),1) 2268KBUILD_CPPFLAGS += -DTILE_DATAPATH 2269endif 2270 2271export CUSTOM_INFORMATION_TILE_ENABLE ?= 0 2272ifeq ($(CUSTOM_INFORMATION_TILE_ENABLE),1) 2273KBUILD_CPPFLAGS += -DCUSTOM_INFORMATION_TILE=1 2274endif # TILE 2275 2276# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2277# OTA feature 2278# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2279ifneq ($(filter 1,$(OTA_BASIC) $(BES_OTA_BASIC)),) 2280KBUILD_CPPFLAGS += -D__APP_IMAGE_FLASH_OFFSET__=$(OTA_CODE_OFFSET) 2281KBUILD_CPPFLAGS += -DNEW_IMAGE_FLASH_OFFSET=0x200000 2282KBUILD_CPPFLAGS += -DFIRMWARE_REV 2283endif # OTA 2284 2285# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2286# MIX_MIC_DURING_MUSIC feature 2287# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2288ifeq ($(MIX_MIC_DURING_MUSIC_ENABLED),1) 2289KBUILD_CPPFLAGS += -DMIX_MIC_DURING_MUSIC 2290endif 2291 2292# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2293# Put customized features above 2294# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2295 2296# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2297# Obsoleted features 2298# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2299OBSOLETED_FEATURE_LIST := EQ_PROCESS RB_CODEC AUDIO_EQ_PROCESS MEDIA_PLAYER_RBCODEC 2300USED_OBSOLETED_FEATURE := $(strip $(foreach f,$(OBSOLETED_FEATURE_LIST),$(if $(filter 1,$($f)),$f))) 2301ifneq ($(USED_OBSOLETED_FEATURE),) 2302$(error Obsoleted features: $(USED_OBSOLETED_FEATURE)) 2303endif 2304 2305# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2306# Flash suspend features 2307# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2308ifeq ($(FLASH_SUSPEND), 1) 2309KBUILD_CPPFLAGS += -DFLASH_SUSPEND 2310endif 2311 2312# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv 2313# BLE only enable features 2314# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2315ifeq ($(BLE_ONLY_ENABLED),1) 2316KBUILD_CPPFLAGS += -DBLE_ONLY_ENABLED 2317KBUILD_CPPFLAGS += -DBLE_POWER_LEVEL_0 2318endif 2319 2320# ------------------------------------------- 2321# General 2322# ------------------------------------------- 2323 2324ifneq ($(NO_CONFIG),1) 2325core-y += config/ 2326endif 2327 2328ifneq ($(NO_BOOT_STRUCT),1) 2329core-y += $(call add_if_exists,utils/boot_struct/) 2330endif 2331 2332export DEFAULT_CFG_SRC ?= _default_cfg_src_ 2333 2334ifneq ($(wildcard $(srctree)/config/$(T)/tgt_hardware.h $(srctree)/config/$(T)/res/),) 2335KBUILD_CPPFLAGS += -Iconfig/$(T) 2336endif 2337KBUILD_CPPFLAGS += -Iconfig/$(DEFAULT_CFG_SRC) 2338 2339CPU_CFLAGS ?= -mthumb 2340ifeq ($(CPU),a7) 2341CPU_CFLAGS := -marm 2342CPU_CFLAGS += -march=armv7-a 2343else ifeq ($(CPU),m33) 2344ifeq ($(CPU_NO_DSP),1) 2345CPU_CFLAGS += -mcpu=cortex-m33+nodsp 2346else 2347CPU_CFLAGS += -mcpu=cortex-m33 2348endif 2349else 2350CPU_CFLAGS += -mcpu=cortex-m4 2351endif 2352 2353export UNALIGNED_ACCESS ?= 1 2354ifeq ($(UNALIGNED_ACCESS),1) 2355KBUILD_CPPFLAGS += -DUNALIGNED_ACCESS 2356else 2357CPU_CFLAGS += -mno-unaligned-access 2358endif 2359 2360ifeq ($(CHIP_HAS_FPU),1) 2361ifeq ($(CPU),a7) 2362#CPU_CFLAGS += -mfpu=vfpv3-d16 2363CPU_CFLAGS += -mfpu=neon-vfpv4 2364else ifeq ($(CPU),m33) 2365CPU_CFLAGS += -mfpu=fpv5-sp-d16 2366else 2367CPU_CFLAGS += -mfpu=fpv4-sp-d16 2368endif 2369ifeq ($(SOFT_FLOAT_ABI),1) 2370CPU_CFLAGS += -mfloat-abi=softfp 2371else 2372CPU_CFLAGS += -mfloat-abi=hard 2373endif 2374else 2375CPU_CFLAGS += -mfloat-abi=soft 2376endif 2377 2378export CONTROLLER_DUMP_ENABLE ?= 0 2379ifeq ($(CONTROLLER_DUMP_ENABLE),1) 2380 KBUILD_CPPFLAGS += -DCONTROLLER_DUMP_ENABLE=1 2381endif 2382 2383export CONTROLLER_MEM_LOG_ENABLE ?= 0 2384ifeq ($(CONTROLLER_MEM_LOG_ENABLE),1) 2385 KBUILD_CPPFLAGS += -DCONTROLLER_MEM_LOG_ENABLE=1 2386endif 2387 2388ifneq ($(ALLOW_WARNING),1) 2389KBUILD_CPPFLAGS += -Werror 2390endif 2391 2392ifeq ($(USE_BT_ADAPTER),1) 2393KBUILD_CFLAGS += -DUSE_BT_ADAPTER 2394KBUILD_CFLAGS += -DBLE_ADAPTER_PROFILES_NUM=2 2395KBUILD_CFLAGS += -DBLE_ADAPTER_ATTB_NUM=8 2396else 2397KBUILD_CFLAGS += -DBLE_ADAPTER_PROFILES_NUM=0 2398KBUILD_CFLAGS += -DBLE_ADAPTER_ATTB_NUM=8 2399endif 2400 2401KBUILD_CPPFLAGS += -Wlogical-op #-Wno-address-of-packed-member 2402 2403ifeq ($(PIE),1) 2404ifneq ($(TOOLCHAIN),armclang) 2405ifneq ($(NOSTD),1) 2406$(error PIE can only work when NOSTD=1) 2407endif 2408KBUILD_CPPFLAGS += -msingle-pic-base 2409endif 2410KBUILD_CPPFLAGS += -fPIE 2411# -pie option will generate .dynamic section 2412#LDFLAGS += -pie 2413#LDFLAGS += -z relro -z now 2414endif 2415 2416KBUILD_CPPFLAGS += $(CPU_CFLAGS) $(SPECS_CFLAGS) 2417LINK_CFLAGS += $(CPU_CFLAGS) $(SPECS_CFLAGS) 2418CFLAGS_IMAGE += $(CPU_CFLAGS) $(SPECS_CFLAGS) 2419 2420# Save 100+ bytes by filling less alignment holes 2421# TODO: Array alignment? 2422#LDFLAGS += --sort-common --sort-section=alignment 2423 2424ifeq ($(CTYPE_PTR_DEF),1) 2425ifeq ($(TOOLCHAIN),armclang) 2426$(error CTYPE_PTR_DEF is not supported in $(TOOLCHAIN)) 2427else 2428LDFLAGS_IMAGE += --defsym __ctype_ptr__=0 2429endif 2430endif 2431 2432ifeq ($(BES_BLE_MESH_ENABLE),1) 2433 2434KBUILD_CPPFLAGS += -DBLE_MESH 2435KBUILD_CPPFLAGS += -DBES_BLE_MESH_ENABLE 2436 2437#provision method, 0-adv;1-gatt 2438MESH_PROV_METHOD ?= 0 2439 2440ifeq ($(MESH_PROV_METHOD), 1) 2441KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PROXY=1 2442KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_GATT_PROXY=1 2443KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PB_GATT=1 2444KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PB_ADV=0 2445else 2446KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PROXY=0 2447KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_GATT_PROXY=0 2448KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PB_GATT=0 2449KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PB_ADV=1 2450endif 2451 2452KBUILD_CPPFLAGS += -DCONFIG_BT_MESH=1 2453KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_FRIEND=0 2454KBUILD_CPPFLAGS += -DCONFIG_BLUETOOTH=1 2455KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_LOW_POWER=0 2456KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_IV_UPDATE_TEST=0 2457KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PROV=1 2458KBUILD_CPPFLAGS += -DCONFIG_ARM=1 2459KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_PROVISIONER=0 2460KBUILD_CPPFLAGS += -DCONFIG_BLUETOOTH_MESH_FRIEND=0 2461KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_LPN_ESTABLISHMENT=0 2462KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_LPN_AUTO=0 2463KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_RELAY=1 2464KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_CFG_CLI=0 2465 2466#KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_GEN_LEVEL_SRV 2467KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_GEN_ONOFF_SRV 2468KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_LIGHTNESS_SRV 2469KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_CTL_SRV 2470KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_CTL_SETUP_SRV 2471KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_VENDOR_SRV 2472KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_TIME_SRV 2473KBUILD_CPPFLAGS += -DCONFIG_MESH_MODEL_SCENE_SRV 2474 2475KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG 2476KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_ADV 2477KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_BEACON 2478KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_PROXY 2479KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_PROV 2480KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_NET 2481KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_CRYPTO 2482KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_TRANS 2483KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_FRIEND 2484KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_LOW_POWER 2485KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_ACCESS 2486KBUILD_CPPFLAGS += -DCONFIG_BT_MESH_DEBUG_MODEL 2487 2488KBUILD_CPPFLAGS += -DCONFIG_TMALL_GATT=0 2489endif 2490 2491export POWERON_SCAN ?= 0 2492ifeq ($(POWERON_SCAN), 1) 2493KBUILD_CPPFLAGS += -D__POWERON_BT_SCAN__ 2494endif 2495 2496ifeq ($(NO_STARTFILES), 1) 2497LIB_LDFLAGS += -nostartfiles 2498endif 2499 2500