mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(nimble): Add support for minimilistic builds
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/*** The UUID of the service containing the subscribable characteristic ***/
|
||||
static const ble_uuid_t * remote_svc_uuid =
|
||||
BLE_UUID128_DECLARE(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
|
||||
@@ -62,6 +63,7 @@ static const ble_uuid_t * remote_svc_uuid =
|
||||
static const ble_uuid_t * remote_chr_uuid =
|
||||
BLE_UUID128_DECLARE(0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,
|
||||
0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x33);
|
||||
#endif
|
||||
|
||||
static const char *tag = "NimBLE_BLE_CENT";
|
||||
static int blecent_gap_event(struct ble_gap_event *event, void *arg);
|
||||
@@ -73,6 +75,7 @@ static uint16_t bearers;
|
||||
|
||||
void ble_store_config_init(void);
|
||||
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/**
|
||||
* Application Callback. Called when the custom subscribable chatacteristic
|
||||
* in the remote GATT server is read.
|
||||
@@ -430,6 +433,7 @@ blecent_on_disc_complete(const struct peer *peer, int status, void *arg)
|
||||
*/
|
||||
blecent_read_write_subscribe(peer);
|
||||
}
|
||||
#endif //MYNEWT_VAL(BLE_GATTC)
|
||||
|
||||
/**
|
||||
* Initiates the GAP general discovery procedure.
|
||||
@@ -782,6 +786,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(INFO, "Connection secured\n");
|
||||
}
|
||||
#else
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/* Perform service discovery */
|
||||
rc = peer_disc_all(event->connect.conn_handle,
|
||||
blecent_on_disc_complete, NULL);
|
||||
@@ -789,6 +794,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
/* Connection attempt failed; resume scanning. */
|
||||
@@ -833,7 +839,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
assert(rc == 0);
|
||||
print_conn_desc(&desc);
|
||||
#if !MYNEWT_VAL(BLE_EATT_CHAN_NUM)
|
||||
#if CONFIG_EXAMPLE_ENCRYPTION
|
||||
#if CONFIG_EXAMPLE_ENCRYPTION && MYNEWT_VAL(BLE_GATTC)
|
||||
/*** Go for service discovery after encryption has been successfully enabled ***/
|
||||
rc = peer_disc_all(event->enc_change.conn_handle,
|
||||
blecent_on_disc_complete, NULL);
|
||||
@@ -949,7 +955,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(INFO, "Cannot set default EATT bearer, rc = %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/* Perform service discovery */
|
||||
rc = peer_disc_all(event->eatt.conn_handle,
|
||||
blecent_on_disc_complete, NULL);
|
||||
@@ -957,6 +963,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
default:
|
||||
@@ -1062,9 +1069,12 @@ app_main(void)
|
||||
rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64);
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("nimble-blecent");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
/* XXX Need to have template for store */
|
||||
ble_store_config_init();
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
# Override some defaults so BT stack is enabled
|
||||
# in this example
|
||||
|
||||
#
|
||||
# BT config
|
||||
#
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
|
||||
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
|
||||
CONFIG_BTDM_CTRL_MODE_BTDM=n
|
||||
CONFIG_BT_BLUEDROID_ENABLED=n
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1
|
||||
CONFIG_BT_NIMBLE_MAX_BONDS=1
|
||||
CONFIG_BT_NIMBLE_MAX_CCCDS=1
|
||||
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n
|
||||
CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n
|
||||
CONFIG_BT_NIMBLE_SM_SC=n
|
||||
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n
|
||||
CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n
|
||||
CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT=6
|
||||
CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT=12
|
||||
CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=12
|
||||
CONFIG_BT_NIMBLE_TRANSPORT_EVT_COUNT=15
|
||||
CONFIG_BT_NIMBLE_ATT_MAX_PREP_ENTRIES=15
|
||||
CONFIG_BT_NIMBLE_GATT_SERVER=n
|
||||
CONFIG_BT_NIMBLE_PRINT_ERR_NAME=n
|
||||
CONFIG_BT_ALARM_MAX_NUM=15
|
||||
|
||||
CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=23
|
||||
CONFIG_PM_ENABLE=n
|
||||
CONFIG_HEAP_POISONING_DISABLED=y
|
||||
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
|
||||
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||
|
||||
CONFIG_VFS_SUPPORT_TERMIOS=n
|
||||
CONFIG_VFS_SUPPORT_DIR=n
|
||||
CONFIG_VFS_SUPPORT_IO=n
|
||||
CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=3152
|
||||
|
||||
# FreeRTOS
|
||||
CONFIG_FREERTOS_HZ=100
|
||||
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024
|
||||
CONFIG_FREERTOS_ISR_STACKSIZE=1024
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048
|
||||
|
||||
# C Library
|
||||
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
|
||||
CONFIG_LIBC_STDIN_LINE_ENDING_CRLF=n
|
||||
CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF=n
|
||||
|
||||
# Optimization
|
||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y
|
||||
CONFIG_COMPILER_CXX_EXCEPTIONS=n
|
||||
|
||||
# Heap
|
||||
CONFIG_HEAP_POISONING_DISABLED=y
|
||||
CONFIG_HEAP_TRACING=n
|
||||
|
||||
# Power Management
|
||||
CONFIG_PM_ENABLE=n
|
||||
|
||||
# No networking
|
||||
CONFIG_ESP_WIFI_ENABLED=n
|
||||
|
||||
# Application
|
||||
CONFIG_APP_COMPILE_TIME_DATE=n
|
||||
|
||||
|
||||
CONFIG_ESP_COEX_SW_COEXIST_ENABLE=n
|
||||
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
|
||||
CONFIG_SPI_MASTER_ISR_IN_IRAM=n
|
||||
CONFIG_SPI_SLAVE_ISR_IN_IRAM=n
|
||||
CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=n
|
||||
CONFIG_ESP_NETIF_REPORT_DATA_TRAFFIC=n
|
||||
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=n
|
||||
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=n
|
||||
CONFIG_SPI_FLASH_YIELD_DURING_ERASE=n
|
||||
CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=n
|
||||
|
||||
#Uncomment below, if security needs to be disabled
|
||||
#CONFIG_BT_NIMBLE_SECURITY_ENABLE=n
|
||||
|
||||
|
||||
#Uncomment below, if logging needs to be disabled
|
||||
#CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||
#CONFIG_LOG_DEFAULT_LEVEL=0
|
||||
|
||||
#
|
||||
# Controller Options
|
||||
#
|
||||
|
||||
CONFIG_BT_CTRL_BLE_MAX_ACT=2
|
||||
CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=1
|
||||
CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=n
|
||||
CONFIG_BT_CTRL_BLE_SCAN_DUPL=n
|
||||
Reference in New Issue
Block a user