diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/README.md b/features/FEATURE_BLE/targets/TARGET_CORDIO/README.md index 82a93bdf7bf..1f1c8a8bed8 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/README.md +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/README.md @@ -21,6 +21,11 @@ implementation. * `cordio_stack`: Headers and sources of the cordio stack * `mbed_os_adaptation`: Headers of the interface responsible for the bridge between BLE API and the Cordio stack. + +## Build time configuration + +Build time configuration may be controlled through options set in: +`features\FEATURE_BLE\targets\TARGET_CORDIO\mbed_lib.json` ## Documentation diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json b/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json new file mode 100644 index 00000000000..cd868d130ab --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json @@ -0,0 +1,58 @@ +{ + "name": "cordio", + "config": { + "max-connections": { + "help": "Maximum number of connections", + "value": 3, + "macro_name": "DM_CONN_MAX" + }, + "max-syncs": { + "help": "Maximum number of periodic advertising synchronizations", + "value": 1, + "macro_name": "DM_SYNC_MAX" + }, + "max-advertising-sets": { + "help": "Number of supported advertising sets: must be set to 1 for legacy advertising", + "value": 3, + "macro_name": "DM_NUM_ADV_SETS" + }, + "max-phys": { + "help": "Number of scanner and initiator PHYs (LE 1M, LE 2M and LE Coded): must be set to 1 for legacy scanner and initiator", + "value": 3, + "macro_name": "DM_NUM_PHYS" + }, + "max-l2cap-channels": { + "help": "Maximum number of connection oriented channels", + "value": 8, + "macro_name": "L2C_COC_CHAN_MAX" + }, + "max-l2cap-clients": { + "help": "Maximum number of connection oriented channel registered clients", + "value": 4, + "macro_name": "L2C_COC_REG_MAX" + }, + "max-att-writes": { + "help": "Maximum number of simultaneous ATT write commands", + "value": 1, + "macro_name": "ATT_NUM_SIMUL_WRITE_CMD" + }, + "max-att-notifications": { + "help": "Maximum number of simultaneous ATT notifications", + "value": 1, + "macro_name": "ATT_NUM_SIMUL_NTF" + }, + "max-smp-devices": { + "help": "Max number of devices in the security database", + "value": 3, + "macro_name": "SMP_DB_MAX_DEVICES" + }, + "desired-att-mtu": { + "help": "Desired ATT_MTU, this needs to be between 23 and 517 (inclusive).", + "value": 23 + }, + "max-prepared-writes": { + "help": "Number of queued prepare writes supported by server.", + "value": 4 + } + } +} \ No newline at end of file diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c index 78a756b753c..572405d0a9d 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c @@ -62,13 +62,17 @@ l2cCfg_t *pL2cCfg = &l2cCfg; ATT **************************************************************************************************/ +#if MBED_CONF_CORDIO_DESIRED_ATT_MTU < ATT_DEFAULT_MTU || MBED_CONF_CORDIO_DESIRED_ATT_MTU > ATT_MAX_MTU +#error "CORDIO_CFG_DESIRED_ATT_MTU value is outside valid range" +#endif + /* Configuration structure */ attCfg_t attCfg = { - 15, /* ATT server service discovery connection idle timeout in seconds */ - ATT_DEFAULT_MTU, /* desired ATT MTU */ - ATT_MAX_TRANS_TIMEOUT, /* transcation timeout in seconds */ - 4 /* number of queued prepare writes supported by server */ + 15, /* ATT server service discovery connection idle timeout in seconds */ + MBED_CONF_CORDIO_DESIRED_ATT_MTU, /* desired ATT MTU */ + ATT_MAX_TRANS_TIMEOUT, /* transaction timeout in seconds */ + MBED_CONF_CORDIO_MAX_PREPARED_WRITES /* number of queued prepare writes supported by server */ }; /* Configuration pointer */