Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the NimBLE stack from the esp-nimble fork to the mainline Mynewt-NimBLE v1.9.0. This simplifies maintenance by pulling from the upstream repo directly while incorporating ESP device support, and enables access to more recent NimBLE features and important updates.
Changes:
- Updates NimBLE core to v1.9.0 with new features (Channel Sounding stubs, ISO improvements, ADV coding selection, periodic ADV ADI support, scan configuration VS commands)
- Removes ESP-specific fork files (ble_esp_hs.h, ble_esp_gap.h, ble_esp_gatt.h) and refactors platform guards (
#ifndef ESP_PLATFORMmoved before license headers) - Refactors include paths from angle brackets to quotes, removes deprecated APIs, and fixes several bugs (IRK list indexing, scheduler null check, scan request PDU generation)
Reviewed changes
Copilot reviewed 122 out of 287 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/nimble/RELEASE_NOTES.md, NOTICE, LICENSE | Updated to NimBLE v1.9.0 release info |
| src/nimble/nimble/host/include/host/ble_hs.h | Removed ESP-specific includes and config fields (sm_sc_only, eatt) |
| src/nimble/nimble/host/include/host/ble_sm.h | Added comprehensive doxygen documentation, reordered OOB fields |
| src/nimble/nimble/host/include/host/ble_l2cap.h | Added COC CID range defines and ble_l2cap_remove_server |
| src/nimble/nimble/host/include/host/ble_att.h | Reorganized ATT opcodes, added new error codes, removed EATT-specific APIs |
| src/nimble/nimble/host/include/host/ble_hs_hci.h | Renamed ble_hs_hci_util_rand to ble_hs_hci_rand |
| src/nimble/nimble/host/include/host/ble_hs_log.h | Switched to NPL-based logging |
| src/nimble/nimble/host/include/host/ble_cs.h | New Channel Sounding host header |
| src/nimble/nimble/host/include/host/ble_eddystone.h | Added documentation comments, renamed parameter |
| src/nimble/nimble/host/include/host/ble_uuid.h | Added BLE_UUID128_INIT docs, reformatted comments |
| src/nimble/nimble/host/include/host/ble_aes_ccm.h | Removed duplicate/unnecessary tinycrypt include |
| Mesh headers (model_srv/cli, mesh, heartbeat, health, cfg, cdb, atomic) | Removed mesh include files |
| src/nimble/nimble/controller/include/controller/ble_ll.h | Extended feature bits, replaced BLE_LL_BT5_PHY_SUPPORTED macro |
| src/nimble/nimble/controller/include/controller/ble_ll_conn.h | Added encrypt_paused, conn_update_host_initd flags, renamed anchor API |
| src/nimble/nimble/controller/include/controller/ble_ll_scan.h | Added VS scan config, refactored scan NRPA, added make_req_pdu |
| src/nimble/nimble/controller/include/controller/ble_ll_iso.h | Major refactor with ble_ll_iso_conn struct and new APIs |
| src/nimble/nimble/controller/include/controller/ble_ll_isoal.h | Added framed PDU support, mux improvements |
| src/nimble/nimble/controller/include/controller/ble_ll_cs.h | New Channel Sounding controller header |
| src/nimble/nimble/controller/include/controller/ble_ll_sched.h | Updated iso_big signature with fixed param |
| src/nimble/nimble/controller/include/controller/ble_ll_sync.h | Changed periodic_ind API from bool to uint8_t mode |
| src/nimble/nimble/controller/include/controller/ble_ll_ctrl.h | Removed data param from ctrl_proc_start, updated enc_allowed |
| src/nimble/nimble/controller/include/controller/ble_ll_adv.h | Renamed rmvd callback, added v2 param API |
| src/nimble/nimble/controller/include/controller/ble_ll_resolv.h | Added local IRK APIs |
| src/nimble/nimble/controller/src/*.c | Platform guard refactoring, bug fixes, new features |
| src/nimble/nimble/drivers/nrf5x/, nrf51/ | Platform guard refactoring, NRF53 removal, bug fixes |
| src/nimble/ext/tinycrypt/** | Include path changes to quotes, removed metadata files |
| src/nimble/esp_port/** | Include path fixes, added extern declarations |
| src/NimBLEUtils.cpp | Added #ifdef guards for potentially removed GAP events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** Read Multiple Variable Lenght Request */ | ||
| #define BLE_ATT_OP_READ_MULT_VAR_REQ 0x20 | ||
|
|
||
| /** Read Multiple Variable Lenght Response */ |
There was a problem hiding this comment.
The word 'Lenght' should be 'Length' in both the request and response comments.
| /** Read Multiple Variable Lenght Request */ | |
| #define BLE_ATT_OP_READ_MULT_VAR_REQ 0x20 | |
| /** Read Multiple Variable Lenght Response */ | |
| /** Read Multiple Variable Length Request */ | |
| #define BLE_ATT_OP_READ_MULT_VAR_REQ 0x20 | |
| /** Read Multiple Variable Length Response */ |
| #define BLE_ATT_ERR_WRITE_REQ_REJECTED 0xFC | ||
|
|
||
| /**Client Characteristic Configuration Descriptor Improperly Configured. */ | ||
| #define BLE_ATT_ERR_CCCD_IMPORER_CONF 0xFD |
There was a problem hiding this comment.
The macro name BLE_ATT_ERR_CCCD_IMPORER_CONF contains a typo. It should be BLE_ATT_ERR_CCCD_IMPROPER_CONF.
| #define BLE_ATT_ERR_CCCD_IMPORER_CONF 0xFD | |
| #define BLE_ATT_ERR_CCCD_IMPROPER_CONF 0xFD | |
| #define BLE_ATT_ERR_CCCD_IMPORER_CONF BLE_ATT_ERR_CCCD_IMPROPER_CONF |
| * LTK and decrypt SIRK | ||
| * | ||
| * @return 0 if RSI was resolved succesfully; nonzero on failure. |
There was a problem hiding this comment.
'succesfully' should be 'successfully'.
| * LTK and decrypt SIRK | |
| * | |
| * @return 0 if RSI was resolved succesfully; nonzero on failure. | |
| * otherwise peer address should be passed here to get | |
| * LTK and decrypt SIRK | |
| * | |
| * @return 0 if RSI was resolved successfully; nonzero on failure. |
| #define BLE_ATT_OP_READ_MULT_VAR_RSP 0x21 | ||
|
|
||
| /** Notify Multiple Request */ | ||
| #define BLE_ATT_OP_NOTIFY_MULTI_REQ 0x23 |
There was a problem hiding this comment.
There is a missing blank line between BLE_ATT_OP_NOTIFY_MULTI_REQ and the /** Write Command. */ comment. Other opcode definitions in this file are separated by blank lines for readability.
| #define BLE_ATT_OP_NOTIFY_MULTI_REQ 0x23 | |
| #define BLE_ATT_OP_NOTIFY_MULTI_REQ 0x23 |
|
|
||
| /* there should be no ADI in Sync or chain, skip it */ | ||
| if (ext_hdr_flags & (1 << BLE_LL_EXT_ADV_DATA_INFO_BIT)) { | ||
| if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_ADI_SUPPORT) { |
There was a problem hiding this comment.
The if on line 598 is missing parentheses around the condition. It should be if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_ADI_SUPPORT)) to follow C syntax correctly. While some compilers may accept this as a macro expansion, it's incorrect C syntax and can cause unexpected behavior with certain preprocessor configurations.
| if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_ADI_SUPPORT) { | |
| if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_ADI_SUPPORT)) { |
| uint8_t status; | ||
| } procedure_complete; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Line 38 has trailing whitespace.
| ev->data[len] = 0; | ||
| hci_ev->length += len + 1; |
There was a problem hiding this comment.
vsnprintf returns the number of characters that would have been written if the buffer were large enough, which can exceed the actual buffer size. If the formatted string exceeds BLE_HCI_MAX_DATA_LEN - sizeof(*ev), then len will be larger than the available buffer space, and ev->data[len] = 0 will write out of bounds. You should clamp len to BLE_HCI_MAX_DATA_LEN - sizeof(*ev) - 1 before using it.
| * Initialized once per LE Connection. | ||
| */ | ||
| uint8_t nonce_v[16]; | ||
| /* Cache bits generated with single DRBG transation */ |
There was a problem hiding this comment.
'transation' should be 'transaction'.
| /* Cache bits generated with single DRBG transation */ | |
| /* Cache bits generated with single DRBG transaction */ |
| #endif | ||
| #if MYNEWT_VAL(BLE_LL_HCI_VS_SET_SCAN_CFG) | ||
| BLE_LL_HCI_VS_CMD(BLE_HCI_OCF_VS_SET_SCAN_CFG, | ||
| ble_ll_hci_vs_set_scan_cfg) |
There was a problem hiding this comment.
The BLE_LL_HCI_VS_CMD entry for BLE_HCI_OCF_VS_SET_SCAN_CFG is missing a trailing comma. If BLE_LL_HCI_VS_SET_SCAN_CFG is enabled, this will cause a compilation error because subsequent array entries (if any) or the closing brace won't parse correctly. If this is the last entry in the array, it may compile but is inconsistent with the other entries that have trailing commas.
| ble_ll_hci_vs_set_scan_cfg) | |
| ble_ll_hci_vs_set_scan_cfg), |
| #endif /* if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) */ | ||
| #endif | ||
|
|
||
|
|
There was a problem hiding this comment.
There is a double blank line before the closing #endif. One blank line would be sufficient.
802cb8d to
85d2262
Compare
This will update to the mainline Mynewt-nimble repo and pull in esp device support from the esp-nimble fork. Doing this allows for simplified maintenance and avoids having too much additional/unsupported upstream changes. This also allows for using more recent NimBLE versions and being able to pull in important updates that are not in esp-nimble.
This will update to the mainline Mynewt-nimble repo and pull in esp device support from the esp-nimble fork. Doing this allows for simplified maintenance and avoids having too much additional/unsupported upstream changes.
This also allows for using more recent NimBLE versions and being able to pull in important updates that are not in esp-nimble.