Skip to content

Commit d0881ad

Browse files
author
Cruz Monrreal
authored
Merge pull request #9813 from paul-szczepanek-arm/cordio-cfg
BLE: Cordio build time configuration through mbed_lib.json
2 parents 051cc49 + f62217b commit d0881ad

File tree

3 files changed

+71
-4
lines changed

3 files changed

+71
-4
lines changed

features/FEATURE_BLE/targets/TARGET_CORDIO/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ implementation.
2121
* `cordio_stack`: Headers and sources of the cordio stack
2222
* `mbed_os_adaptation`: Headers of the interface responsible for the bridge
2323
between BLE API and the Cordio stack.
24+
25+
## Build time configuration
26+
27+
Build time configuration may be controlled through options set in:
28+
`features\FEATURE_BLE\targets\TARGET_CORDIO\mbed_lib.json`
2429

2530
## Documentation
2631

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "cordio",
3+
"config": {
4+
"max-connections": {
5+
"help": "Maximum number of connections",
6+
"value": 3,
7+
"macro_name": "DM_CONN_MAX"
8+
},
9+
"max-syncs": {
10+
"help": "Maximum number of periodic advertising synchronizations",
11+
"value": 1,
12+
"macro_name": "DM_SYNC_MAX"
13+
},
14+
"max-advertising-sets": {
15+
"help": "Number of supported advertising sets: must be set to 1 for legacy advertising",
16+
"value": 3,
17+
"macro_name": "DM_NUM_ADV_SETS"
18+
},
19+
"max-phys": {
20+
"help": "Number of scanner and initiator PHYs (LE 1M, LE 2M and LE Coded): must be set to 1 for legacy scanner and initiator",
21+
"value": 3,
22+
"macro_name": "DM_NUM_PHYS"
23+
},
24+
"max-l2cap-channels": {
25+
"help": "Maximum number of connection oriented channels",
26+
"value": 8,
27+
"macro_name": "L2C_COC_CHAN_MAX"
28+
},
29+
"max-l2cap-clients": {
30+
"help": "Maximum number of connection oriented channel registered clients",
31+
"value": 4,
32+
"macro_name": "L2C_COC_REG_MAX"
33+
},
34+
"max-att-writes": {
35+
"help": "Maximum number of simultaneous ATT write commands",
36+
"value": 1,
37+
"macro_name": "ATT_NUM_SIMUL_WRITE_CMD"
38+
},
39+
"max-att-notifications": {
40+
"help": "Maximum number of simultaneous ATT notifications",
41+
"value": 1,
42+
"macro_name": "ATT_NUM_SIMUL_NTF"
43+
},
44+
"max-smp-devices": {
45+
"help": "Max number of devices in the security database",
46+
"value": 3,
47+
"macro_name": "SMP_DB_MAX_DEVICES"
48+
},
49+
"desired-att-mtu": {
50+
"help": "Desired ATT_MTU, this needs to be between 23 and 517 (inclusive).",
51+
"value": 23
52+
},
53+
"max-prepared-writes": {
54+
"help": "Number of queued prepare writes supported by server.",
55+
"value": 4
56+
}
57+
}
58+
}

features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ l2cCfg_t *pL2cCfg = &l2cCfg;
6262
ATT
6363
**************************************************************************************************/
6464

65+
#if MBED_CONF_CORDIO_DESIRED_ATT_MTU < ATT_DEFAULT_MTU || MBED_CONF_CORDIO_DESIRED_ATT_MTU > ATT_MAX_MTU
66+
#error "CORDIO_CFG_DESIRED_ATT_MTU value is outside valid range"
67+
#endif
68+
6569
/* Configuration structure */
6670
attCfg_t attCfg =
6771
{
68-
15, /* ATT server service discovery connection idle timeout in seconds */
69-
ATT_DEFAULT_MTU, /* desired ATT MTU */
70-
ATT_MAX_TRANS_TIMEOUT, /* transcation timeout in seconds */
71-
4 /* number of queued prepare writes supported by server */
72+
15, /* ATT server service discovery connection idle timeout in seconds */
73+
MBED_CONF_CORDIO_DESIRED_ATT_MTU, /* desired ATT MTU */
74+
ATT_MAX_TRANS_TIMEOUT, /* transaction timeout in seconds */
75+
MBED_CONF_CORDIO_MAX_PREPARED_WRITES /* number of queued prepare writes supported by server */
7276
};
7377

7478
/* Configuration pointer */

0 commit comments

Comments
 (0)