diff --git a/zblue/CMakeLists.txt b/zblue/CMakeLists.txt index 5ed5bc2..c49ca26 100644 --- a/zblue/CMakeLists.txt +++ b/zblue/CMakeLists.txt @@ -21,14 +21,15 @@ if(CONFIG_BT) set(ZBLUE_DIR ${CMAKE_CURRENT_LIST_DIR}/zblue/) - set(SUBDIR subsys/bluetooth) - set(ZBLUE_SUBDIR ${ZBLUE_DIR}/${SUBDIR}) + set(BTDIR ${ZBLUE_DIR}/subsys/bluetooth) + set(HOSTDIR ${BTDIR}/host) + set(CLASSICDIR ${HOSTDIR}/classic) - set(ZBLUE_FLAGS) - set(ZBLUE_INCDIR) - set(ZBLUE_CSRCS) + set(CFLAGS) + set(INCDIR) + set(CSRCS) - list(APPEND ZBLUE_FLAGS + list(APPEND CFLAGS -Wno-implicit-function-declaration -Wno-unused-but-set-variable -Wno-unused-function @@ -37,396 +38,876 @@ if(CONFIG_BT) -Wno-shadow -Wno-stringop-overread) - list(APPEND ZBLUE_INCDIR + list(APPEND INCDIR ${ZBLUE_DIR}port/include - # ${ZBLUE_DIR}include + ${ZBLUE_DIR}port/include/zephyr + ${ZBLUE_DIR}port/kernel/include ${ZBLUE_DIR}subsys/bluetooth + ${ZBLUE_DIR}subsys/bluetooth/audio ${ZBLUE_DIR}subsys/bluetooth/host - ${ZBLUE_DIR}subsys/bluetooth/services ${ZBLUE_DIR}subsys/bluetooth/mesh - ${ZBLUE_DIR}subsys/bluetooth/common + ${ZBLUE_DIR}subsys/bluetooth/services ${ZBLUE_DIR}subsys/testsuite/ztest/include ${NUTTX_APPS_DIR}/crypto/tinycrypt/tinycrypt/lib/include) - if(CONFIG_BT_HCI_RAW) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/hci_raw.c) - endif() + set(CSRCS + ${BTDIR}/common/addr.c + ${BTDIR}/common/dummy.c + ${BTDIR}/common/bt_str.c + ) - if(CONFIG_BT_DEBUG_MONITOR) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/monitor.c) + if(CONFIG_BT_RPA) + list(APPEND CSRCS ${BTDIR}/common/rpa.c) endif() - if(CONFIG_BT_TINYCRYPT_ECC) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/hci_ecc.c) + if(CONFIG_BT_EAD) + list(APPEND CSRCS ${BTDIR}/lib/ead.c) endif() - if(CONFIG_BT_A2DP) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/a2dp.c) - endif() + if(CONFIG_BT_HCI) + if(CONFIG_BT_HCI_RAW) + list(APPEND CSRCS ${HOSTDIR}/hci_raw.c ${HOSTDIR}/hci_common.c) + endif() + if(CONFIG_BT_MONITOR) + list(APPEND CSRCS ${HOSTDIR}/monitor.c) + endif() + if(CONFIG_BT_TINYCRYPT_ECC) + list(APPEND CSRCS ${HOSTDIR}/hci_ecc.c) + endif() + if(CONFIG_BT_SETTINGS) + list(APPEND CSRCS ${HOSTDIR}/settings.c) + endif() + if(CONFIG_BT_HOST_CCM) + list(APPEND CSRCS ${HOSTDIR}/aes_ccm.c) + endif() + if(CONFIG_BT_LONG_WQ) + list(APPEND CSRCS ${HOSTDIR}/long_wq.c) + endif() - if(CONFIG_BT_AVDTP) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/avdtp.c) - endif() + if(CONFIG_BT_HCI_HOST) + list(APPEND CSRCS + ${HOSTDIR}/uuid.c ${HOSTDIR}/addr.c + ${HOSTDIR}/buf.c ${HOSTDIR}/data.c + ${HOSTDIR}/hci_core.c ${HOSTDIR}/hci_common.c + ${HOSTDIR}/id.c + ) - if(CONFIG_BT_RFCOMM) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/rfcomm.c) - endif() + if(CONFIG_BT_BROADCASTER) + list(APPEND CSRCS ${HOSTDIR}/adv.c) + endif() + if(CONFIG_BT_OBSERVER) + list(APPEND CSRCS ${HOSTDIR}/scan.c) + endif() - if(CONFIG_BT_TESTING) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/testing.c) - endif() + if(CONFIG_BT_USE_PSA_API) + if(CONFIG_BT_HOST_CRYPTO) + list(APPEND CSRCS ${HOSTDIR}/crypto_psa.c) + endif() + else() + if(CONFIG_BT_HOST_CRYPTO) + list(APPEND CSRCS ${HOSTDIR}/crypto_tc.c) + endif() + endif() - if(CONFIG_BT_SETTINGS) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/settings.c) - endif() + if(CONFIG_BT_ECC) + list(APPEND CSRCS ${HOSTDIR}/ecc.c) + endif() - if(CONFIG_BT_HOST_CCM) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/aes_ccm.c) - endif() + if(CONFIG_BT_CONN) + list(APPEND CSRCS + ${HOSTDIR}/conn.c ${HOSTDIR}/l2cap.c + ${HOSTDIR}/att.c ${HOSTDIR}/gatt.c + ) + + if(CONFIG_BT_SMP) + list(APPEND CSRCS ${HOSTDIR}/smp.c ${HOSTDIR}/keys.c) + else() + list(APPEND CSRCS ${HOSTDIR}/smp_null.c) + endif() + endif() - if(CONFIG_BT_BREDR) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_SUBDIR}/host/keys_br.c - ${ZBLUE_SUBDIR}/host/l2cap_br.c - ${ZBLUE_SUBDIR}/host/sdp.c - ${ZBLUE_SUBDIR}/host/ssp.c) - endif() + if(CONFIG_BT_ISO) + list(APPEND CSRCS ${HOSTDIR}/iso.c ${HOSTDIR}/conn.c) + endif() + if(CONFIG_BT_CHANNEL_SOUNDING) + list(APPEND CSRCS ${HOSTDIR}/cs.c) + endif() + if(CONFIG_BT_DF) + list(APPEND CSRCS ${HOSTDIR}/direction.c) + endif() + endif() # CONFIG_BT_HCI_HOST - if(CONFIG_BT_HFP_HF) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_SUBDIR}/host/hfp_hf.c - ${ZBLUE_SUBDIR}/host/at.c) - endif() + if(CONFIG_BT_CLASSIC) + if(CONFIG_BT_A2DP) + list(APPEND CSRCS ${CLASSICDIR}/a2dp.c ${CLASSICDIR}/a2dp_codec_sbc.c) + endif() + if(CONFIG_BT_AVDTP) + list(APPEND CSRCS ${CLASSICDIR}/avdtp.c) + endif() + if(CONFIG_BT_AVRCP) + list(APPEND CSRCS ${CLASSICDIR}/avrcp.c) + endif() + if(CONFIG_BT_AVCTP) + list(APPEND CSRCS ${CLASSICDIR}/avctp.c) + endif() + if(CONFIG_BT_RFCOMM) + list(APPEND CSRCS ${CLASSICDIR}/rfcomm.c) + endif() - if(CONFIG_BT_AUDIO) - if(CONFIG_BT_ISO) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/audio/iso.c) + list(APPEND CSRCS + ${CLASSICDIR}/br.c + ${CLASSICDIR}/keys_br.c + ${CLASSICDIR}/l2cap_br.c + ${CLASSICDIR}/sdp.c + ${CLASSICDIR}/ssp.c + ${CLASSICDIR}/sco.c + ) + + if(CONFIG_BT_HFP_HF) + list(APPEND CSRCS ${CLASSICDIR}/hfp_hf.c ${CLASSICDIR}/at.c) + endif() + if(CONFIG_BT_HFP_AG) + list(APPEND CSRCS ${CLASSICDIR}/hfp_ag.c) + endif() + + if(CONFIG_BT_SHELL) + list(APPEND CSRCS ${CLASSICDIR}/shell/bredr.c) + + if(CONFIG_BT_RFCOMM) + list(APPEND CSRCS ${CLASSICDIR}/shell/rfcomm.c) + endif() + if(CONFIG_BT_A2DP) + list(APPEND CSRCS ${CLASSICDIR}/shell/a2dp.c) + endif() + if(CONFIG_BT_AVRCP) + list(APPEND CSRCS ${CLASSICDIR}/shell/avrcp.c) + endif() + endif() # CONFIG_BT_SHELL + endif() # CONFIG_BT_CLASSIC + + if(CONFIG_BT_SHELL) + list(APPEND CSRCS ${HOSTDIR}/shell/bt.c) + + if(CONFIG_BT_CONN) + list(APPEND CSRCS ${HOSTDIR}/shell/gatt.c) + endif() + if(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL) + list(APPEND CSRCS ${HOSTDIR}/shell/l2cap.c) + endif() + if(CONFIG_BT_ISO) + list(APPEND CSRCS ${HOSTDIR}/shell/iso.c) + endif() + if(CONFIG_BT_CHANNEL_SOUNDING) + list(APPEND CSRCS ${HOSTDIR}/shell/cs.c) + endif() + endif() # CONFIG_BT_SHELL + endif() # CONFIG_BT_HCI + + set(SVRSDIR ${BTDIR}/services) + + if(CONFIG_BT_CONN) + if(CONFIG_BT_DIS) + list(APPEND CSRCS ${SVRSDIR}/dis.c) + endif() + if(CONFIG_BT_CTS) + list(APPEND CSRCS ${SVRSDIR}/cts.c) + endif() + if(CONFIG_BT_HRS) + list(APPEND CSRCS ${SVRSDIR}/hrs.c) + endif() + if(CONFIG_BT_TPS) + list(APPEND CSRCS ${SVRSDIR}/tps.c) endif() - endif() - if(CONFIG_BT_HCI_HOST) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_SUBDIR}/host/uuid.c - ${ZBLUE_SUBDIR}/host/hci_core.c) + if(CONFIG_BT_BAS) + list(APPEND CSRCS ${SVRSDIR}/bas/bas.c) + if(CONFIG_BT_BAS_BLS) + list(APPEND CSRCS ${SVRSDIR}/bas/bas_bls.c) + endif() + if(CONFIG_BT_BAS_BCS) + list(APPEND CSRCS ${SVRSDIR}/bas/bas_bcs.c) + endif() + endif() - if(CONFIG_BT_HOST_CRYPTO) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/crypto.c) + if(CONFIG_BT_OTS) + list(APPEND CSRCS + ${SVRSDIR}/ots/ots.c + ${SVRSDIR}/ots/ots_l2cap.c + ${SVRSDIR}/ots/ots_obj_manager.c + ${SVRSDIR}/ots/ots_oacp.c + ${SVRSDIR}/ots/ots_olcp.c + ) endif() - if(CONFIG_BT_CONN) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_SUBDIR}/host/conn.c - ${ZBLUE_SUBDIR}/host/l2cap.c - ${ZBLUE_SUBDIR}/host/att.c - ${ZBLUE_SUBDIR}/host/gatt.c) + if(CONFIG_BT_OTS_DIR_LIST_OBJ) + list(APPEND CSRCS ${SVRSDIR}/ots/ots_dir_list.c) + endif() + if(CONFIG_BT_OTS_CLIENT) + list(APPEND CSRCS + ${SVRSDIR}/ots/ots_client.c + ${SVRSDIR}/ots/ots_l2cap.c + ) endif() - if(CONFIG_BT_SMP) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_SUBDIR}/host/smp.c - ${ZBLUE_SUBDIR}/host/keys.c) - else() - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/host/smp_null.c) + if(CONFIG_BT_IAS) + list(APPEND CSRCS ${SVRSDIR}/ias/ias.c) + if(CONFIG_BT_SHELL) + list(APPEND CSRCS ${SVRSDIR}/ias/shell/ias.c) + endif() endif() - endif() - if(CONFIG_BT_DIS) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/services/dis.c) - endif() + if(CONFIG_BT_IAS_CLIENT) + list(APPEND CSRCS ${SVRSDIR}/ias/ias_client.c) + if(CONFIG_BT_SHELL) + list(APPEND CSRCS ${SVRSDIR}/ias/shell/ias_client.c) + endif() + endif() - if(CONFIG_BT_BAS) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/services/bas.c) + if(CONFIG_BT_ZEPHYR_NUS) + list(APPEND CSRCS + ${SVRSDIR}/nus/nus.c + ${SVRSDIR}/nus/nus_inst.c + ) + if(CONFIG_BT_ZEPHYR_NUS_AUTO_START_BLUETOOTH) + list(APPEND CSRCS ${SVRSDIR}/nus/bt_nus_auto_start_bt.c) + endif() + endif() endif() - if(CONFIG_BT_HRS) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/services/hrs.c) - endif() + set(MESHDIR ${BTDIR}/mesh) if(CONFIG_BT_MESH) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_SUBDIR}/mesh/main.c - ${ZBLUE_SUBDIR}/mesh/adv.c - ${ZBLUE_SUBDIR}/mesh/beacon.c - ${ZBLUE_SUBDIR}/mesh/net.c - ${ZBLUE_SUBDIR}/mesh/transport.c - ${ZBLUE_SUBDIR}/mesh/crypto.c - ${ZBLUE_SUBDIR}/mesh/access.c - ${ZBLUE_SUBDIR}/mesh/cfg_srv.c - ${ZBLUE_SUBDIR}/mesh/health_srv.c) + list(APPEND CSRCS + ${MESHDIR}/main.c + ${MESHDIR}/cfg.c + ${MESHDIR}/adv.c + ${MESHDIR}/beacon.c + ${MESHDIR}/net.c + ${MESHDIR}/subnet.c + ${MESHDIR}/app_keys.c + ${MESHDIR}/heartbeat.c + ${MESHDIR}/crypto.c + ${MESHDIR}/access.c + ${MESHDIR}/msg.c + ${MESHDIR}/cfg_srv.c + ${MESHDIR}/health_srv.c + ${MESHDIR}/va.c + ${MESHDIR}/transport.c + ) + + if(CONFIG_BT_MESH_ADV_LEGACY) + list(APPEND CSRCS ${MESHDIR}/adv_legacy.c) + endif() + if(CONFIG_BT_MESH_ADV_EXT) + list(APPEND CSRCS ${MESHDIR}/adv_ext.c) + endif() if(CONFIG_BT_SETTINGS) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/settings.c) + list(APPEND CSRCS ${MESHDIR}/settings.c) + endif() + if(CONFIG_BT_MESH_RPL_STORAGE_MODE_SETTINGS) + list(APPEND CSRCS ${MESHDIR}/rpl.c) + endif() + if(CONFIG_BT_MESH_LOW_POWER) + list(APPEND CSRCS ${MESHDIR}/lpn.c) + endif() + if(CONFIG_BT_MESH_FRIEND) + list(APPEND CSRCS ${MESHDIR}/friend.c) + endif() + if(CONFIG_BT_MESH_PROV) + list(APPEND CSRCS ${MESHDIR}/prov.c) + endif() + if(CONFIG_BT_MESH_PROVISIONEE) + list(APPEND CSRCS ${MESHDIR}/provisionee.c) + endif() + if(CONFIG_BT_MESH_PROVISIONER) + list(APPEND CSRCS ${MESHDIR}/provisioner.c) + endif() + if(CONFIG_BT_MESH_PB_ADV) + list(APPEND CSRCS ${MESHDIR}/pb_adv.c) + endif() + if(CONFIG_BT_MESH_PB_GATT_COMMON) + list(APPEND CSRCS ${MESHDIR}/pb_gatt.c) + endif() + if(CONFIG_BT_MESH_PB_GATT) + list(APPEND CSRCS ${MESHDIR}/pb_gatt_srv.c) + endif() + if(CONFIG_BT_MESH_PB_GATT_CLIENT) + list(APPEND CSRCS ${MESHDIR}/pb_gatt_cli.c) + endif() + if(CONFIG_BT_MESH_GATT_CLIENT) + list(APPEND CSRCS ${MESHDIR}/gatt_cli.c) + endif() + if(CONFIG_BT_MESH_PROXY_CLIENT) + list(APPEND CSRCS ${MESHDIR}/proxy_cli.c) + endif() + if(CONFIG_BT_MESH_GATT_PROXY) + list(APPEND CSRCS ${MESHDIR}/proxy_srv.c) + endif() + if(CONFIG_BT_MESH_GATT) + list(APPEND CSRCS ${MESHDIR}/proxy_msg.c) + endif() + if(CONFIG_BT_MESH_CFG_CLI) + list(APPEND CSRCS ${MESHDIR}/cfg_cli.c) + endif() + if(CONFIG_BT_MESH_HEALTH_CLI) + list(APPEND CSRCS ${MESHDIR}/health_cli.c) + endif() + if(CONFIG_BT_MESH_SAR_CFG_CLI) + list(APPEND CSRCS ${MESHDIR}/sar_cfg_cli.c) + endif() + if(CONFIG_BT_MESH_SAR_CFG_SRV) + list(APPEND CSRCS ${MESHDIR}/sar_cfg_srv.c) + endif() + if(CONFIG_BT_MESH_SAR_CFG) + list(APPEND CSRCS ${MESHDIR}/sar_cfg.c) + endif() + if(CONFIG_BT_MESH_OP_AGG_SRV) + list(APPEND CSRCS ${MESHDIR}/op_agg_srv.c) + endif() + if(CONFIG_BT_MESH_OP_AGG_CLI) + list(APPEND CSRCS ${MESHDIR}/op_agg_cli.c) + endif() + if(CONFIG_BT_MESH_OP_AGG) + list(APPEND CSRCS ${MESHDIR}/op_agg.c) + endif() + if(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV) + list(APPEND CSRCS ${MESHDIR}/large_comp_data_srv.c) + endif() + if(CONFIG_BT_MESH_LARGE_COMP_DATA_CLI) + list(APPEND CSRCS ${MESHDIR}/large_comp_data_cli.c) + endif() + if(CONFIG_BT_MESH_PRIV_BEACON_SRV) + list(APPEND CSRCS ${MESHDIR}/priv_beacon_srv.c) + endif() + if(CONFIG_BT_MESH_PRIV_BEACON_CLI) + list(APPEND CSRCS ${MESHDIR}/priv_beacon_cli.c) + endif() + if(CONFIG_BT_MESH_SELF_TEST) + list(APPEND CSRCS ${MESHDIR}/test.c) + endif() + if(CONFIG_BT_MESH_CDB) + list(APPEND CSRCS ${MESHDIR}/cdb.c) + endif() + if(CONFIG_BT_MESH_BLOB_SRV) + list(APPEND CSRCS ${MESHDIR}/blob_srv.c) + endif() + if(CONFIG_BT_MESH_BLOB_CLI) + list(APPEND CSRCS ${MESHDIR}/blob_cli.c) + endif() + if(CONFIG_BT_MESH_BLOB_IO_FLASH) + list(APPEND CSRCS ${MESHDIR}/blob_io_flash.c) + endif() + if(CONFIG_BT_MESH_DFU_CLI) + list(APPEND CSRCS ${MESHDIR}/dfu_cli.c) + endif() + if(CONFIG_BT_MESH_DFU_SRV) + list(APPEND CSRCS ${MESHDIR}/dfu_srv.c) + endif() + if(CONFIG_BT_MESH_DFD_SRV) + list(APPEND CSRCS ${MESHDIR}/dfd_srv.c) + endif() + if(CONFIG_BT_MESH_DFU_SLOTS) + list(APPEND CSRCS ${MESHDIR}/dfu_slot.c) + endif() + if(CONFIG_BT_MESH_DFU_METADATA) + list(APPEND CSRCS ${MESHDIR}/dfu_metadata.c) + endif() + if(CONFIG_BT_MESH_RPR_CLI) + list(APPEND CSRCS ${MESHDIR}/rpr_cli.c) + endif() + if(CONFIG_BT_MESH_RPR_SRV) + list(APPEND CSRCS ${MESHDIR}/rpr_srv.c) + endif() + if(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI) + list(APPEND CSRCS ${MESHDIR}/od_priv_proxy_cli.c) + endif() + if(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) + list(APPEND CSRCS ${MESHDIR}/od_priv_proxy_srv.c) + endif() + if(CONFIG_BT_MESH_SOL_PDU_RPL_CLI) + list(APPEND CSRCS ${MESHDIR}/sol_pdu_rpl_cli.c) + endif() + if(CONFIG_BT_MESH_SOL_PDU_RPL_SRV) + list(APPEND CSRCS ${MESHDIR}/sol_pdu_rpl_srv.c) + endif() + if(CONFIG_BT_MESH_BRG_CFG_CLI) + list(APPEND CSRCS ${MESHDIR}/brg_cfg_cli.c) + endif() + if(CONFIG_BT_MESH_BRG_CFG_SRV) + list(APPEND CSRCS ${MESHDIR}/brg_cfg_srv.c ${MESHDIR}/brg_cfg.c) + endif() + if(CONFIG_BT_MESH_SOLICITATION) + list(APPEND CSRCS ${MESHDIR}/solicitation.c) + endif() + if(CONFIG_BT_MESH_STATISTIC) + list(APPEND CSRCS ${MESHDIR}/statistic.c) + endif() + if(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG) + list(APPEND CSRCS ${MESHDIR}/delayable_msg.c) + endif() + if(CONFIG_BT_MESH_USES_TINYCRYPT) + list(APPEND CSRCS ${MESHDIR}/crypto_tc.c) + else() + list(APPEND CSRCS ${MESHDIR}/crypto_psa.c) + endif() + if(CONFIG_BT_TESTING) + list(APPEND CSRCS ${MESHDIR}/testing.c) endif() - endif() - - if(CONFIG_BT_MESH_LOW_POWER) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/lpn.c) - endif() - - if(CONFIG_BT_MESH_FRIEND) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/friend.c) - endif() - - if(CONFIG_BT_MESH_PROV) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/prov.c) - endif() - - if(CONFIG_BT_MESH_PB_ADV) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/pb_adv.c) - endif() - - if(CONFIG_BT_MESH_PB_GATT) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/pb_gatt.c) - endif() - - if(CONFIG_BT_MESH_PROXY) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/proxy.c) - endif() - - if(CONFIG_BT_MESH_CFG_CLI) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/cfg_cli.c) - endif() - - if(CONFIG_BT_MESH_HEALTH_CLI) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/health_cli.c) - endif() - - if(CONFIG_BT_MESH_SELF_TEST) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/test.c) - endif() - - if(CONFIG_BT_MESH_CDB) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/mesh/cdb.c) - endif() - - aux_source_directory(${ZBLUE_SUBDIR}/common ZBLUE_CSRCS) - if(CONFIG_SETTINGS) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_DIR}subsys/settings/src/settings.c - ${ZBLUE_DIR}subsys/settings/src/settings_store.c - ${ZBLUE_DIR}subsys/settings/src/settings_init.c - ${ZBLUE_DIR}subsys/settings/src/settings_line.c) - if(CONFIG_SETTINGS_FS) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}subsys/settings/src/settings_file.c) - endif() - list(APPEND ZBLUE_INCDIR ${ZBLUE_DIR}subsys/settings/include) - endif() + if(CONFIG_BT_MESH_SHELL) + list(APPEND CSRCS + ${MESHDIR}/shell/shell.c + ${MESHDIR}/shell/utils.c + ) - if(CONFIG_FILE_SYSTEM) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}port/subsys/fs/fs.c) - endif() + if(CONFIG_BT_MESH_SHELL_HEALTH_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/health.c) + endif() + if(CONFIG_BT_MESH_SHELL_CFG_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/cfg.c) + endif() + if(CONFIG_BT_MESH_SHELL_LARGE_COMP_DATA_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/large_comp_data.c) + endif() + if(CONFIG_BT_MESH_SHELL_OP_AGG_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/op_agg.c) + endif() + if(CONFIG_BT_MESH_SHELL_PRIV_BEACON_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/priv_beacon.c) + endif() + if(CONFIG_BT_MESH_SHELL_RPR_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/rpr.c) + endif() + if(CONFIG_BT_MESH_SHELL_SAR_CFG_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/sar.c) + endif() + if(CONFIG_BT_MESH_SHELL_BLOB_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/blob.c) + endif() + if(CONFIG_BT_MESH_SHELL_BLOB_SRV) + list(APPEND CSRCS ${MESHDIR}/shell/blob.c) + endif() + if(CONFIG_BT_MESH_SHELL_BLOB_IO_FLASH) + list(APPEND CSRCS ${MESHDIR}/shell/blob.c) + endif() + if(CONFIG_BT_MESH_SHELL_DFU_SLOT) + list(APPEND CSRCS ${MESHDIR}/shell/dfu.c) + endif() + if(CONFIG_BT_MESH_SHELL_DFU_METADATA) + list(APPEND CSRCS ${MESHDIR}/shell/dfu.c) + endif() + if(CONFIG_BT_MESH_SHELL_DFU_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/dfu.c) + endif() + if(CONFIG_BT_MESH_SHELL_DFU_SRV) + list(APPEND CSRCS ${MESHDIR}/shell/dfu.c) + endif() + if(CONFIG_BT_MESH_SHELL_DFD_SRV) + list(APPEND CSRCS ${MESHDIR}/shell/dfd.c) + endif() + if(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/od_priv_proxy.c) + endif() + if(CONFIG_BT_MESH_SOL_PDU_RPL_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/sol_pdu_rpl.c) + endif() + if(CONFIG_BT_MESH_SHELL_BRG_CFG_CLI) + list(APPEND CSRCS ${MESHDIR}/shell/brg_cfg.c) + endif() + if(CONFIG_BT_HCI_MESH_EXT) + list(APPEND CSRCS ${MESHDIR}/shell/hci.c) + endif() + endif() # CONFIG_BT_MESH_SHELL + endif() # CONFIG_BT_MESH - if(CONFIG_BT_SHELL) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_DIR}port/subsys/shell/shell.c - ${ZBLUE_SUBDIR}/shell/bt.c - ${ZBLUE_SUBDIR}/shell/hci.c) + set(AUDIODIR ${BTDIR}/audio) - nuttx_add_application( - NAME bt - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/bt.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS} -DCONFIG_BT_BT_SHELL) + if(CONFIG_BT_AUDIO) + list(APPEND CSRCS ${AUDIODIR}/audio.c) + if(CONFIG_BT_VOCS) + list(APPEND CSRCS ${AUDIODIR}/vocs.c) + endif() + if(CONFIG_BT_VOCS_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/vocs_client.c) + endif() + if(CONFIG_BT_AICS) + list(APPEND CSRCS ${AUDIODIR}/aics.c) + endif() + if(CONFIG_BT_AICS_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/aics_client.c) + endif() + if(CONFIG_BT_VCP_VOL_REND) + list(APPEND CSRCS ${AUDIODIR}/vcp_vol_rend.c) + endif() + if(CONFIG_BT_VCP_VOL_CTLR) + list(APPEND CSRCS ${AUDIODIR}/vcp_vol_ctlr.c) + endif() + if(CONFIG_BT_MICP_MIC_DEV) + list(APPEND CSRCS ${AUDIODIR}/micp_mic_dev.c) + endif() + if(CONFIG_BT_MICP_MIC_CTLR) + list(APPEND CSRCS ${AUDIODIR}/micp_mic_ctlr.c) + endif() if(CONFIG_BT_CONN) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/shell/gatt.c) - nuttx_add_application( - NAME gatt - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/gatt.c - INCLUDE_DIRECTORIES {ZBLUE_INCDIR} - COMPILE_FLAGS {ZBLUE_FLAGS} -DCONFIG_BT_GATT_SHELL) + list(APPEND CSRCS ${AUDIODIR}/ccid.c) endif() - - if(CONFIG_BT_BREDR) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/shell/bredr.c) - nuttx_add_application( - NAME bredr - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/bredr.c - INCLUDE_DIRECTORIES {ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS} -DCONFIG_BT_BREDR_SHELL) + if(CONFIG_BT_CSIP_SET_MEMBER) + list(APPEND CSRCS ${AUDIODIR}/csip_set_member.c) endif() - - if(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/shell/l2cap.c) - nuttx_add_application( - NAME l2cap - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/l2cap.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS} -DCONFIG_BT_L2CAP_SHELL) + if(CONFIG_BT_CSIP_SET_COORDINATOR) + list(APPEND CSRCS ${AUDIODIR}/csip_set_coordinator.c) endif() - - if(CONFIG_BT_RFCOMM) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/shell/rfcomm.c) - nuttx_add_application( - NAME rfcomm - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/rfcomm.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS} -DCONFIG_BT_RFCOMM_SHELL) + if(CONFIG_BT_CSIP_SET_MEMBER AND CONFIG_BT_CSIP_SET_COORDINATOR) + list(APPEND CSRCS ${AUDIODIR}/csip_crypto.c) endif() - - if(CONFIG_BT_AUDIO) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/shell/iso.c) - nuttx_add_application( - NAME iso - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/iso.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS} -DCONFIG_BT_ISO_SHELL) + if(CONFIG_BT_TBS) + list(APPEND CSRCS ${AUDIODIR}/tbs.c) + endif() + if(CONFIG_BT_TBS_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/tbs_client.c) + endif() + if(CONFIG_BT_MCC) + list(APPEND CSRCS ${AUDIODIR}/mcc.c) + endif() + if(CONFIG_BT_MCS) + list(APPEND CSRCS ${AUDIODIR}/mcs.c) + endif() + if(CONFIG_BT_MPL) + list(APPEND CSRCS ${AUDIODIR}/mpl.c) + endif() + if(CONFIG_MCTL) + list(APPEND CSRCS ${AUDIODIR}/media_proxy.c) + endif() + if(CONFIG_BT_ASCS) + list(APPEND CSRCS ${AUDIODIR}/ascs.c) + endif() + if(CONFIG_BT_PACS) + list(APPEND CSRCS ${AUDIODIR}/pacs.c) + endif() + if(CONFIG_BT_BAP_STREAM) + list(APPEND CSRCS ${AUDIODIR}/bap_stream.c ${AUDIODIR}/codec.c ${AUDIODIR}/bap_iso.c) + endif() + if(CONFIG_BT_BAP_BASE) + list(APPEND CSRCS ${AUDIODIR}/bap_base.c) + endif() + if(CONFIG_BT_BAP_UNICAST_SERVER) + list(APPEND CSRCS ${AUDIODIR}/bap_unicast_server.c) + endif() + if(CONFIG_BT_BAP_UNICAST_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/bap_unicast_client.c) + endif() + if(CONFIG_BT_BAP_BROADCAST_SOURCE) + list(APPEND CSRCS ${AUDIODIR}/bap_broadcast_source.c) + endif() + if(CONFIG_BT_BAP_BROADCAST_SINK) + list(APPEND CSRCS ${AUDIODIR}/bap_broadcast_sink.c) + endif() + if(CONFIG_BT_BAP_SCAN_DELEGATOR) + list(APPEND CSRCS ${AUDIODIR}/bap_scan_delegator.c) + endif() + if(CONFIG_BT_BAP_BROADCAST_ASSISTANT) + list(APPEND CSRCS ${AUDIODIR}/bap_broadcast_assistant.c) + endif() + if(CONFIG_BT_HAS) + list(APPEND CSRCS ${AUDIODIR}/has.c) + endif() + if(CONFIG_BT_HAS_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/has_client.c) + endif() + if(CONFIG_BT_CAP) + list(APPEND CSRCS ${AUDIODIR}/cap_stream.c) + endif() + if(CONFIG_BT_CAP_ACCEPTOR) + list(APPEND CSRCS ${AUDIODIR}/cap_acceptor.c) + endif() + if(CONFIG_BT_CAP_INITIATOR) + list(APPEND CSRCS ${AUDIODIR}/cap_initiator.c) + endif() + if(CONFIG_BT_CAP_COMMANDER) + list(APPEND CSRCS ${AUDIODIR}/cap_commander.c) + endif() + if(CONFIG_BT_CAP_INITIATOR_UNICAST AND CONFIG_BT_CAP_COMMANDER) + list(APPEND CSRCS ${AUDIODIR}/cap_common.c) + endif() + if(CONFIG_BT_TMAP) + list(APPEND CSRCS ${AUDIODIR}/tmap.c) + endif() + if(CONFIG_BT_GMAP) + list(APPEND CSRCS ${AUDIODIR}/gmap_client.c ${AUDIODIR}/gmap_server.c) + endif() + if(CONFIG_BT_PBP) + list(APPEND CSRCS ${AUDIODIR}/pbp.c) endif() - if(CONFIG_BT_MESH) - list(APPEND ZBLUE_CSRCS ${ZBLUE_SUBDIR}/shell/mesh.c) - nuttx_add_application( - NAME mesh - SRCS ${ZBLUE_DIR}port/${SUBDIR}/shell/mesh.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS}) + if(CONFIG_BT_SHELL) + if(CONFIG_BT_VCP_VOL_REND) + list(APPEND CSRCS ${AUDIODIR}/shell/vcp_vol_rend.c) + endif() + if(CONFIG_BT_VCP_VOL_CTLR) + list(APPEND CSRCS ${AUDIODIR}/shell/vcp_vol_ctlr.c) + endif() + if(CONFIG_BT_MICP_MIC_DEV) + list(APPEND CSRCS ${AUDIODIR}/shell/micp_mic_dev.c) + endif() + if(CONFIG_BT_MICP_MIC_CTLR) + list(APPEND CSRCS ${AUDIODIR}/shell/micp_mic_ctlr.c) + endif() + if(CONFIG_BT_CSIP_SET_MEMBER) + list(APPEND CSRCS ${AUDIODIR}/shell/csip_set_member.c) + endif() + if(CONFIG_BT_CSIP_SET_COORDINATOR) + list(APPEND CSRCS ${AUDIODIR}/shell/csip_set_coordinator.c) + endif() + if(CONFIG_BT_TBS) + list(APPEND CSRCS ${AUDIODIR}/shell/tbs.c) + endif() + if(CONFIG_BT_TBS_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/shell/tbs_client.c) + endif() + if(CONFIG_BT_MPL) + list(APPEND CSRCS ${AUDIODIR}/shell/mpl.c) + endif() + if(CONFIG_BT_MCC) + list(APPEND CSRCS ${AUDIODIR}/shell/mcc.c) + endif() + if(CONFIG_BT_MCS) + list(APPEND CSRCS ${AUDIODIR}/shell/media_controller.c) + endif() + if(CONFIG_BT_HAS_PRESET_SUPPORT) + list(APPEND CSRCS ${AUDIODIR}/shell/has.c) + endif() + if(CONFIG_BT_CAP_ACCEPTOR) + list(APPEND CSRCS ${AUDIODIR}/shell/cap_acceptor.c) + endif() + if(CONFIG_BT_CAP_INITIATOR) + list(APPEND CSRCS ${AUDIODIR}/shell/cap_initiator.c) + endif() + if(CONFIG_BT_CAP_COMMANDER) + list(APPEND CSRCS ${AUDIODIR}/shell/cap_commander.c) + endif() + if(CONFIG_BT_HAS_CLIENT) + list(APPEND CSRCS ${AUDIODIR}/shell/has_client.c) + endif() + if(CONFIG_BT_TMAP) + list(APPEND CSRCS ${AUDIODIR}/shell/tmap.c) + endif() + if(CONFIG_BT_GMAP) + list(APPEND CSRCS ${AUDIODIR}/shell/gmap.c) + endif() + if(CONFIG_BT_BAP_STREAM) + list(APPEND CSRCS ${AUDIODIR}/shell/bap.c) + endif() + if(CONFIG_LIBLC3 AND CONFIG_USB_DEVICE_AUDIO) + list(APPEND CSRCS ${AUDIODIR}/shell/bap_usb.c) + endif() + if(CONFIG_BT_BAP_SCAN_DELEGATOR) + list(APPEND CSRCS ${AUDIODIR}/shell/bap_scan_delegator.c) + endif() + if(CONFIG_BT_BAP_BROADCAST_ASSISTANT) + list(APPEND CSRCS ${AUDIODIR}/shell/bap_broadcast_assistant.c) + endif() + if(CONFIG_BT_PBP) + list(APPEND CSRCS ${AUDIODIR}/shell/pbp.c) + endif() + endif() # CONFIG_BT_SHELL + endif() # CONFIG_BT_AUDIO + + if(CONFIG_BT_CRYPTO) + list(APPEND CSRCS ${BTDIR}/crypto/bt_crypto.c) + + if(CONFIG_BT_USE_PSA_API) + list(APPEND CSRCS ${BTDIR}/crypto/bt_crypto_psa.c) + else() + list(APPEND CSRCS ${BTDIR}/crypto/bt_crypto_tc.c) endif() endif() - if(CONFIG_BT_TESTER) - list(APPEND ZBLUE_CSRCS - ${ZBLUE_DIR}tests/bluetooth/tester/src/bttester.c - ${ZBLUE_DIR}tests/bluetooth/tester/src/gap.c - ${ZBLUE_DIR}tests/bluetooth/tester/src/gatt.c) + if(CONFIG_SETTINGS) + set(SETTINGS_DIR zblue/subsys/settings/src) - if(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}tests/bluetooth/tester/src/l2cap.c) - endif() + list(APPEND CSRCS + ${SETTINGS_DIR}/settings_store.c + ${SETTINGS_DIR}/settings.c + ${SETTINGS_DIR}/settings_init.c + ${SETTINGS_DIR}/settings_line.c + ) - if(CONFIG_BT_MESH) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}tests/bluetooth/tester/src/mesh.c) + if(CONFIG_SETTINGS_FILE) + list(APPEND CSRCS ${SETTINGS_DIR}/settings_file.c) + endif() + if(CONFIG_SETTINGS_NVS) + list(APPEND CSRCS ${SETTINGS_DIR}/settings_nvs.c) + endif() + if(CONFIG_SETTINGS_NONE) + list(APPEND CSRCS ${SETTINGS_DIR}/settings_none.c) + endif() + if(CONFIG_SETTINGS_SHELL) + list(APPEND CSRCS ${SETTINGS_DIR}/settings_shell.c) endif() - - list(APPEND ZBLUE_CSRCS - ${ZBLUE_DIR}port/drivers/console/uart_pipe.c - ${ZBLUE_DIR}port/tests/bluetooth/tester/src/system.c - ${ZBLUE_DIR}port/subsys/power/reboot.c) - nuttx_add_application( - NAME bttester - SRCS ${ZBLUE_DIR}tests/bluetooth/tester/src/main.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} ${ZBLUE_DIR}tests/bluetooth/tester/src - COMPILE_FLAGS ${ZBLUE_FLAGS}) endif() - list(APPEND ZBLUE_CSRCS - ${ZBLUE_DIR}port/kernel/sched.c - ${ZBLUE_DIR}port/kernel/timeout.c - ${ZBLUE_DIR}port/kernel/work_q.c - ${ZBLUE_DIR}port/kernel/poll.c - ${ZBLUE_DIR}port/kernel/mem_slab.c - ${ZBLUE_DIR}port/kernel/atomic_c.c - ${ZBLUE_DIR}port/kernel/sem.c - ${ZBLUE_DIR}port/kernel/mutex.c - ${ZBLUE_DIR}port/kernel/queue.c - ${ZBLUE_DIR}port/kernel/thread.c - ${ZBLUE_DIR}port/kernel/rand32.c - ${ZBLUE_DIR}port/subsys/net/buf.c - ${ZBLUE_DIR}port/common/defines.c) - - list(APPEND ZBLUE_CSRCS - ${ZBLUE_DIR}lib/os/dec.c - ${ZBLUE_DIR}lib/os/hex.c) - - if(CONFIG_ARCH_CHIP_R328) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}port/chip/xr829/xr829.c) - list(APPEND ZBLUE_INCDIR - ${NUTTX_DIR}/arch/arm/src/r328/include/drivers - ${NUTTX_DIR}/arch/arm/src/r328/include) - endif() + list(APPEND CSRCS + zblue/kernel/system_work_q.c + zblue/kernel/work.c + zblue/lib/net_buf/buf_simple.c + zblue/lib/utils/dec.c + zblue/lib/utils/hex.c + zblue/port/kernel/atomic_c.c + zblue/port/kernel/device.c + zblue/port/kernel/fatal.c + zblue/port/kernel/init.c + zblue/port/kernel/mem_slab.c + zblue/port/kernel/mutex.c + zblue/port/kernel/poll.c + zblue/port/kernel/queue.c + zblue/port/kernel/sched.c + zblue/port/kernel/sem.c + zblue/port/kernel/thread.c + zblue/port/kernel/timeout.c + zblue/port/lib/net_buf/buf.c + zblue/port/lib/os/assert.c + zblue/port/sections/defines.c + zblue/port/subsys/fs/fs.c + ) - if(CONFIG_BT_LIBUSB) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}port/drivers/bluetooth/hci/libusb.c) + if(CONFIG_BT_H4) + list(APPEND CSRCS zblue/port/drivers/bluetooth/hci/h4.c) endif() - if(CONFIG_BT_H4) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}port/drivers/bluetooth/hci/h4.c) + if(CONFIG_BT_SAMPLE) + set(ZBLUE_STACKSIZE ${CONFIG_BT_SAMPLE_STACKSIZE}) + else() + set(ZBLUE_STACKSIZE ${CONFIG_DEFAULT_TASK_STACKSIZE}) endif() - if(CONFIG_ARCH_SIM) - list(APPEND ZBLUE_FLAGS -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections) + if(CONFIG_BT_SHELL) + nuttx_add_application( + NAME zblue + STACKSIZE ${ZBLUE_STACKSIZE} + SRCS ${ZBLUE_DIR}port/subsys/shell/shell.c + INCLUDE_DIRECTORIES ${INCDIR} + COMPILE_FLAGS ${CFLAGS}) endif() if(CONFIG_BT_SAMPLE) if(CONFIG_BT_SAMPLE_PERIPHERAL) - list(APPEND ZBLUE_CSRCS ${ZBLUE_DIR}samples/bluetooth/peripheral/src/cts.c) nuttx_add_application( NAME peripheral + STACKSIZE ${ZBLUE_STACKSIZE} SRCS ${ZBLUE_DIR}samples/bluetooth/peripheral/src/main.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} ${ZBLUE_DIR}samples/bluetooth/peripheral/src - COMPILE_FLAGS ${ZBLUE_FLAGS}) + INCLUDE_DIRECTORIES ${INCDIR} + COMPILE_FLAGS ${CFLAGS}) endif() if(CONFIG_BT_SAMPLE_CENTRAL) nuttx_add_application( NAME central + STACKSIZE ${ZBLUE_STACKSIZE} SRCS ${ZBLUE_DIR}samples/bluetooth/central/src/main.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS}) + INCLUDE_DIRECTORIES ${INCDIR} + COMPILE_FLAGS ${CFLAGS}) endif() - if(CONFIG_BT_SAMPLE_MESH) - nuttx_add_application( - NAME btmesh - SRCS ${ZBLUE_DIR}samples/bluetooth/mesh/src/main.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS}) - + if(CONFIG_BT_SAMPLE_HFP_HF) nuttx_add_application( - NAME mesh_demo - SRCS ${ZBLUE_DIR}samples/bluetooth/mesh_demo/src/main.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS}) - - if(CONFIG_BT_MESH_PROVISIONER) - nuttx_add_application( - NAME mesh_provisioner - SRCS ${ZBLUE_DIR}samples/bluetooth/mesh_provisioner/src/main.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS}) - endif() + NAME hfp_hf + STACKSIZE ${ZBLUE_STACKSIZE} + SRCS ${ZBLUE_DIR}samples/bluetooth/handsfree/src/main.c + INCLUDE_DIRECTORIES ${INCDIR} + COMPILE_FLAGS ${CFLAGS}) endif() endif() - if(SCHED_PRIORITY_DEFAULT) - set(ZBLUE_STACKSIZE ${CONFIG_BT_SAMPLE_STACKSIZE}) - else() - set(ZBLUE_STACKSIZE ${CONFIG_DEFAULT_TASK_STACKSIZE}) - endif() - - nuttx_add_application( - NAME zblue - STACKSIZE ${ZBLUE_STACKSIZE} - SRCS ${ZBLUE_DIR}port/drivers/bluetooth/hci/hci.c - INCLUDE_DIRECTORIES ${ZBLUE_INCDIR} - COMPILE_FLAGS ${ZBLUE_FLAGS}) - nuttx_add_library(zblue) - target_sources(zblue PRIVATE ${ZBLUE_CSRCS}) - target_include_directories(zblue PRIVATE ${ZBLUE_INCDIR}) - target_compile_options(zblue PRIVATE ${ZBLUE_FLAGS}) - - add_custom_target(zblue_prebuild) - add_custom_command( - TARGET zblue_prebuild - PRE_BUILD - COMMAND ln -sf ../../include/bluetooth ${ZBLUE_DIR}port/include/bluetooth - COMMAND ln -sf ../../include/drivers ${ZBLUE_DIR}port/include/drivers - COMMAND ln -sf ../../include/fs ${ZBLUE_DIR}port/include/fs - COMMAND ln -sf ../../include/settings ${ZBLUE_DIR}port/include/settings - COMMAND ln -sf ../../include/power ${ZBLUE_DIR}port/include/power - COMMAND ln -sf ../../include/random ${ZBLUE_DIR}port/include/random - COMMAND ln -sf ${ZBLUE_DIR}port/include/bluetooth ${ZBLUE_DIR}port/include/zephyr/bluetooth - COMMAND ln -sf ${ZBLUE_DIR}port/include/random ${ZBLUE_DIR}port/include/zephyr/random - COMMAND ln -sf ${ZBLUE_DIR}port/include/sys ${ZBLUE_DIR}port/include/zephyr/sys - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/bredr.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/bt.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/gatt.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/l2cap.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/mesh.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/rfcomm.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/ticker.c - COMMAND ln -sf shell.c ${ZBLUE_DIR}port/subsys/bluetooth/shell/iso.c) - add_dependencies(zblue zblue_prebuild) + target_sources(zblue PRIVATE ${CSRCS}) + target_include_directories(zblue PRIVATE ${INCDIR}) + target_compile_options(zblue PRIVATE ${CFLAGS}) + + set(ZINC ${APPDIR}/external/zblue/zblue/include/zephyr) + set(PORTINC ${ZBLUE_DIR}port/include/zephyr) + + set(SYMLINK_FILES + app_memory/mem_domain.h + arch/arch_interface.h + arch/common/ffs.h + debug/stack.h + devicetree/ordinals.h + fatal.h + fatal_types.h + fs/fs.h + fs/fs_interface.h + irq.h + irq_offload.h + kernel_includes.h + kernel/internal/smp.h + kernel/obj_core.h + kernel/stats.h + kernel/thread_stack.h + kernel_version.h + linker/sections.h + linker/section_tags.h + spinlock.h + shell/shell_types.h + shell/shell_fprintf.h + shell/shell_string_conv.h + sys/__assert.h + sys/atomic.h + sys/atomic_c.h + sys/atomic_types.h + sys/byteorder.h + sys/check.h + sys/crc.h + sys/dlist.h + sys/list_gen.h + sys/math_extras.h + sys/math_extras_impl.h + sys/mem_stats.h + sys/rb.h + sys/sflist.h + sys/slist.h + sys/sys_heap.h + sys/time_units.h + sys/util.h + sys/util_macro.h + sys/util_loops.h + sys/util_listify.h + tracing/tracing_macros.h + types.h + ) + + add_custom_target(create_symlinks ALL + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/app_memory + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/debug + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/devicetree + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/fs + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/linker + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/arch/common + COMMAND ${CMAKE_COMMAND} -E make_directory ${PORTINC}/kernel/internal + COMMAND ${CMAKE_COMMAND} -E create_symlink ${ZINC}/bluetooth ${PORTINC}/bluetooth + COMMAND ${CMAKE_COMMAND} -E create_symlink ${ZINC}/drivers ${PORTINC}/drivers + COMMAND ${CMAKE_COMMAND} -E create_symlink ${ZINC}/settings ${PORTINC}/settings + ) + + foreach(file ${SYMLINK_FILES}) + add_custom_command(TARGET create_symlinks POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink ${ZINC}/${file} ${PORTINC}/${file} + ) + endforeach() + add_dependencies(zblue create_symlinks) + + add_custom_target(clean_symlinks + COMMAND ${CMAKE_COMMAND} -E remove -f .built + COMMAND ${CMAKE_COMMAND} -E remove -f ${PORTINC}/bluetooth + COMMAND ${CMAKE_COMMAND} -E remove -f ${PORTINC}/drivers + COMMAND ${CMAKE_COMMAND} -E remove -f ${PORTINC}/settings + ) + + foreach(file ${SYMLINK_FILES}) + add_custom_command(TARGET clean_symlinks POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove -f ${PORTINC}/${file} + ) + endforeach() endif() diff --git a/zblue/Kconfig b/zblue/Kconfig index 27f0558..7219fe9 100644 --- a/zblue/Kconfig +++ b/zblue/Kconfig @@ -15,7 +15,8 @@ # menu "Bluetooth Stack: Zephyr Bluetooth Stack" -osource "$APPSDIR/external/zblue/zblue/subsys/bluetooth/Kconfig" -osource "$APPSDIR/external/zblue/zblue/subsys/settings/Kconfig" -osource "$APPSDIR/external/zblue/zblue/port/Kconfig" +source "$APPSDIR/external/zblue/zblue/Kconfig.constants" +source "$APPSDIR/external/zblue/zblue/subsys/bluetooth/Kconfig" +source "$APPSDIR/external/zblue/zblue/subsys/settings/Kconfig" +source "$APPSDIR/external/zblue/zblue/port/Kconfig" endmenu # Bluetooth Stack: Zephyr Bluetooth Stack diff --git a/zblue/Make.defs b/zblue/Make.defs index d5c7193..010b214 100644 --- a/zblue/Make.defs +++ b/zblue/Make.defs @@ -15,10 +15,5 @@ # ifneq ($(CONFIG_BT),) -ifeq ($(CONFIG_ZEPHYR_WORK_QUEUE),y) - CONFIGURED_APPS += $(APPDIR)/external/zblue/zblue - CLEANDIRS += $(APPDIR)/external/zblue/zblue -else CONFIGURED_APPS += $(APPDIR)/external/zblue endif -endif diff --git a/zblue/Makefile b/zblue/Makefile index 79939bf..37b8a32 100644 --- a/zblue/Makefile +++ b/zblue/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2020 Xiaomi Corporation +# Copyright (C) 2024 Xiaomi Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,310 +16,757 @@ include $(APPDIR)/Make.defs -SUBDIR = zblue/subsys/bluetooth +BTDIR = zblue/subsys/bluetooth -ifeq ($(CONFIG_BT_HCI_RAW),y) - CSRCS += $(SUBDIR)/host/hci_raw.c -endif -ifeq ($(CONFIG_BT_DEBUG_MONITOR),y) - CSRCS += $(SUBDIR)/host/monitor.c -endif -ifeq ($(CONFIG_BT_TINYCRYPT_ECC),y) - CSRCS += $(SUBDIR)/host/hci_ecc.c -endif -ifeq ($(CONFIG_BT_A2DP),y) - CSRCS += $(SUBDIR)/host/a2dp.c -endif -ifeq ($(CONFIG_BT_AVDTP),y) - CSRCS += $(SUBDIR)/host/avdtp.c -endif -ifeq ($(CONFIG_BT_RFCOMM),y) - CSRCS += $(SUBDIR)/host/rfcomm.c -endif -ifeq ($(CONFIG_BT_TESTING),y) - CSRCS += $(SUBDIR)/host/testing.c -endif -ifeq ($(CONFIG_BT_SETTINGS),y) - CSRCS += $(SUBDIR)/host/settings.c -endif -ifeq ($(CONFIG_BT_HOST_CCM),y) - CSRCS += $(SUBDIR)/host/aes_ccm.c -endif +CSRCS += $(BTDIR)/common/addr.c +CSRCS += $(BTDIR)/common/dummy.c +CSRCS += $(BTDIR)/common/bt_str.c -ifeq ($(CONFIG_BT_BREDR),y) - CSRCS += $(SUBDIR)/host/keys_br.c - CSRCS += $(SUBDIR)/host/l2cap_br.c - CSRCS += $(SUBDIR)/host/sdp.c - CSRCS += $(SUBDIR)/host/ssp.c -endif +ifeq ($(CONFIG_BT_RPA),y) + CSRCS += $(BTDIR)/common/rpa.c +endif # CONFIG_BT_RPA -ifeq ($(CONFIG_BT_HFP_HF),y) - CSRCS += $(SUBDIR)/host/hfp_hf.c - CSRCS += $(SUBDIR)/host/at.c +ifeq ($(CONFIG_BT_EAD),y) + CSRCS += $(BTDIR)/lib/ead.c endif -ifeq ($(CONFIG_BT_AUDIO),y) - ifeq ($(CONFIG_BT_ISO),y) - CSRCS += $(SUBDIR)/host/audio/iso.c +ifeq ($(CONFIG_BT_HCI),y) + HOSTDIR = $(BTDIR)/host + + ifeq ($(CONFIG_BT_HCI_RAW),y) + CSRCS += $(HOSTDIR)/hci_raw.c $(HOSTDIR)/hci_common.c + endif + ifeq ($(CONFIG_BT_MONITOR),y) + CSRCS += $(HOSTDIR)/monitor.c + endif + ifeq ($(CONFIG_BT_TINYCRYPT_ECC),y) + CSRCS += $(HOSTDIR)/hci_ecc.c + endif + ifeq ($(CONFIG_BT_SETTINGS),y) + CSRCS += $(HOSTDIR)/settings.c + endif + ifeq ($(CONFIG_BT_HOST_CCM),y) + CSRCS += $(HOSTDIR)/aes_ccm.c + endif + ifeq ($(CONFIG_BT_LONG_WQ),y) + CSRCS += $(HOSTDIR)/long_wq.c endif -endif -ifeq ($(CONFIG_BT_HCI_HOST),y) - CSRCS += $(SUBDIR)/host/uuid.c - CSRCS += $(SUBDIR)/host/hci_core.c + ifeq ($(CONFIG_BT_HCI_HOST),y) + CSRCS += $(HOSTDIR)/uuid.c $(HOSTDIR)/addr.c \ + $(HOSTDIR)/buf.c $(HOSTDIR)/data.c \ + $(HOSTDIR)/hci_core.c $(HOSTDIR)/hci_common.c \ + $(HOSTDIR)/id.c - ifeq ($(CONFIG_BT_HOST_CRYPTO),y) - CSRCS += $(SUBDIR)/host/crypto.c - endif + ifeq ($(CONFIG_BT_BROADCASTER),y) + CSRCS += $(HOSTDIR)/adv.c + endif + ifeq ($(CONFIG_BT_OBSERVER),y) + CSRCS += $(HOSTDIR)/scan.c + endif - ifeq ($(CONFIG_BT_CONN),y) - CSRCS += $(SUBDIR)/host/conn.c - CSRCS += $(SUBDIR)/host/l2cap.c - CSRCS += $(SUBDIR)/host/att.c - CSRCS += $(SUBDIR)/host/gatt.c + ifeq ($(CONFIG_BT_USE_PSA_API),y) + ifeq ($(CONFIG_BT_HOST_CRYPTO),y) + CSRCS += $(HOSTDIR)/crypto_psa.c + endif + else + ifeq ($(CONFIG_BT_HOST_CRYPTO),y) + CSRCS += $(HOSTDIR)/crypto_tc.c + endif + endif + + ifeq ($(CONFIG_BT_ECC),y) + CSRCS += $(HOSTDIR)/ecc.c + endif + + ifeq ($(CONFIG_BT_CONN),y) + CSRCS += $(HOSTDIR)/conn.c $(HOSTDIR)/l2cap.c + CSRCS += $(HOSTDIR)/att.c $(HOSTDIR)/gatt.c + + ifeq ($(CONFIG_BT_SMP),y) + CSRCS += $(HOSTDIR)/smp.c $(HOSTDIR)/keys.c + else + CSRCS += $(HOSTDIR)/smp_null.c + endif + endif + + ifeq ($(CONFIG_BT_ISO),y) + CSRCS += $(HOSTDIR)/iso.c $(HOSTDIR)/conn.c + endif + ifeq ($(CONFIG_BT_CHANNEL_SOUNDING),y) + CSRCS += $(HOSTDIR)/cs.c + endif + ifeq ($(CONFIG_BT_DF),y) + CSRCS += $(HOSTDIR)/direction.c + endif + endif # CONFIG_BT_HCI_HOST + + ifeq ($(CONFIG_BT_CLASSIC),y) + CLASSICDIR = $(HOSTDIR)/classic + + ifeq ($(CONFIG_BT_A2DP),y) + CSRCS += $(CLASSICDIR)/a2dp.c $(CLASSICDIR)/a2dp_codec_sbc.c + endif + ifeq ($(CONFIG_BT_AVDTP),y) + CSRCS += $(CLASSICDIR)/avdtp.c + endif + ifeq ($(CONFIG_BT_AVRCP), y) + CSRCS += $(CLASSICDIR)/avrcp.c + endif + ifeq ($(CONFIG_BT_AVCTP), y) + CSRCS += $(CLASSICDIR)/avctp.c + endif + ifeq ($(CONFIG_BT_RFCOMM),y) + CSRCS += $(CLASSICDIR)/rfcomm.c + endif + + ifeq ($(CONFIG_BT_CLASSIC),y) + CSRCS += $(CLASSICDIR)/br.c \ + $(CLASSICDIR)/keys_br.c \ + $(CLASSICDIR)/l2cap_br.c \ + $(CLASSICDIR)/sdp.c \ + $(CLASSICDIR)/ssp.c \ + $(CLASSICDIR)/sco.c + endif + + ifeq ($(CONFIG_BT_HFP_HF),y) + CSRCS += $(CLASSICDIR)/hfp_hf.c \ + $(CLASSICDIR)/at.c + endif + ifeq ($(CONFIG_BT_HFP_AG),y) + CSRCS += $(CLASSICDIR)/hfp_ag.c + endif + + ifeq ($(CONFIG_BT_SHELL),y) + CSRCS += $(CLASSICDIR)/shell/bredr.c + + ifeq ($(CONFIG_BT_RFCOMM),y) + CSRCS += $(CLASSICDIR)/shell/rfcomm.c + endif + ifeq ($(CONFIG_BT_A2DP),y) + CSRCS += $(CLASSICDIR)/shell/a2dp.c + endif + ifeq ($(CONFIG_BT_AVRCP),y) + CSRCS += $(CLASSICDIR)/shell/avrcp.c + endif + endif # CONFIG_BT_SHELL + endif # CONFIG_BT_CLASSIC + + ifeq ($(CONFIG_BT_SHELL),y) + CSRCS += $(HOSTDIR)/shell/bt.c + + ifeq ($(CONFIG_BT_CONN),y) + CSRCS += $(HOSTDIR)/shell/gatt.c + endif + ifeq ($(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL),y) + CSRCS += $(HOSTDIR)/shell/l2cap.c + endif + ifeq ($(CONFIG_BT_ISO),y) + CSRCS += $(HOSTDIR)/shell/iso.c + endif + ifeq ($(CONFIG_BT_CHANNEL_SOUNDING),y) + CSRCS += $(HOSTDIR)/shell/cs.c + endif + endif # CONFIG_BT_SHELL +endif # CONFIG_BT_HCI + +ifeq ($(CONFIG_BT_CONN),y) + SVRSDIR = $(BTDIR)/services + + ifeq ($(CONFIG_BT_DIS),y) + CSRCS += $(SVRSDIR)/dis.c + endif + ifeq ($(CONFIG_BT_CTS),y) + CSRCS += $(SVRSDIR)/cts.c + endif + ifeq ($(CONFIG_BT_HRS),y) + CSRCS += $(SVRSDIR)/hrs.c + endif + ifeq ($(CONFIG_BT_TPS),y) + CSRCS += $(SVRSDIR)/tps.c endif - ifeq ($(CONFIG_BT_SMP),y) - CSRCS += $(SUBDIR)/host/smp.c - CSRCS += $(SUBDIR)/host/keys.c - else - CSRCS += $(SUBDIR)/host/smp_null.c + ifeq ($(CONFIG_BT_BAS),y) + CSRCS += $(SVRSDIR)/bas/bas.c + ifeq ($(CONFIG_BT_BAS_BLS),y) + CSRCS += $(SVRSDIR)/bas/bas_bls.c + endif + ifeq ($(CONFIG_BT_BAS_BCS),y) + CSRCS += $(SVRSDIR)/bas/bas_bcs.c + endif endif -endif -ifeq ($(CONFIG_BT_DIS),y) - CSRCS += $(SUBDIR)/services/dis.c -endif + ifeq ($(CONFIG_BT_OTS),y) + CSRCS += $(SVRSDIR)/ots/ots.c \ + $(SVRSDIR)/ots/ots_l2cap.c \ + $(SVRSDIR)/ots/ots_obj_manager.c \ + $(SVRSDIR)/ots/ots_oacp.c \ + $(SVRSDIR)/ots/ots_olcp.c + endif -ifeq ($(CONFIG_BT_BAS),y) - CSRCS += $(SUBDIR)/services/bas.c -endif + ifeq ($(CONFIG_BT_OTS_DIR_LIST_OBJ),y) + CSRCS += $(SVRSDIR)/ots/ots_dir_list.c + endif + ifeq ($(CONFIG_BT_OTS_CLIENT),y) + CSRCS += $(SVRSDIR)/ots/ots_client.c \ + $(SVRSDIR)/ots/ots_l2cap.c + endif -ifeq ($(CONFIG_BT_HRS),y) - CSRCS += $(SUBDIR)/services/hrs.c -endif + ifeq ($(CONFIG_BT_IAS),y) + CSRCS += $(SVRSDIR)/ias/ias.c + ifeq ($(CONFIG_BT_SHELL),y) + CSRCS += $(SVRSDIR)/ias/shell/ias.c + endif + endif -ifeq ($(CONFIG_BT_MESH),y) - CSRCS += $(SUBDIR)/mesh/main.c - CSRCS += $(SUBDIR)/mesh/adv.c - CSRCS += $(SUBDIR)/mesh/beacon.c - CSRCS += $(SUBDIR)/mesh/net.c - CSRCS += $(SUBDIR)/mesh/transport.c - CSRCS += $(SUBDIR)/mesh/crypto.c - CSRCS += $(SUBDIR)/mesh/access.c - CSRCS += $(SUBDIR)/mesh/cfg_srv.c - CSRCS += $(SUBDIR)/mesh/health_srv.c - ifeq ($(CONFIG_BT_SETTINGS),y) - CSRCS += $(SUBDIR)/mesh/settings.c + ifeq ($(CONFIG_BT_IAS_CLIENT),y) + CSRCS += $(SVRSDIR)/ias/ias_client.c + ifeq ($(CONFIG_BT_SHELL),y) + CSRCS += $(SVRSDIR)/ias/shell/ias_client.c + endif endif -endif -ifeq ($(CONFIG_BT_MESH_LOW_POWER),y) - CSRCS += $(SUBDIR)/mesh/lpn.c -endif -ifeq ($(CONFIG_BT_MESH_FRIEND),y) - CSRCS += $(SUBDIR)/mesh/friend.c -endif -ifeq ($(CONFIG_BT_MESH_PROV),y) - CSRCS += $(SUBDIR)/mesh/prov.c -endif -ifeq ($(CONFIG_BT_MESH_PB_ADV),y) - CSRCS += $(SUBDIR)/mesh/pb_adv.c -endif -ifeq ($(CONFIG_BT_MESH_PB_GATT),y) - CSRCS += $(SUBDIR)/mesh/pb_gatt.c -endif -ifeq ($(CONFIG_BT_MESH_PROXY),y) - CSRCS += $(SUBDIR)/mesh/proxy.c -endif -ifeq ($(CONFIG_BT_MESH_CFG_CLI),y) - CSRCS += $(SUBDIR)/mesh/cfg_cli.c -endif -ifeq ($(CONFIG_BT_MESH_HEALTH_CLI),y) - CSRCS += $(SUBDIR)/mesh/health_cli.c -endif -ifeq ($(CONFIG_BT_MESH_SELF_TEST),y) - CSRCS += $(SUBDIR)/mesh/test.c -endif -ifeq ($(CONFIG_BT_MESH_CDB),y) - CSRCS += $(SUBDIR)/mesh/cdb.c -endif + ifeq ($(CONFIG_BT_ZEPHYR_NUS),y) + CSRCS += $(SVRSDIR)/nus/nus.c \ + $(SVRSDIR)/nus/nus_inst.c -CSRCS += $(wildcard $(SUBDIR)/common/*.c) + ifeq ($(CONFIG_BT_ZEPHYR_NUS_AUTO_START_BLUETOOTH),y) + CSRCS += $(SVRSDIR)/nus/bt_nus_auto_start_bt.c + endif + endif # CONFIG_BT_ZEPHYR_NUS +endif # CONFIG_BT_CONN -ifeq ($(CONFIG_SETTINGS),y) - CSRCS += zblue/subsys/settings/src/settings.c - CSRCS += zblue/subsys/settings/src/settings_store.c - CSRCS += zblue/subsys/settings/src/settings_init.c - CSRCS += zblue/subsys/settings/src/settings_line.c - ifeq ($(CONFIG_SETTINGS_FS),y) - CSRCS += zblue/subsys/settings/src/settings_file.c - else ifeq ($(CONFIG_SETTINGS_NONE),y) - CSRCS += zblue/subsys/settings/src/settings_none.c - endif - CFLAGS += ${INCDIR_PREFIX}zblue/subsys/settings/include -endif +ifeq ($(CONFIG_BT_MESH),y) + MESHDIR = $(BTDIR)/mesh + + CSRCS += $(MESHDIR)/main.c \ + $(MESHDIR)/cfg.c \ + $(MESHDIR)/adv.c \ + $(MESHDIR)/beacon.c \ + $(MESHDIR)/net.c \ + $(MESHDIR)/subnet.c \ + $(MESHDIR)/app_keys.c \ + $(MESHDIR)/heartbeat.c \ + $(MESHDIR)/crypto.c \ + $(MESHDIR)/access.c \ + $(MESHDIR)/msg.c \ + $(MESHDIR)/cfg_srv.c \ + $(MESHDIR)/health_srv.c \ + $(MESHDIR)/va.c \ + $(MESHDIR)/transport.c + + ifeq ($(CONFIG_BT_MESH_ADV_LEGACY),y) + CSRCS += $(MESHDIR)/adv_legacy.c + endif + ifeq ($(CONFIG_BT_MESH_ADV_EXT),y) + CSRCS += $(MESHDIR)/adv_ext.c + endif + ifeq ($(CONFIG_BT_SETTINGS),y) + CSRCS += $(MESHDIR)/settings.c + endif + ifeq ($(CONFIG_BT_MESH_RPL_STORAGE_MODE_SETTINGS),y) + CSRCS += $(MESHDIR)/rpl.c + endif + ifeq ($(CONFIG_BT_MESH_LOW_POWER),y) + CSRCS += $(MESHDIR)/lpn.c + endif + ifeq ($(CONFIG_BT_MESH_FRIEND),y) + CSRCS += $(MESHDIR)/friend.c + endif + ifeq ($(CONFIG_BT_MESH_PROV),y) + CSRCS += $(MESHDIR)/prov.c + endif + ifeq ($(CONFIG_BT_MESH_PROVISIONEE),y) + CSRCS += $(MESHDIR)/provisionee.c + endif + ifeq ($(CONFIG_BT_MESH_PROVISIONER),y) + CSRCS += $(MESHDIR)/provisioner.c + endif + ifeq ($(CONFIG_BT_MESH_PB_ADV),y) + CSRCS += $(MESHDIR)/pb_adv.c + endif + ifeq ($(CONFIG_BT_MESH_PB_GATT_COMMON),y) + CSRCS += $(MESHDIR)/pb_gatt.c + endif + ifeq ($(CONFIG_BT_MESH_PB_GATT),y) + CSRCS += $(MESHDIR)/pb_gatt_srv.c + endif + ifeq ($(CONFIG_BT_MESH_PB_GATT_CLIENT),y) + CSRCS += $(MESHDIR)/pb_gatt_cli.c + endif + ifeq ($(CONFIG_BT_MESH_GATT_CLIENT),y) + CSRCS += $(MESHDIR)/gatt_cli.c + endif + ifeq ($(CONFIG_BT_MESH_PROXY_CLIENT),y) + CSRCS += $(MESHDIR)/proxy_cli.c + endif + ifeq ($(CONFIG_BT_MESH_GATT_PROXY),y) + CSRCS += $(MESHDIR)/proxy_srv.c + endif + ifeq ($(CONFIG_BT_MESH_GATT),y) + CSRCS += $(MESHDIR)/proxy_msg.c + endif + ifeq ($(CONFIG_BT_MESH_CFG_CLI),y) + CSRCS += $(MESHDIR)/cfg_cli.c + endif + ifeq ($(CONFIG_BT_MESH_HEALTH_CLI),y) + CSRCS += $(MESHDIR)/health_cli.c + endif + ifeq ($(CONFIG_BT_MESH_SAR_CFG_CLI),y) + CSRCS += $(MESHDIR)/sar_cfg_cli.c + endif + ifeq ($(CONFIG_BT_MESH_SAR_CFG_SRV),y) + CSRCS += $(MESHDIR)/sar_cfg_srv.c + endif + ifeq ($(CONFIG_BT_MESH_SAR_CFG),y) + CSRCS += $(MESHDIR)/sar_cfg.c + endif + ifeq ($(CONFIG_BT_MESH_OP_AGG_SRV),y) + CSRCS += $(MESHDIR)/op_agg_srv.c + endif + ifeq ($(CONFIG_BT_MESH_OP_AGG_CLI),y) + CSRCS += $(MESHDIR)/op_agg_cli.c + endif + ifeq ($(CONFIG_BT_MESH_OP_AGG),y) + CSRCS += $(MESHDIR)/op_agg.c + endif + ifeq ($(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV),y) + CSRCS += $(MESHDIR)/large_comp_data_srv.c + endif + ifeq ($(CONFIG_BT_MESH_LARGE_COMP_DATA_CLI),y) + CSRCS += $(MESHDIR)/large_comp_data_cli.c + endif + ifeq ($(CONFIG_BT_MESH_PRIV_BEACON_SRV),y) + CSRCS += $(MESHDIR)/priv_beacon_srv.c + endif + ifeq ($(CONFIG_BT_MESH_PRIV_BEACON_CLI),y) + CSRCS += $(MESHDIR)/priv_beacon_cli.c + endif + ifeq ($(CONFIG_BT_MESH_SELF_TEST),y) + CSRCS += $(MESHDIR)/test.c + endif + ifeq ($(CONFIG_BT_MESH_CDB),y) + CSRCS += $(MESHDIR)/cdb.c + endif + ifeq ($(CONFIG_BT_MESH_BLOB_SRV),y) + CSRCS += $(MESHDIR)/blob_srv.c + endif + ifeq ($(CONFIG_BT_MESH_BLOB_CLI),y) + CSRCS += $(MESHDIR)/blob_cli.c + endif + ifeq ($(CONFIG_BT_MESH_BLOB_IO_FLASH),y) + CSRCS += $(MESHDIR)/blob_io_flash.c + endif + ifeq ($(CONFIG_BT_MESH_DFU_CLI),y) + CSRCS += $(MESHDIR)/dfu_cli.c + endif + ifeq ($(CONFIG_BT_MESH_DFU_SRV),y) + CSRCS += $(MESHDIR)/dfu_srv.c + endif + ifeq ($(CONFIG_BT_MESH_DFD_SRV),y) + CSRCS += $(MESHDIR)/dfd_srv.c + endif + ifeq ($(CONFIG_BT_MESH_DFU_SLOTS),y) + CSRCS += $(MESHDIR)/dfu_slot.c + endif + ifeq ($(CONFIG_BT_MESH_DFU_METADATA),y) + CSRCS += $(MESHDIR)/dfu_metadata.c + endif + ifeq ($(CONFIG_BT_MESH_RPR_CLI),y) + CSRCS += $(MESHDIR)/rpr_cli.c + endif + ifeq ($(CONFIG_BT_MESH_RPR_SRV),y) + CSRCS += $(MESHDIR)/rpr_srv.c + endif + ifeq ($(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI),y) + CSRCS += $(MESHDIR)/od_priv_proxy_cli.c + endif + ifeq ($(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV),y) + CSRCS += $(MESHDIR)/od_priv_proxy_srv.c + endif + ifeq ($(CONFIG_BT_MESH_SOL_PDU_RPL_CLI),y) + CSRCS += $(MESHDIR)/sol_pdu_rpl_cli.c + endif + ifeq ($(CONFIG_BT_MESH_SOL_PDU_RPL_SRV),y) + CSRCS += $(MESHDIR)/sol_pdu_rpl_srv.c + endif + ifeq ($(CONFIG_BT_MESH_BRG_CFG_CLI),y) + CSRCS += $(MESHDIR)/brg_cfg_cli.c + endif + ifeq ($(CONFIG_BT_MESH_BRG_CFG_SRV),y) + CSRCS += $(MESHDIR)/brg_cfg_srv.c $(MESHDIR)/brg_cfg.c + endif + ifeq ($(CONFIG_BT_MESH_SOLICITATION),y) + CSRCS += $(MESHDIR)/solicitation.c + endif + ifeq ($(CONFIG_BT_MESH_STATISTIC),y) + CSRCS += $(MESHDIR)/statistic.c + endif + ifeq ($(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG),y) + CSRCS += $(MESHDIR)/delayable_msg.c + endif + ifeq ($(CONFIG_BT_MESH_USES_TINYCRYPT),y) + CSRCS += $(MESHDIR)/crypto_tc.c + else + CSRCS += $(MESHDIR)/crypto_psa.c + endif + ifeq ($(CONFIG_BT_TESTING),y) + CSRCS += $(MESHDIR)/testing.c + endif -ifeq ($(CONFIG_FILE_SYSTEM),y) - CSRCS += zblue/port/subsys/fs/fs.c -endif + ifeq ($(CONFIG_BT_MESH_SHELL),y) + CSRCS += $(MESHDIR)/shell/shell.c \ + $(MESHDIR)/shell/utils.c -ifeq ($(CONFIG_BT_SHELL),y) - CSRCS += zblue/port/subsys/shell/shell.c + ifeq ($(CONFIG_BT_MESH_SHELL_HEALTH_CLI),y) + CSRCS += $(MESHDIR)/shell/health.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_CFG_CLI),y) + CSRCS += $(MESHDIR)/shell/cfg.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_LARGE_COMP_DATA_CLI),y) + CSRCS += $(MESHDIR)/shell/large_comp_data.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_OP_AGG_CLI),y) + CSRCS += $(MESHDIR)/shell/op_agg.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_PRIV_BEACON_CLI),y) + CSRCS += $(MESHDIR)/shell/priv_beacon.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_RPR_CLI),y) + CSRCS += $(MESHDIR)/shell/rpr.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_SAR_CFG_CLI),y) + CSRCS += $(MESHDIR)/shell/sar.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_BLOB_CLI),y) + CSRCS += $(MESHDIR)/shell/blob.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_BLOB_SRV),y) + CSRCS += $(MESHDIR)/shell/blob.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_BLOB_IO_FLASH),y) + CSRCS += $(MESHDIR)/shell/blob.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_DFU_SLOT),y) + CSRCS += $(MESHDIR)/shell/dfu.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_DFU_METADATA),y) + CSRCS += $(MESHDIR)/shell/dfu.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_DFU_CLI),y) + CSRCS += $(MESHDIR)/shell/dfu.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_DFU_SRV),y) + CSRCS += $(MESHDIR)/shell/dfu.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_DFD_SRV),y) + CSRCS += $(MESHDIR)/shell/dfd.c + endif + ifeq ($(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI),y) + CSRCS += $(MESHDIR)/shell/od_priv_proxy.c + endif + ifeq ($(CONFIG_BT_MESH_SOL_PDU_RPL_CLI),y) + CSRCS += $(MESHDIR)/shell/sol_pdu_rpl.c + endif + ifeq ($(CONFIG_BT_MESH_SHELL_BRG_CFG_CLI),y) + CSRCS += $(MESHDIR)/shell/brg_cfg.c + endif + ifeq ($(CONFIG_BT_HCI_MESH_EXT),y) + CSRCS += $(MESHDIR)/shell/hci.c + endif + endif # CONFIG_BT_MESH_SHELL +endif # CONFIG_BT_MESH - CSRCS += $(SUBDIR)/shell/bt.c - CSRCS += $(SUBDIR)/shell/hci.c - MAINSRC += zblue/port/subsys/bluetooth/shell/bt.c - PROGNAME += bt - zblue/port/subsys/bluetooth/shell/bt.c_CFLAGS += -DCONFIG_BT_BT_SHELL - zblue/port/subsys/bluetooth/shell/bt.c_CELFFLAGS += -DCONFIG_BT_BT_SHELL +ifeq ($(CONFIG_BT_AUDIO),y) + AUDIODIR = $(BTDIR)/audio + CSRCS += $(AUDIODIR)/audio.c + ifeq ($(CONFIG_BT_VOCS),y) + CSRCS += $(AUDIODIR)/vocs.c + endif + ifeq ($(CONFIG_BT_VOCS_CLIENT),y) + CSRCS += $(AUDIODIR)/vocs_client.c + endif + ifeq ($(CONFIG_BT_AICS),y) + CSRCS += $(AUDIODIR)/aics.c + endif + ifeq ($(CONFIG_BT_AICS_CLIENT),y) + CSRCS += $(AUDIODIR)/aics_client.c + endif + ifeq ($(CONFIG_BT_VCP_VOL_REND),y) + CSRCS += $(AUDIODIR)/vcp_vol_rend.c + endif + ifeq ($(CONFIG_BT_VCP_VOL_CTLR),y) + CSRCS += $(AUDIODIR)/vcp_vol_ctlr.c + endif + ifeq ($(CONFIG_BT_MICP_MIC_DEV),y) + CSRCS += $(AUDIODIR)/micp_mic_dev.c + endif + ifeq ($(CONFIG_BT_MICP_MIC_CTLR),y) + CSRCS += $(AUDIODIR)/micp_mic_ctlr.c + endif ifeq ($(CONFIG_BT_CONN),y) - CSRCS += $(SUBDIR)/shell/gatt.c - MAINSRC += zblue/port/subsys/bluetooth/shell/gatt.c - PROGNAME += gatt - zblue/port/subsys/bluetooth/shell/gatt.c_CFLAGS += -DCONFIG_BT_GATT_SHELL - zblue/port/subsys/bluetooth/shell/gatt.c_CELFFLAGS += -DCONFIG_BT_GATT_SHELL - endif - ifeq ($(CONFIG_BT_BREDR),y) - CSRCS += $(SUBDIR)/shell/bredr.c - MAINSRC += zblue/port/subsys/bluetooth/shell/bredr.c - PROGNAME += bredr - zblue/port/subsys/bluetooth/shell/bredr.c_CFLAGS += -DCONFIG_BT_BREDR_SHELL - zblue/port/subsys/bluetooth/shell/bredr.c_CELFFLAGS += -DCONFIG_BT_BREDR_SHELL - endif - ifeq ($(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL),y) - CSRCS += $(SUBDIR)/shell/l2cap.c - MAINSRC += zblue/port/subsys/bluetooth/shell/l2cap.c - PROGNAME += l2cap - zblue/port/subsys/bluetooth/shell/l2cap.c_CFLAGS += -DCONFIG_BT_L2CAP_SHELL - zblue/port/subsys/bluetooth/shell/l2cap.c_CELFFLAGS += -DCONFIG_BT_L2CAP_SHELL - endif - ifeq ($(CONFIG_BT_RFCOMM),y) - CSRCS += $(SUBDIR)/shell/rfcomm.c - MAINSRC += zblue/port/subsys/bluetooth/shell/rfcomm.c - PROGNAME += rfcomm - zblue/port/subsys/bluetooth/shell/rfcomm.c_CFLAGS += -DCONFIG_BT_RFCOMM_SHELL - zblue/port/subsys/bluetooth/shell/rfcomm.c_CELFFLAGS += -DCONFIG_BT_RFCOMM_SHELL - endif - - ifeq ($(CONFIG_BT_AUDIO),y) - ifeq ($(CONFIG_BT_ISO),y) - CSRCS += $(SUBDIR)/shell/iso.c - MAINSRC += zblue/port/subsys/bluetooth/shell/iso.c - PROGNAME += iso - zblue/port/subsys/bluetooth/shell/iso.c_CFLAGS += -DCONFIG_BT_ISO_SHELL - zblue/port/subsys/bluetooth/shell/iso.c_CELFFLAGS += -DCONFIG_BT_ISO_SHELL - endif + CSRCS += $(AUDIODIR)/ccid.c + endif + ifeq ($(CONFIG_BT_CSIP_SET_MEMBER),y) + CSRCS += $(AUDIODIR)/csip_set_member.c + endif + ifeq ($(CONFIG_BT_CSIP_SET_COORDINATOR),y) + CSRCS += $(AUDIODIR)/csip_set_coordinator.c + endif + ifeq ($(CONFIG_BT_CSIP_SET_MEMBER)$(CONFIG_BT_CSIP_SET_COORDINATOR),yy) + CSRCS += $(AUDIODIR)/csip_crypto.c + endif + ifeq ($(CONFIG_BT_TBS),y) + CSRCS += $(AUDIODIR)/tbs.c + endif + ifeq ($(CONFIG_BT_TBS_CLIENT),y) + CSRCS += $(AUDIODIR)/tbs_client.c + endif + ifeq ($(CONFIG_BT_MCC),y) + CSRCS += $(AUDIODIR)/mcc.c + endif + ifeq ($(CONFIG_BT_MCS),y) + CSRCS += $(AUDIODIR)/mcs.c + endif + ifeq ($(CONFIG_BT_MPL),y) + CSRCS += $(AUDIODIR)/mpl.c + endif + ifeq ($(CONFIG_MCTL),y) + CSRCS += $(AUDIODIR)/media_proxy.c + endif + ifeq ($(CONFIG_BT_ASCS),y) + CSRCS += $(AUDIODIR)/ascs.c + endif + ifeq ($(CONFIG_BT_PACS),y) + CSRCS += $(AUDIODIR)/pacs.c + endif + ifeq ($(CONFIG_BT_BAP_STREAM),y) + CSRCS += $(AUDIODIR)/bap_stream.c $(AUDIODIR)/codec.c $(AUDIODIR)/bap_iso.c + endif + ifeq ($(CONFIG_BT_BAP_BASE),y) + CSRCS += $(AUDIODIR)/bap_base.c + endif + ifeq ($(CONFIG_BT_BAP_UNICAST_SERVER),y) + CSRCS += $(AUDIODIR)/bap_unicast_server.c + endif + ifeq ($(CONFIG_BT_BAP_UNICAST_CLIENT),y) + CSRCS += $(AUDIODIR)/bap_unicast_client.c + endif + ifeq ($(CONFIG_BT_BAP_BROADCAST_SOURCE),y) + CSRCS += $(AUDIODIR)/bap_broadcast_source.c + endif + ifeq ($(CONFIG_BT_BAP_BROADCAST_SINK),y) + CSRCS += $(AUDIODIR)/bap_broadcast_sink.c + endif + ifeq ($(CONFIG_BT_BAP_SCAN_DELEGATOR),y) + CSRCS += $(AUDIODIR)/bap_scan_delegator.c + endif + ifeq ($(CONFIG_BT_BAP_BROADCAST_ASSISTANT),y) + CSRCS += $(AUDIODIR)/bap_broadcast_assistant.c + endif + ifeq ($(CONFIG_BT_HAS),y) + CSRCS += $(AUDIODIR)/has.c + endif + ifeq ($(CONFIG_BT_HAS_CLIENT),y) + CSRCS += $(AUDIODIR)/has_client.c + endif + ifeq ($(CONFIG_BT_CAP),y) + CSRCS += $(AUDIODIR)/cap_stream.c + endif + ifeq ($(CONFIG_BT_CAP_ACCEPTOR),y) + CSRCS += $(AUDIODIR)/cap_acceptor.c + endif + ifeq ($(CONFIG_BT_CAP_INITIATOR),y) + CSRCS += $(AUDIODIR)/cap_initiator.c + endif + ifeq ($(CONFIG_BT_CAP_COMMANDER),y) + CSRCS += $(AUDIODIR)/cap_commander.c + endif + ifeq ($(CONFIG_BT_CAP_INITIATOR_UNICAST)$(CONFIG_BT_CAP_COMMANDER),yy) + CSRCS += $(AUDIODIR)/cap_common.c + endif + ifeq ($(CONFIG_BT_TMAP),y) + CSRCS += $(AUDIODIR)/tmap.c + endif + ifeq ($(CONFIG_BT_GMAP),y) + CSRCS += $(AUDIODIR)/gmap_client.c $(AUDIODIR)/gmap_server.c + endif + ifeq ($(CONFIG_BT_PBP),y) + CSRCS += $(AUDIODIR)/pbp.c endif - ifeq ($(CONFIG_BT_MESH),y) - ifeq ($(CONFIG_BT_MESH_SHELL),y) - CSRCS += $(SUBDIR)/mesh/shell.c - MAINSRC += zblue/port/subsys/bluetooth/shell/mesh.c - PROGNAME += mesh + ifeq ($(CONFIG_BT_SHELL),y) + ifeq ($(CONFIG_BT_VCP_VOL_REND),y) + CSRCS += $(AUDIODIR)/shell/vcp_vol_rend.c endif - endif + ifeq ($(CONFIG_BT_VCP_VOL_CTLR),y) + CSRCS += $(AUDIODIR)/shell/vcp_vol_ctlr.c + endif + ifeq ($(CONFIG_BT_MICP_MIC_DEV),y) + CSRCS += $(AUDIODIR)/shell/micp_mic_dev.c + endif + ifeq ($(CONFIG_BT_MICP_MIC_CTLR),y) + CSRCS += $(AUDIODIR)/shell/micp_mic_ctlr.c + endif + ifeq ($(CONFIG_BT_CSIP_SET_MEMBER),y) + CSRCS += $(AUDIODIR)/shell/csip_set_member.c + endif + ifeq ($(CONFIG_BT_CSIP_SET_COORDINATOR),y) + CSRCS += $(AUDIODIR)/shell/csip_set_coordinator.c + endif + ifeq ($(CONFIG_BT_TBS),y) + CSRCS += $(AUDIODIR)/shell/tbs.c + endif + ifeq ($(CONFIG_BT_TBS_CLIENT),y) + CSRCS += $(AUDIODIR)/shell/tbs_client.c + endif + ifeq ($(CONFIG_BT_MPL),y) + CSRCS += $(AUDIODIR)/shell/mpl.c + endif + ifeq ($(CONFIG_BT_MCC),y) + CSRCS += $(AUDIODIR)/shell/mcc.c + endif + ifeq ($(CONFIG_BT_MCS),y) + CSRCS += $(AUDIODIR)/shell/media_controller.c + endif + ifeq ($(CONFIG_BT_HAS_PRESET_SUPPORT),y) + CSRCS += $(AUDIODIR)/shell/has.c + endif + ifeq ($(CONFIG_BT_CAP_ACCEPTOR),y) + CSRCS += $(AUDIODIR)/shell/cap_acceptor.c + endif + ifeq ($(CONFIG_BT_CAP_INITIATOR),y) + CSRCS += $(AUDIODIR)/shell/cap_initiator.c + endif + ifeq ($(CONFIG_BT_CAP_COMMANDER),y) + CSRCS += $(AUDIODIR)/shell/cap_commander.c + endif + ifeq ($(CONFIG_BT_HAS_CLIENT),y) + CSRCS += $(AUDIODIR)/shell/has_client.c + endif + ifeq ($(CONFIG_BT_TMAP),y) + CSRCS += $(AUDIODIR)/shell/tmap.c + endif + ifeq ($(CONFIG_BT_GMAP),y) + CSRCS += $(AUDIODIR)/shell/gmap.c + endif + ifeq ($(CONFIG_BT_BAP_STREAM),y) + CSRCS += $(AUDIODIR)/shell/bap.c + endif + ifeq ($(CONFIG_LIBLC3)$(CONFIG_USB_DEVICE_AUDIO),yy) + CSRCS += $(AUDIODIR)/shell/bap_usb.c + endif + ifeq ($(CONFIG_BT_BAP_SCAN_DELEGATOR),y) + CSRCS += $(AUDIODIR)/shell/bap_scan_delegator.c + endif + ifeq ($(CONFIG_BT_BAP_BROADCAST_ASSISTANT),y) + CSRCS += $(AUDIODIR)/shell/bap_broadcast_assistant.c + endif + ifeq ($(CONFIG_BT_PBP),y) + CSRCS += $(AUDIODIR)/shell/pbp.c + endif + endif # CONFIG_BT_SHELL +endif # CONFIG_BT_AUDIO -endif +ifeq ($(CONFIG_BT_CRYPTO),y) + CSRCS += $(BTDIR)/crypto/bt_crypto.c -ifeq ($(CONFIG_BT_TESTER),y) - CSRCS += zblue/tests/bluetooth/tester/src/bttester.c - CSRCS += zblue/tests/bluetooth/tester/src/gap.c - CSRCS += zblue/tests/bluetooth/tester/src/gatt.c - ifeq ($(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL),y) - CSRCS += zblue/tests/bluetooth/tester/src/l2cap.c - endif - ifeq ($(CONFIG_BT_MESH),y) - CSRCS += zblue/tests/bluetooth/tester/src/mesh.c + ifeq ($(CONFIG_BT_USE_PSA_API),y) + CSRCS += $(BTDIR)/crypto/bt_crypto_psa.c + else + CSRCS += $(BTDIR)/crypto/bt_crypto_tc.c endif - CSRCS += zblue/port/drivers/console/uart_pipe.c - CSRCS += zblue/port/tests/bluetooth/tester/src/system.c +endif # CONFIG_BT_CRYPTO - CSRCS += zblue/port/subsys/power/reboot.c +ifeq ($(CONFIG_SETTINGS),y) + SETTINGS_DIR = zblue/subsys/settings/src/ - MAINSRC += zblue/tests/bluetooth/tester/src/main.c - PROGNAME += bttester + CSRCS += $(SETTINGS_DIR)/settings_store.c + CSRCS += $(SETTINGS_DIR)/settings.c + CSRCS += $(SETTINGS_DIR)/settings_init.c + CSRCS += $(SETTINGS_DIR)/settings_line.c - CFLAGS += ${INCDIR_PREFIX}zblue/tests/bluetooth/tester/src -endif + ifeq ($(CONFIG_SETTINGS_FILE),y) + CSRCS += $(SETTINGS_DIR)/settings_file.c + endif + ifeq ($(CONFIG_SETTINGS_NVS),y) + CSRCS += $(SETTINGS_DIR)/settings_nvs.c + endif + ifeq ($(CONFIG_SETTINGS_NONE),y) + CSRCS += $(SETTINGS_DIR)/settings_none.c + endif + ifeq ($(CONFIG_SETTINGS_SHELL),y) + CSRCS += $(SETTINGS_DIR)/settings_shell.c + endif +endif # CONFIG_SETTINGS + +CSRCS += zblue/kernel/system_work_q.c +CSRCS += zblue/kernel/work.c +CSRCS += zblue/lib/net_buf/buf_simple.c +CSRCS += zblue/lib/utils/dec.c +CSRCS += zblue/lib/utils/hex.c -CSRCS += zblue/port/kernel/sched.c -CSRCS += zblue/port/kernel/timeout.c -CSRCS += zblue/port/kernel/work_q.c -CSRCS += zblue/port/kernel/poll.c -CSRCS += zblue/port/kernel/mem_slab.c CSRCS += zblue/port/kernel/atomic_c.c -CSRCS += zblue/port/kernel/sem.c +CSRCS += zblue/port/kernel/device.c +CSRCS += zblue/port/kernel/fatal.c +CSRCS += zblue/port/kernel/init.c +CSRCS += zblue/port/kernel/mem_slab.c CSRCS += zblue/port/kernel/mutex.c +CSRCS += zblue/port/kernel/poll.c CSRCS += zblue/port/kernel/queue.c +CSRCS += zblue/port/kernel/sched.c +CSRCS += zblue/port/kernel/sem.c CSRCS += zblue/port/kernel/thread.c -CSRCS += zblue/port/subsys/net/buf.c -CSRCS += zblue/port/common/defines.c - -CSRCS += zblue/lib/os/dec.c -CSRCS += zblue/lib/os/hex.c - -ifeq ($(CONFIG_ARCH_CHIP_R328),y) - CSRCS += zblue/port/chip/xr829/xr829.c - CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)/arch/arm/src/r328/include/drivers - CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)/arch/arm/src/r328/include -endif - -ifeq ($(CONFIG_BT_LIBUSB),y) - CSRCS += zblue/port/drivers/bluetooth/hci/libusb.c -endif +CSRCS += zblue/port/kernel/timeout.c +CSRCS += zblue/port/lib/net_buf/buf.c +CSRCS += zblue/port/lib/os/assert.c +CSRCS += zblue/port/sections/defines.c +CSRCS += zblue/port/subsys/fs/fs.c ifeq ($(CONFIG_BT_H4),y) CSRCS += zblue/port/drivers/bluetooth/hci/h4.c endif -CFLAGS += -Wno-implicit-function-declaration -Wno-unused-but-set-variable -CFLAGS += -Wno-unused-function -Wno-unused-variable -Wno-implicit-int -Wno-shadow -CFLAGS += -Wno-stringop-overread +CFLAGS += -Wno-format-zero-length -Wno-implicit-function-declaration +CFLAGS += -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-variable +CFLAGS += -Wno-format -Wno-pointer-sign -Wno-strict-prototypes -Wno-implicit-int -Wno-shadow +CFLAGS += -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -Wno-undef -CFLAGS += ${INCDIR_PREFIX}zblue/port/include -CFLAGS += ${INCDIR_PREFIX}zblue/subsys/bluetooth -CFLAGS += ${INCDIR_PREFIX}zblue/subsys/bluetooth/host -CFLAGS += ${INCDIR_PREFIX}zblue/subsys/bluetooth/services -CFLAGS += ${INCDIR_PREFIX}zblue/subsys/bluetooth/mesh -CFLAGS += ${INCDIR_PREFIX}zblue/subsys/bluetooth/common +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/port/include} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/port/include/zephyr} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/port/kernel/include} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/subsys/bluetooth} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/subsys/bluetooth/audio} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/subsys/bluetooth/host} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/subsys/bluetooth/mesh} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/subsys/bluetooth/services} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" zblue/subsys/settings/include} +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/crypto/tinycrypt/tinycrypt/lib/include} -ifeq ($(CONFIG_ARCH_SIM),y) - CFLAGS += -O2 -fno-strict-aliasing - CFLAGS += -ffunction-sections -fdata-sections +ifeq ($(CONFIG_BT_SHELL),y) + PROGNAME += zblue + MAINSRC += zblue/port/subsys/shell/shell.c endif ifneq ($(CONFIG_BT_SAMPLE),) - ifneq ($(CONFIG_BT_SAMPLE_PERIPHERAL),) PROGNAME += peripheral - CSRCS += zblue/samples/bluetooth/peripheral/src/cts.c MAINSRC += zblue/samples/bluetooth/peripheral/src/main.c - CFLAGS += ${INCDIR_PREFIX}zblue/samples/bluetooth/peripheral/src - endif + endif ifneq ($(CONFIG_BT_SAMPLE_CENTRAL),) PROGNAME += central MAINSRC += zblue/samples/bluetooth/central/src/main.c endif - ifneq ($(CONFIG_BT_SAMPLE_MESH),) - PROGNAME += btmesh - MAINSRC += zblue/samples/bluetooth/mesh/src/main.c - PROGNAME += mesh_demo - MAINSRC += zblue/samples/bluetooth/mesh_demo/src/main.c - ifneq ($(CONFIG_BT_MESH_PROVISIONER),) - PROGNAME += mesh_provisioner - MAINSRC += zblue/samples/bluetooth/mesh_provisioner/src/main.c - endif + ifneq ($(CONFIG_BT_SAMPLE_HFP_HF),) + PROGNAME += hfp_hf + MAINSRC += zblue/samples/bluetooth/handsfree/src/main.c endif - endif -PROGNAME += zblue -MAINSRC += zblue/port/drivers/bluetooth/hci/hci.c - PRIORITY = SCHED_PRIORITY_DEFAULT ifneq ($(CONFIG_BT_SAMPLE),) STACKSIZE = $(CONFIG_BT_SAMPLE_STACKSIZE) @@ -329,37 +776,75 @@ else MODULE = n endif +ZINC = $(APPDIR)/external/zblue/zblue/include/zephyr +PORTINC= zblue/port/include/zephyr + +SYMLINK_FILES = \ + app_memory/mem_domain.h \ + arch/arch_interface.h \ + arch/common/ffs.h \ + debug/stack.h \ + devicetree/ordinals.h \ + fatal.h \ + fatal_types.h \ + fs/fs.h \ + fs/fs_interface.h \ + irq.h \ + irq_offload.h \ + kernel_includes.h \ + kernel/internal/smp.h \ + kernel/obj_core.h \ + kernel/stats.h \ + kernel/thread_stack.h \ + kernel_version.h \ + linker/sections.h \ + linker/section_tags.h \ + spinlock.h \ + shell/shell_types.h \ + shell/shell_fprintf.h \ + shell/shell_string_conv.h \ + sys/__assert.h \ + sys/atomic.h \ + sys/atomic_c.h \ + sys/atomic_types.h \ + sys/byteorder.h \ + sys/check.h \ + sys/crc.h \ + sys/dlist.h \ + sys/list_gen.h \ + sys/math_extras.h \ + sys/math_extras_impl.h \ + sys/mem_stats.h \ + sys/rb.h \ + sys/sflist.h \ + sys/slist.h \ + sys/sys_heap.h \ + sys/time_units.h \ + sys/util.h \ + sys/util_macro.h \ + sys/util_loops.h \ + sys/util_listify.h \ + tracing/tracing_macros.h \ + types.h + depend:: - $(Q) ln -sf ../../include/bluetooth zblue/port/include/bluetooth - $(Q) ln -sf ../../include/drivers zblue/port/include/drivers - $(Q) ln -sf ../../include/fs zblue/port/include/fs - $(Q) ln -sf ../../include/settings zblue/port/include/settings - $(Q) ln -sf ../../include/power zblue/port/include/power - $(Q) ln -sf ../../include/random zblue/port/include/random - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/bredr.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/bt.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/gatt.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/l2cap.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/mesh.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/rfcomm.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/ticker.c - $(Q) ln -sf shell.c zblue/port/subsys/bluetooth/shell/iso.c + $(Q) ln -sf $(ZINC)/bluetooth $(PORTINC)/bluetooth + $(Q) ln -sf $(ZINC)/drivers $(PORTINC)/drivers + $(Q) ln -sf $(ZINC)/settings $(PORTINC)/settings + $(Q) mkdir -p $(PORTINC)/app_memory + $(Q) mkdir -p $(PORTINC)/debug + $(Q) mkdir -p $(PORTINC)/devicetree + $(Q) mkdir -p $(PORTINC)/fs + $(Q) mkdir -p $(PORTINC)/linker + $(Q) mkdir -p $(PORTINC)/arch/common + $(Q) mkdir -p $(PORTINC)/kernel/internal + $(foreach file,$(SYMLINK_FILES),ln -sf $(ZINC)/$(file) $(PORTINC)/$(file);) clean:: $(call DELFILE, .built) - $(call DELFILE, zblue/port/include/bluetooth) - $(call DELFILE, zblue/port/include/drivers) - $(call DELFILE, zblue/port/include/fs) - $(call DELFILE, zblue/port/include/settings) - $(call DELFILE, zblue/port/include/power) - $(call DELFILE, zblue/port/include/random) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/bredr.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/bt.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/gatt.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/l2cap.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/mesh.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/rfcomm.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/ticker.c) - $(call DELFILE, zblue/port/subsys/bluetooth/shell/iso.c) + $(call DELFILE, $(PORTINC)/bluetooth) + $(call DELFILE, $(PORTINC)/drivers) + $(call DELFILE, $(PORTINC)/settings) + $(foreach file,$(SYMLINK_FILES),$(call DELFILE, $(PORTINC)/$(file))) include $(APPDIR)/Application.mk \ No newline at end of file