From 9898fed80634c99c9dbe8ee8682dfdc259463654 Mon Sep 17 00:00:00 2001 From: JF Date: Tue, 16 Jun 2020 20:36:24 +0200 Subject: [PATCH 1/8] Update to nimble 1.3.0 + WIP : debug BLE connection issue with android phones. --- src/CMakeLists.txt | 1 + .../Ble/AlertNotificationService.cpp | 8 +- src/Components/Ble/CurrentTimeService.cpp | 8 +- .../Ble/DeviceInformationService.cpp | 8 +- src/Components/Ble/DfuService.cpp | 8 +- src/Components/Ble/NimbleController.cpp | 4 +- src/SystemTask/SystemTask.cpp | 4 +- src/drivers/InternalFlash.cpp | 2 +- src/libs/mynewt-nimble/apps/btshell/src/cmd.c | 14 - .../controller/include/controller/ble_ll.h | 3 - .../nimble/controller/src/ble_ll.c | 1 + .../nimble/controller/src/ble_ll_adv.c | 14 +- .../nimble/controller/src/ble_ll_scan.c | 6 +- .../nimble/drivers/nrf52/src/ble_phy.c | 1 + .../nimble/host/include/host/ble_gap.h | 14 - .../host/pts/tpg/94654-20170317-085122560.tpg | 4 +- .../host/pts/tpg/94654-20170317-085441153.pts | 2 +- .../mynewt-nimble/nimble/host/src/ble_gap.c | 85 +- .../nimble/host/src/ble_gap_priv.h | 1 - .../mynewt-nimble/nimble/host/src/ble_hs.c | 11 +- .../nimble/host/src/ble_hs_conn.c | 9 - .../nimble/host/src/ble_l2cap_coc.c | 6 +- .../nimble/host/src/ble_monitor.c | 25 +- .../nimble/host/src/ble_sm_alg.c | 2 + .../nimble/host/src/ble_store_util.c | 14 +- .../nimble/host/test/src/ble_gap_test.c | 67 + .../transport/socket/src/ble_hci_socket.c | 2 +- .../porting/nimble/include/syscfg/syscfg.h | 1477 +++++++---------- .../npl/freertos/src/npl_os_freertos.c | 1 + src/main.cpp | 1 + src/sdk_config.h | 8 +- 31 files changed, 768 insertions(+), 1043 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 286a792a..5fe46148 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -132,6 +132,7 @@ set(NIMBLE_SRC libs/mynewt-nimble/nimble/host/src/ble_hs_stop.c libs/mynewt-nimble/nimble/host/src/ble_hs_startup.c libs/mynewt-nimble/nimble/host/store/ram/src/ble_store_ram.c + libs/mynewt-nimble/nimble/host/src/ble_monitor.c libs/mynewt-nimble/nimble/transport/ram/src/ble_hci_ram.c libs/mynewt-nimble/nimble/controller/src/ble_ll.c libs/mynewt-nimble/nimble/controller/src/ble_ll_rand.c diff --git a/src/Components/Ble/AlertNotificationService.cpp b/src/Components/Ble/AlertNotificationService.cpp index 8e3b712d..fd69bda3 100644 --- a/src/Components/Ble/AlertNotificationService.cpp +++ b/src/Components/Ble/AlertNotificationService.cpp @@ -17,8 +17,12 @@ int AlertNotificationCallback(uint16_t conn_handle, uint16_t attr_handle, struct } void AlertNotificationService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } AlertNotificationService::AlertNotificationService ( Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager ) : m_systemTask{systemTask}, m_notificationManager{notificationManager}, diff --git a/src/Components/Ble/CurrentTimeService.cpp b/src/Components/Ble/CurrentTimeService.cpp index 9ae4c3b8..80ad9c25 100644 --- a/src/Components/Ble/CurrentTimeService.cpp +++ b/src/Components/Ble/CurrentTimeService.cpp @@ -13,8 +13,12 @@ int CTSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_acce } void CurrentTimeService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } diff --git a/src/Components/Ble/DeviceInformationService.cpp b/src/Components/Ble/DeviceInformationService.cpp index 3099b1bf..c1d55541 100644 --- a/src/Components/Ble/DeviceInformationService.cpp +++ b/src/Components/Ble/DeviceInformationService.cpp @@ -15,8 +15,12 @@ int DeviceInformationCallback(uint16_t conn_handle, uint16_t attr_handle, struct } void DeviceInformationService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } diff --git a/src/Components/Ble/DfuService.cpp b/src/Components/Ble/DfuService.cpp index ff899e6f..c6d8493f 100644 --- a/src/Components/Ble/DfuService.cpp +++ b/src/Components/Ble/DfuService.cpp @@ -74,8 +74,12 @@ DfuService::DfuService(Pinetime::System::SystemTask &systemTask, Pinetime::Contr } void DfuService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context) { diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp index 561dbce4..8c4675b7 100644 --- a/src/Components/Ble/NimbleController.cpp +++ b/src/Components/Ble/NimbleController.cpp @@ -180,8 +180,8 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { StartAdvertising(); bleController.Disconnect(); } else { - bleController.Connect(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); + //bleController.Connect(); + //systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); connectionHandle = event->connect.conn_handle; // Service discovery is deffered via systemtask } diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp index 61b3c638..df08c07f 100644 --- a/src/SystemTask/SystemTask.cpp +++ b/src/SystemTask/SystemTask.cpp @@ -48,8 +48,8 @@ void SystemTask::Process(void *instance) { } void SystemTask::Work() { - watchdog.Setup(7); - watchdog.Start(); + //watchdog.Setup(7); + //watchdog.Start(); NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); APP_GPIOTE_INIT(2); diff --git a/src/drivers/InternalFlash.cpp b/src/drivers/InternalFlash.cpp index bc89ff1a..db705d78 100644 --- a/src/drivers/InternalFlash.cpp +++ b/src/drivers/InternalFlash.cpp @@ -1,4 +1,4 @@ -#include +#include #include "InternalFlash.h" using namespace Pinetime::Drivers; diff --git a/src/libs/mynewt-nimble/apps/btshell/src/cmd.c b/src/libs/mynewt-nimble/apps/btshell/src/cmd.c index 8a878756..2713443e 100644 --- a/src/libs/mynewt-nimble/apps/btshell/src/cmd.c +++ b/src/libs/mynewt-nimble/apps/btshell/src/cmd.c @@ -2691,25 +2691,12 @@ cmd_security_unpair(int argc, char **argv) { ble_addr_t peer; int rc; - int oldest; rc = parse_arg_all(argc - 1, argv + 1); if (rc != 0) { return rc; } - rc = parse_arg_bool_dflt("oldest", 0, &oldest); - if (rc != 0) { - console_printf("invalid 'oldest' parameter\n"); - return rc; - } - - if (oldest) { - rc = ble_gap_unpair_oldest_peer(); - console_printf("Unpair oldest status: 0x%02x\n", rc); - return 0; - } - rc = parse_dev_addr("peer_", cmd_peer_addr_types, &peer); if (rc != 0) { console_printf("invalid 'peer_addr' parameter\n"); @@ -2727,7 +2714,6 @@ cmd_security_unpair(int argc, char **argv) #if MYNEWT_VAL(SHELL_CMD_HELP) static const struct shell_param security_unpair_params[] = { - {"oldest", "usage: =[true|false], default: false"}, {"peer_addr_type", "usage: =[public|random|public_id|random_id], default: public"}, {"peer_addr", "usage: =[XX:XX:XX:XX:XX:XX]"}, {NULL, NULL} diff --git a/src/libs/mynewt-nimble/nimble/controller/include/controller/ble_ll.h b/src/libs/mynewt-nimble/nimble/controller/include/controller/ble_ll.h index e515fb98..d3340445 100644 --- a/src/libs/mynewt-nimble/nimble/controller/include/controller/ble_ll.h +++ b/src/libs/mynewt-nimble/nimble/controller/include/controller/ble_ll.h @@ -546,9 +546,6 @@ int ble_ll_rand_data_get(uint8_t *buf, uint8_t len); void ble_ll_rand_prand_get(uint8_t *prand); int ble_ll_rand_start(void); -// TODO added by JF, don't know why I need this? -void ble_ll_task(void *arg); - static inline int ble_ll_get_addr_type(uint8_t txrxflag) { diff --git a/src/libs/mynewt-nimble/nimble/controller/src/ble_ll.c b/src/libs/mynewt-nimble/nimble/controller/src/ble_ll.c index 996ad9c3..da5d2972 100644 --- a/src/libs/mynewt-nimble/nimble/controller/src/ble_ll.c +++ b/src/libs/mynewt-nimble/nimble/controller/src/ble_ll.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "sysinit/sysinit.h" #include "syscfg/syscfg.h" #include "os/os.h" diff --git a/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_adv.c b/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_adv.c index 8b661f8c..4ffbe206 100644 --- a/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_adv.c +++ b/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_adv.c @@ -131,7 +131,6 @@ struct ble_ll_adv_sm uint8_t aux_index : 1; uint8_t aux_first_pdu : 1; uint8_t aux_not_scanned : 1; - uint8_t aux_dropped : 1; struct ble_mbuf_hdr *rx_ble_hdr; struct os_mbuf **aux_data; struct ble_ll_adv_aux aux[2]; @@ -1270,7 +1269,7 @@ ble_ll_adv_secondary_tx_start_cb(struct ble_ll_sched_item *sch) rc = ble_phy_tx_set_start_time(txstart, sch->remainder); if (rc) { STATS_INC(ble_ll_stats, adv_late_starts); - goto adv_aux_dropped; + goto adv_tx_done; } #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) @@ -1305,7 +1304,7 @@ ble_ll_adv_secondary_tx_start_cb(struct ble_ll_sched_item *sch) /* Transmit advertisement */ rc = ble_phy_tx(pducb, advsm, end_trans); if (rc) { - goto adv_aux_dropped; + goto adv_tx_done; } /* Enable/disable whitelisting based on filter policy */ @@ -1323,8 +1322,7 @@ ble_ll_adv_secondary_tx_start_cb(struct ble_ll_sched_item *sch) return BLE_LL_SCHED_STATE_RUNNING; -adv_aux_dropped: - advsm->aux_dropped = 1; +adv_tx_done: ble_ll_adv_tx_done(advsm); return BLE_LL_SCHED_STATE_DONE; } @@ -1556,7 +1554,6 @@ ble_ll_adv_aux_schedule_first(struct ble_ll_adv_sm *advsm) advsm->aux_index = 0; advsm->aux_first_pdu = 1; advsm->aux_not_scanned = 0; - advsm->aux_dropped = 0; aux = AUX_CURRENT(advsm); ble_ll_adv_aux_calculate(advsm, aux, 0); @@ -4839,11 +4836,6 @@ ble_ll_adv_sec_done(struct ble_ll_adv_sm *advsm) /* We don't need RF anymore */ ble_ll_rfmgmt_release(); - if (advsm->aux_dropped) { - ble_ll_adv_drop_event(advsm); - return; - } - if (advsm->aux_not_scanned) { ble_ll_sched_rmv_elem(&aux_next->sch); } diff --git a/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_scan.c b/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_scan.c index 2e93ba23..84747db7 100644 --- a/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_scan.c +++ b/src/libs/mynewt-nimble/nimble/controller/src/ble_ll_scan.c @@ -617,7 +617,7 @@ ble_ll_scan_add_scan_rsp_adv(uint8_t *addr, uint8_t txadd, static int ble_ll_hci_send_legacy_ext_adv_report(uint8_t evtype, const uint8_t *addr, uint8_t addr_type, - int8_t rssi, + uint8_t rssi, uint8_t adv_data_len, struct os_mbuf *adv_data, const uint8_t *inita, uint8_t inita_type) @@ -1991,10 +1991,10 @@ ble_ll_scan_rx_filter(struct ble_mbuf_hdr *hdr, struct ble_ll_scan_addr_data *ad { struct ble_ll_scan_sm *scansm = &g_ble_ll_scan_sm; struct ble_ll_scan_params *scanp = scansm->scanp; -#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV) struct ble_ll_aux_data *aux_data = hdr->rxinfo.user_data; #endif +#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) struct ble_mbuf_hdr_rxinfo *rxinfo = &hdr->rxinfo; struct ble_ll_resolv_entry *rl = NULL; #endif @@ -2227,7 +2227,6 @@ ble_ll_scan_rx_isr_on_aux(uint8_t pdu_type, uint8_t *rxbuf, */ if (aux_data->flags & BLE_LL_AUX_IS_MATCHED) { rxinfo->flags |= BLE_MBUF_HDR_F_DEVMATCH; -#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) rxinfo->rpa_index = aux_data->rpa_index; if (rxinfo->rpa_index >= 0) { rxinfo->flags |= BLE_MBUF_HDR_F_RESOLVED; @@ -2235,7 +2234,6 @@ ble_ll_scan_rx_isr_on_aux(uint8_t pdu_type, uint8_t *rxbuf, if (aux_data->flags & BLE_LL_AUX_IS_TARGETA_RESOLVED) { rxinfo->flags |= BLE_MBUF_HDR_F_TARGETA_RESOLVED; } -#endif goto done; } diff --git a/src/libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_phy.c b/src/libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_phy.c index 2f6ce08e..83730a44 100644 --- a/src/libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_phy.c +++ b/src/libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_phy.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "syscfg/syscfg.h" #include "os/os.h" #include "ble/xcvr.h" diff --git a/src/libs/mynewt-nimble/nimble/host/include/host/ble_gap.h b/src/libs/mynewt-nimble/nimble/host/include/host/ble_gap.h index b58f350f..20e7dab7 100644 --- a/src/libs/mynewt-nimble/nimble/host/include/host/ble_gap.h +++ b/src/libs/mynewt-nimble/nimble/host/include/host/ble_gap.h @@ -1896,20 +1896,6 @@ int ble_gap_unpair(const ble_addr_t *peer_addr); */ int ble_gap_unpair_oldest_peer(void); -/** - * Similar to `ble_gap_unpair_oldest_peer()`, except it makes sure that the - * peer received in input parameters is not deleted. - * - * @param peer_addr Address of the peer (not to be deleted) - * - * @return 0 on success; - * A BLE host HCI return code if the controller - * rejected the request; - * A BLE host core return code on unexpected - * error. - */ -int ble_gap_unpair_oldest_except(const ble_addr_t *peer_addr); - #define BLE_GAP_PRIVATE_MODE_NETWORK 0 #define BLE_GAP_PRIVATE_MODE_DEVICE 1 diff --git a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg index 3cc985fa..f5bb0ce9 100644 --- a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg +++ b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg @@ -1,4 +1,4 @@ - + M'&/JP\$+#X83?)"[ M2E=\N*7*U 5)JSKT(5#=>@^/#]IP*[GTZ0%0]$F(/$ MEK[V7>349??;!JZJNFZ CK=QGD^FOYV^FU>"DK<@0U*##HV\H9&_%["5IK@1 MA9F,FJO2P^3:4_]04%-0T%9=^XCMWKF"L$[)%)G>_I 0Q?@:H)&1HX)7VY&. @@ -1023,4 +1023,4 @@ M<74&Z:0BS4[#$;M2_1""EZVO@$B^"0'V'W:7^@-]G?*\B>0M(- M6MF1FM+ ?,?3[N*1EI"$AXF#@6P-FU/4\QF?O!&%CE5*6J2'@QDYV?_04-O) M7Z 6N;C7E_4 + diff --git a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts index 6760d5ec..92507b13 100644 --- a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts +++ b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts @@ -286,4 +286,4 @@ 7
3
- + diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c b/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c index 7d1c5252..be4a1cb3 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c @@ -1020,7 +1020,7 @@ ble_gap_slave_set_timer(uint32_t ticks_from_now) } #endif -#if (NIMBLE_BLE_CONNECT || NIMBLE_BLE_SCAN) +#if NIMBLE_BLE_CONNECT /** * Called when an error is encountered while the master-connection-fsm is * active. @@ -1034,22 +1034,12 @@ ble_gap_master_failed(int status) ble_gap_master_connect_failure(status); break; -#if NIMBLE_BLE_SCAN - case BLE_GAP_OP_M_DISC: - STATS_INC(ble_gap_stats, initiate_fail); - ble_gap_disc_complete(); - ble_gap_master_reset_state(); - break; -#endif - default: BLE_HS_DBG_ASSERT(0); break; } } -#endif -#if NIMBLE_BLE_CONNECT static void ble_gap_update_failed(uint16_t conn_handle, int status) { @@ -1247,46 +1237,6 @@ ble_gap_adv_active_instance(uint8_t instance) return ble_gap_slave[instance].op == BLE_GAP_OP_S_ADV; } -/** - * Clears advertisement and discovery state. This function is necessary - * when the controller loses its active state (e.g. on stack reset). - */ -void -ble_gap_reset_state(int reason) -{ - uint16_t conn_handle; - - while (1) { - conn_handle = ble_hs_atomic_first_conn_handle(); - if (conn_handle == BLE_HS_CONN_HANDLE_NONE) { - break; - } - - ble_gap_conn_broken(conn_handle, reason); - } - -#if NIMBLE_BLE_ADVERTISE -#if MYNEWT_VAL(BLE_EXT_ADV) - uint8_t i; - for (i = 0; i < BLE_ADV_INSTANCES; i++) { - if (ble_gap_adv_active_instance(i)) { - /* Indicate to application that advertising has stopped. */ - ble_gap_adv_finished(i, reason, 0, 0); - } - } -#else - if (ble_gap_adv_active_instance(0)) { - /* Indicate to application that advertising has stopped. */ - ble_gap_adv_finished(0, reason, 0, 0); - } -#endif -#endif - -#if (NIMBLE_BLE_SCAN || NIMBLE_BLE_CONNECT) - ble_gap_master_failed(reason); -#endif -} - #if NIMBLE_BLE_CONNECT static int ble_gap_accept_master_conn(void) @@ -1993,6 +1943,7 @@ ble_gap_update_timer(void) ble_hs_unlock(); if (entry != NULL) { + ble_gap_update_notify(conn_handle, BLE_HS_ETIMEOUT); ble_gap_update_entry_free(entry); } } while (entry != NULL); @@ -5594,7 +5545,7 @@ ble_gap_unpair_oldest_peer(void) } if (num_peers == 0) { - return BLE_HS_ENOENT; + return 0; } rc = ble_gap_unpair(&oldest_peer_id_addr); @@ -5605,36 +5556,6 @@ ble_gap_unpair_oldest_peer(void) return 0; } -int -ble_gap_unpair_oldest_except(const ble_addr_t *peer_addr) -{ - ble_addr_t peer_id_addrs[MYNEWT_VAL(BLE_STORE_MAX_BONDS)]; - int num_peers; - int rc, i; - - rc = ble_store_util_bonded_peers( - &peer_id_addrs[0], &num_peers, MYNEWT_VAL(BLE_STORE_MAX_BONDS)); - if (rc != 0) { - return rc; - } - - if (num_peers == 0) { - return BLE_HS_ENOENT; - } - - for (i = 0; i < num_peers; i++) { - if (ble_addr_cmp(peer_addr, &peer_id_addrs[i]) != 0) { - break; - } - } - - if (i >= num_peers) { - return BLE_HS_ENOMEM; - } - - return ble_gap_unpair(&peer_id_addrs[i]); -} - void ble_gap_passkey_event(uint16_t conn_handle, struct ble_gap_passkey_params *passkey_params) diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_gap_priv.h b/src/libs/mynewt-nimble/nimble/host/src/ble_gap_priv.h index c050435f..ce443198 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_gap_priv.h +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_gap_priv.h @@ -136,7 +136,6 @@ void ble_gap_preempt(void); void ble_gap_preempt_done(void); int ble_gap_terminate_with_conn(struct ble_hs_conn *conn, uint8_t hci_reason); -void ble_gap_reset_state(int reason); void ble_gap_conn_broken(uint16_t conn_handle, int reason); int32_t ble_gap_timer(void); diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_hs.c b/src/libs/mynewt-nimble/nimble/host/src/ble_hs.c index b41064fe..23ac1d14 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_hs.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_hs.c @@ -361,6 +361,7 @@ ble_hs_sync(void) static int ble_hs_reset(void) { + uint16_t conn_handle; int rc; STATS_INC(ble_hs_stats, reset); @@ -375,8 +376,14 @@ ble_hs_reset(void) ble_hs_clear_rx_queue(); - /* Clear adverising and scanning states. */ - ble_gap_reset_state(ble_hs_reset_reason); + while (1) { + conn_handle = ble_hs_atomic_first_conn_handle(); + if (conn_handle == BLE_HS_CONN_HANDLE_NONE) { + break; + } + + ble_gap_conn_broken(conn_handle, ble_hs_reset_reason); + } /* Clear configured addresses. */ ble_hs_id_reset(); diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_hs_conn.c b/src/libs/mynewt-nimble/nimble/host/src/ble_hs_conn.c index 70695fa6..f7edb624 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_hs_conn.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_hs_conn.c @@ -327,7 +327,6 @@ ble_hs_conn_find_by_addr(const ble_addr_t *addr) #endif struct ble_hs_conn *conn; - struct ble_hs_conn_addrs addrs; BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task()); @@ -344,14 +343,6 @@ ble_hs_conn_find_by_addr(const ble_addr_t *addr) if (ble_addr_cmp(&conn->bhc_peer_addr, addr) == 0) { return conn; } - if (conn->bhc_peer_addr.type < BLE_OWN_ADDR_RPA_PUBLIC_DEFAULT) { - continue; - } - /*If type 0x02 or 0x03 is used, let's double check if address is good */ - ble_hs_conn_addrs(conn, &addrs); - if (ble_addr_cmp(&addrs.peer_id_addr, addr) == 0) { - return conn; - } } } diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_l2cap_coc.c b/src/libs/mynewt-nimble/nimble/host/src/ble_l2cap_coc.c index b15646f6..41a83156 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_l2cap_coc.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_l2cap_coc.c @@ -73,7 +73,7 @@ ble_l2cap_coc_create_server(uint16_t psm, uint16_t mtu, srv = ble_l2cap_coc_srv_alloc(); if (!srv) { - return BLE_HS_ENOMEM; + return BLE_HS_ENOMEM; } srv->psm = psm; @@ -440,7 +440,6 @@ ble_l2cap_coc_continue_tx(struct ble_l2cap_chan *chan) BLE_HS_LOG(DEBUG, "Sending SDU len=%d\n", OS_MBUF_PKTLEN(tx->sdu)); rc = os_mbuf_append(txom, &l, sizeof(uint16_t)); if (rc) { - rc = BLE_HS_ENOMEM; BLE_HS_LOG(DEBUG, "Could not append data rc=%d", rc); goto failed; } @@ -453,9 +452,8 @@ ble_l2cap_coc_continue_tx(struct ble_l2cap_chan *chan) rc = os_mbuf_appendfrom(txom, tx->sdu, tx->data_offset, len - sdu_size_offset); if (rc) { - rc = BLE_HS_ENOMEM; BLE_HS_LOG(DEBUG, "Could not append data rc=%d", rc); - goto failed; + goto failed; } ble_hs_lock(); diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_monitor.c b/src/libs/mynewt-nimble/nimble/host/src/ble_monitor.c index e6db48b8..6057e7e2 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_monitor.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_monitor.c @@ -17,6 +17,7 @@ * under the License. */ +#include #include "host/ble_monitor.h" #if BLE_MONITOR @@ -28,13 +29,14 @@ #include #include #include +#include #include "os/os.h" #include "log/log.h" #if MYNEWT_VAL(BLE_MONITOR_UART) #include "uart/uart.h" #endif #if MYNEWT_VAL(BLE_MONITOR_RTT) -#include "rtt/SEGGER_RTT.h" +#include "SEGGER_RTT.h" #endif #include "ble_hs_priv.h" #include "ble_monitor_priv.h" @@ -236,7 +238,7 @@ monitor_write_header(uint16_t opcode, uint16_t len) hdr.flags = 0; /* Use uptime for timestamp */ - ts = os_get_uptime_usec(); + ts = os_cputime_ticks_to_usecs(os_cputime_get32()); /* * btsnoop specification states that fields of extended header must be @@ -266,6 +268,17 @@ btmon_write(FILE *instance, const char *bp, size_t n) return n; } +struct File_methods +{ + size_t (*write)(FILE* instance, const char *bp, size_t n); + size_t (*read)(FILE* instance, char *bp, size_t n); +}; + +struct File +{ + const struct File_methods *vmt; +}; + static FILE *btmon = (FILE *) &(struct File) { .vmt = &(struct File_methods) { .write = btmon_write, @@ -276,7 +289,7 @@ static FILE *btmon = (FILE *) &(struct File) { static void drops_tmp_cb(struct ble_npl_event *ev) { - ble_npl_mutex_pend(&lock, OS_TIMEOUT_NEVER); + ble_npl_mutex_pend(&lock, portMAX_DELAY); /* * There's no "nop" in btsnoop protocol so we just send empty system note @@ -345,7 +358,7 @@ ble_monitor_init(void) int ble_monitor_send(uint16_t opcode, const void *data, size_t len) { - ble_npl_mutex_pend(&lock, OS_TIMEOUT_NEVER); + ble_npl_mutex_pend(&lock, portMAX_DELAY); monitor_write_header(opcode, len); monitor_write(data, len); @@ -367,7 +380,7 @@ ble_monitor_send_om(uint16_t opcode, const struct os_mbuf *om) om_tmp = SLIST_NEXT(om_tmp, om_next); } - ble_npl_mutex_pend(&lock, OS_TIMEOUT_NEVER); + ble_npl_mutex_pend(&lock, portMAX_DELAY); monitor_write_header(opcode, length); @@ -429,7 +442,7 @@ ble_monitor_log(int level, const char *fmt, ...) ulog.ident_len = sizeof(id); - ble_npl_mutex_pend(&lock, OS_TIMEOUT_NEVER); + ble_npl_mutex_pend(&lock, portMAX_DELAY); monitor_write_header(BLE_MONITOR_OPCODE_USER_LOGGING, sizeof(ulog) + sizeof(id) + len + 1); diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c b/src/libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c index 148995c8..50fd77ec 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c @@ -68,6 +68,8 @@ ble_sm_alg_encrypt(const uint8_t *key, const uint8_t *plaintext, swap_buf(tmp, plaintext, 16); + + if (tc_aes_encrypt(enc_data, tmp, &s) == TC_CRYPTO_FAIL) { return BLE_HS_EUNKNOWN; } diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_store_util.c b/src/libs/mynewt-nimble/nimble/host/src/ble_store_util.c index 7de48272..444cc55d 100644 --- a/src/libs/mynewt-nimble/nimble/host/src/ble_store_util.c +++ b/src/libs/mynewt-nimble/nimble/host/src/ble_store_util.c @@ -233,15 +233,13 @@ ble_store_util_status_rr(struct ble_store_status_event *event, void *arg) switch (event->event_code) { case BLE_STORE_EVENT_OVERFLOW: switch (event->overflow.obj_type) { - case BLE_STORE_OBJ_TYPE_OUR_SEC: - case BLE_STORE_OBJ_TYPE_PEER_SEC: - return ble_gap_unpair_oldest_peer(); - case BLE_STORE_OBJ_TYPE_CCCD: - /* Try unpairing oldest peer except current peer */ - return ble_gap_unpair_oldest_except(&event->overflow.value->cccd.peer_addr); + case BLE_STORE_OBJ_TYPE_OUR_SEC: + case BLE_STORE_OBJ_TYPE_PEER_SEC: + case BLE_STORE_OBJ_TYPE_CCCD: + return ble_gap_unpair_oldest_peer(); - default: - return BLE_HS_EUNKNOWN; + default: + return BLE_HS_EUNKNOWN; } case BLE_STORE_EVENT_FULL: diff --git a/src/libs/mynewt-nimble/nimble/host/test/src/ble_gap_test.c b/src/libs/mynewt-nimble/nimble/host/test/src/ble_gap_test.c index 7496e316..3962bacc 100644 --- a/src/libs/mynewt-nimble/nimble/host/test/src/ble_gap_test.c +++ b/src/libs/mynewt-nimble/nimble/host/test/src/ble_gap_test.c @@ -2049,6 +2049,70 @@ ble_gap_test_util_update_l2cap(struct ble_gap_upd_params *params, peer_addr, 6) == 0); } +static void +ble_gap_test_util_update_no_l2cap_tmo(struct ble_gap_upd_params *params, + int master) +{ + struct ble_hs_conn *conn; + int rc; + + uint8_t peer_addr[6] = { 1, 2, 3, 4, 5, 6 }; + + ble_gap_test_util_init(); + + ble_hs_test_util_create_conn(2, peer_addr, ble_gap_test_util_connect_cb, + NULL); + + if (!master) { + ble_hs_lock(); + conn = ble_hs_conn_find(2); + TEST_ASSERT_FATAL(conn != NULL); + conn->bhc_flags &= ~BLE_HS_CONN_F_MASTER; + ble_hs_unlock(); + } + + /* Erase callback info reported during connection establishment; we only + * care about updates. + */ + ble_gap_test_util_reset_cb_info(); + + TEST_ASSERT(!ble_gap_master_in_progress()); + + rc = ble_hs_test_util_conn_update(2, params, 0); + TEST_ASSERT(rc == 0); + TEST_ASSERT(!ble_gap_master_in_progress()); + + /* Verify tx of connection update command. */ + ble_gap_test_util_verify_tx_update_conn(params); + + /* Ensure no update event reported. */ + TEST_ASSERT(ble_gap_test_event.type == 0xff); + + /* Advance 39 seconds; ensure no timeout reported. */ + os_time_advance(39 * OS_TICKS_PER_SEC); + ble_gap_timer(); + TEST_ASSERT(ble_gap_test_event.type == 0xff); + + /* Advance 40th second; ensure timeout reported. */ + os_time_advance(1 * OS_TICKS_PER_SEC); + + /* Timeout will result in a terminate HCI command being sent; schedule ack + * from controller. + */ + ble_hs_test_util_hci_ack_set_disconnect(0); + + ble_gap_timer(); + + /* Verify terminate was sent. */ + ble_gap_test_util_verify_tx_disconnect(); + + TEST_ASSERT(ble_gap_test_event.type == BLE_GAP_EVENT_CONN_UPDATE); + TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_ETIMEOUT); + TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2); + TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr.val, + peer_addr, 6) == 0); +} + static void ble_gap_test_util_update_l2cap_tmo(struct ble_gap_upd_params *params, uint8_t hci_status, uint8_t event_status, @@ -2918,6 +2982,9 @@ TEST_CASE_SELF(ble_gap_test_case_update_timeout) .max_ce_len = 456, }; + /* No L2CAP. */ + ble_gap_test_util_update_no_l2cap_tmo(¶ms, 1); + /* L2CAP - Local unsupported; L2CAP timeout. */ ble_gap_test_util_update_l2cap_tmo(¶ms, BLE_ERR_UNKNOWN_HCI_CMD, 0, 0); diff --git a/src/libs/mynewt-nimble/nimble/transport/socket/src/ble_hci_socket.c b/src/libs/mynewt-nimble/nimble/transport/socket/src/ble_hci_socket.c index 8bf56f39..863d0fbb 100644 --- a/src/libs/mynewt-nimble/nimble/transport/socket/src/ble_hci_socket.c +++ b/src/libs/mynewt-nimble/nimble/transport/socket/src/ble_hci_socket.c @@ -540,7 +540,7 @@ ble_hci_sock_config(void) rc = bind(s, (struct sockaddr *)&shci, sizeof(shci)); if (rc) { - dprintf(1, "bind() failed %d hci%d\n", errno, shci.hci_dev); + dprintf(1, "bind() failed %d\n", errno); goto err; } diff --git a/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h b/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h index d06056eb..b30d7ec2 100644 --- a/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h +++ b/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h @@ -15,11 +15,8 @@ #define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name #define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val - - -/*** @apache-mynewt-core/compiler/arm-none-eabi-m4 */ -#ifndef MYNEWT_VAL_HARDFLOAT -#define MYNEWT_VAL_HARDFLOAT (0) +#ifndef OS_TICKS_PER_SEC +#define OS_TICKS_PER_SEC 1024 #endif /*** @apache-mynewt-core/crypto/tinycrypt */ @@ -35,15 +32,6 @@ #define MYNEWT_VAL_TINYCRYPT_UECC_RNG_USE_TRNG (0) #endif -/*** @apache-mynewt-core/hw/bsp/nordic_pca10056 */ -#ifndef MYNEWT_VAL_BSP_NRF52840 -#define MYNEWT_VAL_BSP_NRF52840 (1) -#endif - -#ifndef MYNEWT_VAL_SOFT_PWM -#define MYNEWT_VAL_SOFT_PWM (0) -#endif - /*** @apache-mynewt-core/hw/hal */ #ifndef MYNEWT_VAL_HAL_ENABLE_SOFTWARE_BREAKPOINTS #define MYNEWT_VAL_HAL_ENABLE_SOFTWARE_BREAKPOINTS (1) @@ -65,407 +53,17 @@ #define MYNEWT_VAL_HAL_SYSTEM_RESET_CB (0) #endif -/*** @apache-mynewt-core/hw/mcu/nordic/nrf52xxx */ -#ifndef MYNEWT_VAL_ADC_0 -#define MYNEWT_VAL_ADC_0 (0) -#endif - -#ifndef MYNEWT_VAL_ADC_0_REFMV_0 -#define MYNEWT_VAL_ADC_0_REFMV_0 (0) -#endif - -#ifndef MYNEWT_VAL_CRYPTO -#define MYNEWT_VAL_CRYPTO (0) -#endif - -#ifndef MYNEWT_VAL_GPIO_AS_PIN_RESET -#define MYNEWT_VAL_GPIO_AS_PIN_RESET (0) -#endif - -#ifndef MYNEWT_VAL_I2C_0 -#define MYNEWT_VAL_I2C_0 (0) -#endif - -#ifndef MYNEWT_VAL_I2C_0_FREQ_KHZ -#define MYNEWT_VAL_I2C_0_FREQ_KHZ (100) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_I2C_0_PIN_SCL -#define MYNEWT_VAL_I2C_0_PIN_SCL (27) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_I2C_0_PIN_SDA -#define MYNEWT_VAL_I2C_0_PIN_SDA (26) -#endif - -#ifndef MYNEWT_VAL_I2C_1 -#define MYNEWT_VAL_I2C_1 (0) -#endif - -#ifndef MYNEWT_VAL_I2C_1_FREQ_KHZ -#define MYNEWT_VAL_I2C_1_FREQ_KHZ (100) -#endif - -#undef MYNEWT_VAL_I2C_1_PIN_SCL - -#undef MYNEWT_VAL_I2C_1_PIN_SDA - -#ifndef MYNEWT_VAL_MCU_BUS_DRIVER_I2C_USE_TWIM -#define MYNEWT_VAL_MCU_BUS_DRIVER_I2C_USE_TWIM (0) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_MCU_DCDC_ENABLED -#define MYNEWT_VAL_MCU_DCDC_ENABLED (1) -#endif - -#ifndef MYNEWT_VAL_MCU_DEBUG_IGNORE_BKPT -#define MYNEWT_VAL_MCU_DEBUG_IGNORE_BKPT (0) -#endif - -#ifndef MYNEWT_VAL_MCU_FLASH_MIN_WRITE_SIZE -#define MYNEWT_VAL_MCU_FLASH_MIN_WRITE_SIZE (1) -#endif - -#ifndef MYNEWT_VAL_MCU_GPIO_USE_PORT_EVENT -#define MYNEWT_VAL_MCU_GPIO_USE_PORT_EVENT (0) -#endif - -#ifndef MYNEWT_VAL_MCU_I2C_RECOVERY_DELAY_USEC -#define MYNEWT_VAL_MCU_I2C_RECOVERY_DELAY_USEC (100) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_MCU_LFCLK_SOURCE__LFRC -#define MYNEWT_VAL_MCU_LFCLK_SOURCE__LFRC (0) -#endif -#ifndef MYNEWT_VAL_MCU_LFCLK_SOURCE__LFSYNTH -#define MYNEWT_VAL_MCU_LFCLK_SOURCE__LFSYNTH (0) -#endif -#ifndef MYNEWT_VAL_MCU_LFCLK_SOURCE__LFXO -#define MYNEWT_VAL_MCU_LFCLK_SOURCE__LFXO (1) -#endif -#ifndef MYNEWT_VAL_MCU_LFCLK_SOURCE -#define MYNEWT_VAL_MCU_LFCLK_SOURCE (1) -#endif - -#ifndef MYNEWT_VAL_MCU_NRF52832 -#define MYNEWT_VAL_MCU_NRF52832 (0) -#endif - -#ifndef MYNEWT_VAL_MCU_NRF52840 -#define MYNEWT_VAL_MCU_NRF52840 (0) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_MCU_TARGET__nRF52810 -#define MYNEWT_VAL_MCU_TARGET__nRF52810 (0) -#endif -#ifndef MYNEWT_VAL_MCU_TARGET__nRF52811 -#define MYNEWT_VAL_MCU_TARGET__nRF52811 (0) -#endif -#ifndef MYNEWT_VAL_MCU_TARGET__nRF52832 -#define MYNEWT_VAL_MCU_TARGET__nRF52832 (0) -#endif -#ifndef MYNEWT_VAL_MCU_TARGET__nRF52840 -#define MYNEWT_VAL_MCU_TARGET__nRF52840 (1) -#endif -#ifndef MYNEWT_VAL_MCU_TARGET -#define MYNEWT_VAL_MCU_TARGET (1) -#endif - -#ifndef MYNEWT_VAL_NFC_PINS_AS_GPIO -#define MYNEWT_VAL_NFC_PINS_AS_GPIO (1) -#endif - -#ifndef MYNEWT_VAL_PWM_0 -#define MYNEWT_VAL_PWM_0 (0) -#endif - -#ifndef MYNEWT_VAL_PWM_1 -#define MYNEWT_VAL_PWM_1 (0) -#endif - -#ifndef MYNEWT_VAL_PWM_2 -#define MYNEWT_VAL_PWM_2 (0) -#endif - -#ifndef MYNEWT_VAL_PWM_3 -#define MYNEWT_VAL_PWM_3 (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_ADDRMODE -#define MYNEWT_VAL_QSPI_ADDRMODE (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_DPMCONFIG -#define MYNEWT_VAL_QSPI_DPMCONFIG (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_ENABLE -#define MYNEWT_VAL_QSPI_ENABLE (0) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_FLASH_PAGE_SIZE -#define MYNEWT_VAL_QSPI_FLASH_PAGE_SIZE (256) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_FLASH_SECTOR_COUNT -#define MYNEWT_VAL_QSPI_FLASH_SECTOR_COUNT (4096) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_FLASH_SECTOR_SIZE -#define MYNEWT_VAL_QSPI_FLASH_SECTOR_SIZE (4096) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_PIN_CS -#define MYNEWT_VAL_QSPI_PIN_CS (17) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_PIN_DIO0 -#define MYNEWT_VAL_QSPI_PIN_DIO0 (20) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_PIN_DIO1 -#define MYNEWT_VAL_QSPI_PIN_DIO1 (21) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_PIN_DIO2 -#define MYNEWT_VAL_QSPI_PIN_DIO2 (22) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_PIN_DIO3 -#define MYNEWT_VAL_QSPI_PIN_DIO3 (23) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_QSPI_PIN_SCK -#define MYNEWT_VAL_QSPI_PIN_SCK (19) -#endif - -#ifndef MYNEWT_VAL_QSPI_READOC -#define MYNEWT_VAL_QSPI_READOC (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_SCK_DELAY -#define MYNEWT_VAL_QSPI_SCK_DELAY (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_SCK_FREQ -#define MYNEWT_VAL_QSPI_SCK_FREQ (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_SPI_MODE -#define MYNEWT_VAL_QSPI_SPI_MODE (0) -#endif - -#ifndef MYNEWT_VAL_QSPI_WRITEOC -#define MYNEWT_VAL_QSPI_WRITEOC (0) -#endif - -#ifndef MYNEWT_VAL_SPI_0_MASTER -#define MYNEWT_VAL_SPI_0_MASTER (0) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_MASTER_PIN_MISO -#define MYNEWT_VAL_SPI_0_MASTER_PIN_MISO (47) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_MASTER_PIN_MOSI -#define MYNEWT_VAL_SPI_0_MASTER_PIN_MOSI (46) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_MASTER_PIN_SCK -#define MYNEWT_VAL_SPI_0_MASTER_PIN_SCK (45) -#endif - -#ifndef MYNEWT_VAL_SPI_0_SLAVE -#define MYNEWT_VAL_SPI_0_SLAVE (0) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_SLAVE_PIN_MISO -#define MYNEWT_VAL_SPI_0_SLAVE_PIN_MISO (47) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_SLAVE_PIN_MOSI -#define MYNEWT_VAL_SPI_0_SLAVE_PIN_MOSI (46) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_SLAVE_PIN_SCK -#define MYNEWT_VAL_SPI_0_SLAVE_PIN_SCK (45) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_SPI_0_SLAVE_PIN_SS -#define MYNEWT_VAL_SPI_0_SLAVE_PIN_SS (44) -#endif - -#ifndef MYNEWT_VAL_SPI_1_MASTER -#define MYNEWT_VAL_SPI_1_MASTER (0) -#endif - -#undef MYNEWT_VAL_SPI_1_MASTER_PIN_MISO - -#undef MYNEWT_VAL_SPI_1_MASTER_PIN_MOSI - -#undef MYNEWT_VAL_SPI_1_MASTER_PIN_SCK - -#ifndef MYNEWT_VAL_SPI_1_SLAVE -#define MYNEWT_VAL_SPI_1_SLAVE (0) -#endif - -#undef MYNEWT_VAL_SPI_1_SLAVE_PIN_MISO - -#undef MYNEWT_VAL_SPI_1_SLAVE_PIN_MOSI - -#undef MYNEWT_VAL_SPI_1_SLAVE_PIN_SCK - -#undef MYNEWT_VAL_SPI_1_SLAVE_PIN_SS - -#ifndef MYNEWT_VAL_SPI_2_MASTER -#define MYNEWT_VAL_SPI_2_MASTER (0) -#endif - -#undef MYNEWT_VAL_SPI_2_MASTER_PIN_MISO - -#undef MYNEWT_VAL_SPI_2_MASTER_PIN_MOSI - -#undef MYNEWT_VAL_SPI_2_MASTER_PIN_SCK - -#ifndef MYNEWT_VAL_SPI_2_SLAVE -#define MYNEWT_VAL_SPI_2_SLAVE (0) -#endif - -#undef MYNEWT_VAL_SPI_2_SLAVE_PIN_MISO - -#undef MYNEWT_VAL_SPI_2_SLAVE_PIN_MOSI - -#undef MYNEWT_VAL_SPI_2_SLAVE_PIN_SCK - -#undef MYNEWT_VAL_SPI_2_SLAVE_PIN_SS - -#ifndef MYNEWT_VAL_SPI_3_MASTER -#define MYNEWT_VAL_SPI_3_MASTER (0) -#endif - -#undef MYNEWT_VAL_SPI_3_MASTER_PIN_MISO - -#undef MYNEWT_VAL_SPI_3_MASTER_PIN_MOSI - -#undef MYNEWT_VAL_SPI_3_MASTER_PIN_SCK - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_TIMER_0 -#define MYNEWT_VAL_TIMER_0 (0) -#endif - -#ifndef MYNEWT_VAL_TIMER_1 -#define MYNEWT_VAL_TIMER_1 (0) -#endif - -#ifndef MYNEWT_VAL_TIMER_2 -#define MYNEWT_VAL_TIMER_2 (0) -#endif - -#ifndef MYNEWT_VAL_TIMER_3 -#define MYNEWT_VAL_TIMER_3 (0) -#endif - -#ifndef MYNEWT_VAL_TIMER_4 -#define MYNEWT_VAL_TIMER_4 (0) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_TIMER_5 -#define MYNEWT_VAL_TIMER_5 (1) -#endif - -#ifndef MYNEWT_VAL_TRNG -#define MYNEWT_VAL_TRNG (0) -#endif - -#ifndef MYNEWT_VAL_UART_0 -#define MYNEWT_VAL_UART_0 (1) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_UART_0_PIN_CTS -#define MYNEWT_VAL_UART_0_PIN_CTS (7) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_UART_0_PIN_RTS -#define MYNEWT_VAL_UART_0_PIN_RTS (5) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_UART_0_PIN_RX -#define MYNEWT_VAL_UART_0_PIN_RX (8) -#endif - -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_UART_0_PIN_TX -#define MYNEWT_VAL_UART_0_PIN_TX (6) -#endif - -#ifndef MYNEWT_VAL_UART_1 -#define MYNEWT_VAL_UART_1 (0) -#endif - -#ifndef MYNEWT_VAL_UART_1_PIN_CTS -#define MYNEWT_VAL_UART_1_PIN_CTS (-1) -#endif - -#ifndef MYNEWT_VAL_UART_1_PIN_RTS -#define MYNEWT_VAL_UART_1_PIN_RTS (-1) -#endif - -#undef MYNEWT_VAL_UART_1_PIN_RX - -#undef MYNEWT_VAL_UART_1_PIN_TX - -/* Overridden by @apache-mynewt-nimble/targets/riot (defined by @apache-mynewt-core/hw/mcu/nordic/nrf52xxx) */ -#ifndef MYNEWT_VAL_XTAL_32768 -#define MYNEWT_VAL_XTAL_32768 (1) -#endif - -#ifndef MYNEWT_VAL_XTAL_32768_SYNTH -#define MYNEWT_VAL_XTAL_32768_SYNTH (0) -#endif - -#ifndef MYNEWT_VAL_XTAL_RC -#define MYNEWT_VAL_XTAL_RC (0) -#endif - /*** @apache-mynewt-core/kernel/os */ #ifndef MYNEWT_VAL_FLOAT_USER #define MYNEWT_VAL_FLOAT_USER (0) #endif -/* Overridden by @apache-mynewt-nimble/targets/riot (defined by @apache-mynewt-core/kernel/os) */ #ifndef MYNEWT_VAL_MSYS_1_BLOCK_COUNT #define MYNEWT_VAL_MSYS_1_BLOCK_COUNT (12) #endif -/* Overridden by @apache-mynewt-nimble/targets/riot (defined by @apache-mynewt-core/kernel/os) */ #ifndef MYNEWT_VAL_MSYS_1_BLOCK_SIZE -#define MYNEWT_VAL_MSYS_1_BLOCK_SIZE (88) +#define MYNEWT_VAL_MSYS_1_BLOCK_SIZE (292) #endif #ifndef MYNEWT_VAL_MSYS_1_SANITY_MIN_COUNT @@ -500,12 +98,10 @@ #define MYNEWT_VAL_OS_COREDUMP (0) #endif -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/kernel/os) */ #ifndef MYNEWT_VAL_OS_CPUTIME_FREQ #define MYNEWT_VAL_OS_CPUTIME_FREQ (32768) #endif -/* Overridden by @apache-mynewt-core/hw/bsp/nordic_pca10056 (defined by @apache-mynewt-core/kernel/os) */ #ifndef MYNEWT_VAL_OS_CPUTIME_TIMER_NUM #define MYNEWT_VAL_OS_CPUTIME_TIMER_NUM (5) #endif @@ -634,15 +230,6 @@ #define MYNEWT_VAL_WATCHDOG_INTERVAL (30000) #endif -/*** @apache-mynewt-core/libc/baselibc */ -#ifndef MYNEWT_VAL_BASELIBC_ASSERT_FILE_LINE -#define MYNEWT_VAL_BASELIBC_ASSERT_FILE_LINE (0) -#endif - -#ifndef MYNEWT_VAL_BASELIBC_PRESENT -#define MYNEWT_VAL_BASELIBC_PRESENT (1) -#endif - /*** @apache-mynewt-core/sys/console/stub */ #ifndef MYNEWT_VAL_CONSOLE_UART_BAUD #define MYNEWT_VAL_CONSOLE_UART_BAUD (115200) @@ -713,7 +300,7 @@ #endif #ifndef MYNEWT_VAL_LOG_LEVEL -#define MYNEWT_VAL_LOG_LEVEL (0) +#define MYNEWT_VAL_LOG_LEVEL (255) #endif /*** @apache-mynewt-core/sys/mfg */ @@ -786,9 +373,8 @@ #define MYNEWT_VAL_BLE_MAX_CONNECTIONS (1) #endif -/* Overridden by @apache-mynewt-nimble/targets/riot (defined by @apache-mynewt-nimble/nimble) */ #ifndef MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS -#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (0) +#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (1) #endif #ifndef MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES @@ -799,6 +385,10 @@ #define MYNEWT_VAL_BLE_PERIODIC_ADV (0) #endif +#ifndef MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER +#define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (0) +#endif + #ifndef MYNEWT_VAL_BLE_ROLE_BROADCASTER #define MYNEWT_VAL_BLE_ROLE_BROADCASTER (1) #endif @@ -823,6 +413,608 @@ #define MYNEWT_VAL_BLE_WHITELIST (1) #endif +/*** @apache-mynewt-nimble/nimble/host */ +#ifndef MYNEWT_VAL_BLE_ATT_PREFERRED_MTU +#define MYNEWT_VAL_BLE_ATT_PREFERRED_MTU (256) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_FIND_INFO +#define MYNEWT_VAL_BLE_ATT_SVR_FIND_INFO (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_FIND_TYPE +#define MYNEWT_VAL_BLE_ATT_SVR_FIND_TYPE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_INDICATE +#define MYNEWT_VAL_BLE_ATT_SVR_INDICATE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_MAX_PREP_ENTRIES +#define MYNEWT_VAL_BLE_ATT_SVR_MAX_PREP_ENTRIES (64) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_NOTIFY +#define MYNEWT_VAL_BLE_ATT_SVR_NOTIFY (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE +#define MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE_TMO +#define MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE_TMO (30000) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ +#define MYNEWT_VAL_BLE_ATT_SVR_READ (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_BLOB +#define MYNEWT_VAL_BLE_ATT_SVR_READ_BLOB (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_GROUP_TYPE +#define MYNEWT_VAL_BLE_ATT_SVR_READ_GROUP_TYPE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_MULT +#define MYNEWT_VAL_BLE_ATT_SVR_READ_MULT (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_TYPE +#define MYNEWT_VAL_BLE_ATT_SVR_READ_TYPE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_SIGNED_WRITE +#define MYNEWT_VAL_BLE_ATT_SVR_SIGNED_WRITE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_WRITE +#define MYNEWT_VAL_BLE_ATT_SVR_WRITE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP +#define MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP (1) +#endif + +#ifndef MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE +#define MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS +#define MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_DSCS +#define MYNEWT_VAL_BLE_GATT_DISC_ALL_DSCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_SVCS +#define MYNEWT_VAL_BLE_GATT_DISC_ALL_SVCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_DISC_CHR_UUID +#define MYNEWT_VAL_BLE_GATT_DISC_CHR_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_DISC_SVC_UUID +#define MYNEWT_VAL_BLE_GATT_DISC_SVC_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_FIND_INC_SVCS +#define MYNEWT_VAL_BLE_GATT_FIND_INC_SVCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_INDICATE +#define MYNEWT_VAL_BLE_GATT_INDICATE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_MAX_PROCS +#define MYNEWT_VAL_BLE_GATT_MAX_PROCS (4) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_NOTIFY +#define MYNEWT_VAL_BLE_GATT_NOTIFY (1) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_READ +#define MYNEWT_VAL_BLE_GATT_READ (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_READ_LONG +#define MYNEWT_VAL_BLE_GATT_READ_LONG (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_READ_MAX_ATTRS +#define MYNEWT_VAL_BLE_GATT_READ_MAX_ATTRS (8) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_READ_MULT +#define MYNEWT_VAL_BLE_GATT_READ_MULT (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_READ_UUID +#define MYNEWT_VAL_BLE_GATT_READ_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_RESUME_RATE +#define MYNEWT_VAL_BLE_GATT_RESUME_RATE (1000) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_SIGNED_WRITE +#define MYNEWT_VAL_BLE_GATT_SIGNED_WRITE (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_WRITE +#define MYNEWT_VAL_BLE_GATT_WRITE (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_WRITE_LONG +#define MYNEWT_VAL_BLE_GATT_WRITE_LONG (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_WRITE_MAX_ATTRS +#define MYNEWT_VAL_BLE_GATT_WRITE_MAX_ATTRS (4) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_WRITE_NO_RSP +#define MYNEWT_VAL_BLE_GATT_WRITE_NO_RSP (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_GATT_WRITE_RELIABLE +#define MYNEWT_VAL_BLE_GATT_WRITE_RELIABLE (MYNEWT_VAL_BLE_ROLE_CENTRAL) +#endif + +#ifndef MYNEWT_VAL_BLE_HOST +#define MYNEWT_VAL_BLE_HOST (1) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_AUTO_START +#define MYNEWT_VAL_BLE_HS_AUTO_START (1) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_DEBUG +#define MYNEWT_VAL_BLE_HS_DEBUG (0) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL +#define MYNEWT_VAL_BLE_HS_FLOW_CTRL (0) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL +#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL (1000) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH +#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH (2) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT +#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT (0) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_LOG_LVL +#define MYNEWT_VAL_BLE_HS_LOG_LVL (1) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_LOG_MOD +#define MYNEWT_VAL_BLE_HS_LOG_MOD (4) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_PHONY_HCI_ACKS +#define MYNEWT_VAL_BLE_HS_PHONY_HCI_ACKS (0) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_REQUIRE_OS +#define MYNEWT_VAL_BLE_HS_REQUIRE_OS (1) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN +#define MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN (1) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN_TIMEOUT +#define MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN_TIMEOUT (2000) +#endif + +#ifndef MYNEWT_VAL_BLE_HS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_HS_SYSINIT_STAGE (200) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM +#define MYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM (0) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_COC_MPS +#define MYNEWT_VAL_BLE_L2CAP_COC_MPS (MYNEWT_VAL_MSYS_1_BLOCK_SIZE-8) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_ENHANCED_COC +#define MYNEWT_VAL_BLE_L2CAP_ENHANCED_COC (0) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_JOIN_RX_FRAGS +#define MYNEWT_VAL_BLE_L2CAP_JOIN_RX_FRAGS (1) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_MAX_CHANS +#define MYNEWT_VAL_BLE_L2CAP_MAX_CHANS (3*MYNEWT_VAL_BLE_MAX_CONNECTIONS) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_RX_FRAG_TIMEOUT +#define MYNEWT_VAL_BLE_L2CAP_RX_FRAG_TIMEOUT (30000) +#endif + +#ifndef MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS +#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1) +#endif + +#ifndef MYNEWT_VAL_BLE_MESH +#define MYNEWT_VAL_BLE_MESH (0) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_CONSOLE_BUFFER_SIZE +#define MYNEWT_VAL_BLE_MONITOR_CONSOLE_BUFFER_SIZE (128) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_RTT +#define MYNEWT_VAL_BLE_MONITOR_RTT (1) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED +#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED (1) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_NAME +#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_NAME ("btmonitor") +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_SIZE +#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_SIZE (256) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_UART +#define MYNEWT_VAL_BLE_MONITOR_UART (0) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_UART_BAUDRATE +#define MYNEWT_VAL_BLE_MONITOR_UART_BAUDRATE (1000000) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_UART_BUFFER_SIZE +#define MYNEWT_VAL_BLE_MONITOR_UART_BUFFER_SIZE (64) +#endif + +#ifndef MYNEWT_VAL_BLE_MONITOR_UART_DEV +#define MYNEWT_VAL_BLE_MONITOR_UART_DEV ("uart0") +#endif + +#ifndef MYNEWT_VAL_BLE_RPA_TIMEOUT +#define MYNEWT_VAL_BLE_RPA_TIMEOUT (300) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_BONDING +#define MYNEWT_VAL_BLE_SM_BONDING (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_IO_CAP +#define MYNEWT_VAL_BLE_SM_IO_CAP (BLE_HS_IO_NO_INPUT_OUTPUT) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_KEYPRESS +#define MYNEWT_VAL_BLE_SM_KEYPRESS (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_LEGACY +#define MYNEWT_VAL_BLE_SM_LEGACY (1) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_MAX_PROCS +#define MYNEWT_VAL_BLE_SM_MAX_PROCS (1) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_MITM +#define MYNEWT_VAL_BLE_SM_MITM (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_OOB_DATA_FLAG +#define MYNEWT_VAL_BLE_SM_OOB_DATA_FLAG (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_OUR_KEY_DIST +#define MYNEWT_VAL_BLE_SM_OUR_KEY_DIST (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_SC +#define MYNEWT_VAL_BLE_SM_SC (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS +#define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SM_THEIR_KEY_DIST +#define MYNEWT_VAL_BLE_SM_THEIR_KEY_DIST (0) +#endif + +#ifndef MYNEWT_VAL_BLE_STORE_MAX_BONDS +#define MYNEWT_VAL_BLE_STORE_MAX_BONDS (3) +#endif + +#ifndef MYNEWT_VAL_BLE_STORE_MAX_CCCDS +#define MYNEWT_VAL_BLE_STORE_MAX_CCCDS (8) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/ans */ +#ifndef MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT +#define MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_ANS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_ANS_SYSINIT_STAGE (303) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_ANS_UNR_ALERT_CAT +#define MYNEWT_VAL_BLE_SVC_ANS_UNR_ALERT_CAT (0) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/bas */ +#ifndef MYNEWT_VAL_BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY_ENABLE +#define MYNEWT_VAL_BLE_SVC_BAS_BATTERY_LEVEL_NOTIFY_ENABLE (1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_BAS_BATTERY_LEVEL_READ_PERM +#define MYNEWT_VAL_BLE_SVC_BAS_BATTERY_LEVEL_READ_PERM (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_BAS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_BAS_SYSINIT_STAGE (303) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/dis */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_DEFAULT_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_DEFAULT_READ_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_FIRMWARE_REVISION_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_FIRMWARE_REVISION_DEFAULT (NULL) +#endif + +/* Value copied from BLE_SVC_DIS_DEFAULT_READ_PERM */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_FIRMWARE_REVISION_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_FIRMWARE_REVISION_READ_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_HARDWARE_REVISION_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_HARDWARE_REVISION_DEFAULT (NULL) +#endif + +/* Value copied from BLE_SVC_DIS_DEFAULT_READ_PERM */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_HARDWARE_REVISION_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_HARDWARE_REVISION_READ_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_MANUFACTURER_NAME_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_MANUFACTURER_NAME_DEFAULT (NULL) +#endif + +/* Value copied from BLE_SVC_DIS_DEFAULT_READ_PERM */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_MANUFACTURER_NAME_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_MANUFACTURER_NAME_READ_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_MODEL_NUMBER_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_MODEL_NUMBER_DEFAULT ("Apache Mynewt NimBLE") +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_MODEL_NUMBER_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_MODEL_NUMBER_READ_PERM (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SERIAL_NUMBER_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_SERIAL_NUMBER_DEFAULT (NULL) +#endif + +/* Value copied from BLE_SVC_DIS_DEFAULT_READ_PERM */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SERIAL_NUMBER_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_SERIAL_NUMBER_READ_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SOFTWARE_REVISION_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_SOFTWARE_REVISION_DEFAULT (NULL) +#endif + +/* Value copied from BLE_SVC_DIS_DEFAULT_READ_PERM */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SOFTWARE_REVISION_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_SOFTWARE_REVISION_READ_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_DIS_SYSINIT_STAGE (303) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SYSTEM_ID_DEFAULT +#define MYNEWT_VAL_BLE_SVC_DIS_SYSTEM_ID_DEFAULT (NULL) +#endif + +/* Value copied from BLE_SVC_DIS_DEFAULT_READ_PERM */ +#ifndef MYNEWT_VAL_BLE_SVC_DIS_SYSTEM_ID_READ_PERM +#define MYNEWT_VAL_BLE_SVC_DIS_SYSTEM_ID_READ_PERM (-1) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/gap */ +#ifndef MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE +#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM +#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION +#define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME +#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME ("nimble") +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH +#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH (31) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM +#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM (-1) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_SLAVE_LATENCY +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_SLAVE_LATENCY (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_SUPERVISION_TMO +#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_SUPERVISION_TMO (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SVC_GAP_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_GAP_SYSINIT_STAGE (301) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/gatt */ +#ifndef MYNEWT_VAL_BLE_SVC_GATT_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_GATT_SYSINIT_STAGE (302) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/ias */ +#ifndef MYNEWT_VAL_BLE_SVC_IAS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_IAS_SYSINIT_STAGE (303) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/ipss */ +#ifndef MYNEWT_VAL_BLE_SVC_IPSS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_IPSS_SYSINIT_STAGE (303) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/lls */ +#ifndef MYNEWT_VAL_BLE_SVC_LLS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_LLS_SYSINIT_STAGE (303) +#endif + +/*** @apache-mynewt-nimble/nimble/host/services/tps */ +#ifndef MYNEWT_VAL_BLE_SVC_TPS_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SVC_TPS_SYSINIT_STAGE (303) +#endif + +/*** @apache-mynewt-nimble/nimble/transport/socket */ +#ifndef MYNEWT_VAL_BLE_ACL_BUF_COUNT +#define MYNEWT_VAL_BLE_ACL_BUF_COUNT (24) +#endif + +#ifndef MYNEWT_VAL_BLE_ACL_BUF_SIZE +#define MYNEWT_VAL_BLE_ACL_BUF_SIZE (255) +#endif + +#ifndef MYNEWT_VAL_BLE_HCI_ACL_OUT_COUNT +#define MYNEWT_VAL_BLE_HCI_ACL_OUT_COUNT (12) +#endif + +#ifndef MYNEWT_VAL_BLE_HCI_EVT_BUF_SIZE +#define MYNEWT_VAL_BLE_HCI_EVT_BUF_SIZE (70) +#endif + +#ifndef MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT +#define MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT (8) +#endif + +#ifndef MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT +#define MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT (8) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_CLI_SYSINIT_STAGE +#define MYNEWT_VAL_BLE_SOCK_CLI_SYSINIT_STAGE (500) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_LINUX_DEV +#define MYNEWT_VAL_BLE_SOCK_LINUX_DEV (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_STACK_SIZE +#define MYNEWT_VAL_BLE_SOCK_STACK_SIZE (80) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_TASK_PRIO +#define MYNEWT_VAL_BLE_SOCK_TASK_PRIO (9) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_TCP_PORT +#define MYNEWT_VAL_BLE_SOCK_TCP_PORT (14433) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_USE_LINUX_BLUE +#define MYNEWT_VAL_BLE_SOCK_USE_LINUX_BLUE (0) +#endif + +#ifndef MYNEWT_VAL_BLE_SOCK_USE_TCP +#define MYNEWT_VAL_BLE_SOCK_USE_TCP (1) +#endif + +/*** newt */ +#ifndef MYNEWT_VAL_APP_NAME +#define MYNEWT_VAL_APP_NAME ("dummy_app") +#endif + +#ifndef MYNEWT_VAL_APP_dummy_app +#define MYNEWT_VAL_APP_dummy_app (1) +#endif + +#ifndef MYNEWT_VAL_ARCH_NAME +#define MYNEWT_VAL_ARCH_NAME ("dummy") +#endif + +#ifndef MYNEWT_VAL_ARCH_dummy +#define MYNEWT_VAL_ARCH_dummy (1) +#endif + +#ifndef MYNEWT_VAL_BSP_NAME +#define MYNEWT_VAL_BSP_NAME ("dummy_bsp") +#endif + +#ifndef MYNEWT_VAL_BSP_dummy_bsp +#define MYNEWT_VAL_BSP_dummy_bsp (1) +#endif + +#ifndef MYNEWT_VAL_NEWT_FEATURE_LOGCFG +#define MYNEWT_VAL_NEWT_FEATURE_LOGCFG (1) +#endif + +#ifndef MYNEWT_VAL_NEWT_FEATURE_SYSDOWN +#define MYNEWT_VAL_NEWT_FEATURE_SYSDOWN (1) +#endif + +#ifndef MYNEWT_VAL_TARGET_NAME +#define MYNEWT_VAL_TARGET_NAME ("porting_default") +#endif + +#ifndef MYNEWT_VAL_TARGET_porting_default +#define MYNEWT_VAL_TARGET_porting_default (1) +#endif + +#ifndef MYNEWT_VAL_BLE_LL_TX_PWR_DBM +#define MYNEWT_VAL_BLE_LL_TX_PWR_DBM (0) +#endif + +#ifndef MYNEWT_VAL_BLE_PUBLIC_DEV_ADDR +#define MYNEWT_VAL_BLE_PUBLIC_DEV_ADDR ((uint8_t[6]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00}) +#endif + /*** @apache-mynewt-nimble/nimble/controller */ #ifndef MYNEWT_VAL_BLE_CONTROLLER #define MYNEWT_VAL_BLE_CONTROLLER (1) @@ -1068,451 +1260,8 @@ #define MYNEWT_VAL_BLE_PHY_SYSVIEW (0) #endif -/*** @apache-mynewt-nimble/nimble/host */ -#ifndef MYNEWT_VAL_BLE_ATT_PREFERRED_MTU -#define MYNEWT_VAL_BLE_ATT_PREFERRED_MTU (256) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_FIND_INFO -#define MYNEWT_VAL_BLE_ATT_SVR_FIND_INFO (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_FIND_TYPE -#define MYNEWT_VAL_BLE_ATT_SVR_FIND_TYPE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_INDICATE -#define MYNEWT_VAL_BLE_ATT_SVR_INDICATE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_MAX_PREP_ENTRIES -#define MYNEWT_VAL_BLE_ATT_SVR_MAX_PREP_ENTRIES (64) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_NOTIFY -#define MYNEWT_VAL_BLE_ATT_SVR_NOTIFY (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE -#define MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE_TMO -#define MYNEWT_VAL_BLE_ATT_SVR_QUEUED_WRITE_TMO (30000) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ -#define MYNEWT_VAL_BLE_ATT_SVR_READ (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_BLOB -#define MYNEWT_VAL_BLE_ATT_SVR_READ_BLOB (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_GROUP_TYPE -#define MYNEWT_VAL_BLE_ATT_SVR_READ_GROUP_TYPE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_MULT -#define MYNEWT_VAL_BLE_ATT_SVR_READ_MULT (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_READ_TYPE -#define MYNEWT_VAL_BLE_ATT_SVR_READ_TYPE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_SIGNED_WRITE -#define MYNEWT_VAL_BLE_ATT_SVR_SIGNED_WRITE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_WRITE -#define MYNEWT_VAL_BLE_ATT_SVR_WRITE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP -#define MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP (1) -#endif - -#ifndef MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE -#define MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS -#define MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_DSCS -#define MYNEWT_VAL_BLE_GATT_DISC_ALL_DSCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_SVCS -#define MYNEWT_VAL_BLE_GATT_DISC_ALL_SVCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_DISC_CHR_UUID -#define MYNEWT_VAL_BLE_GATT_DISC_CHR_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_DISC_SVC_UUID -#define MYNEWT_VAL_BLE_GATT_DISC_SVC_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_FIND_INC_SVCS -#define MYNEWT_VAL_BLE_GATT_FIND_INC_SVCS (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_INDICATE -#define MYNEWT_VAL_BLE_GATT_INDICATE (1) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_MAX_PROCS -#define MYNEWT_VAL_BLE_GATT_MAX_PROCS (4) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_NOTIFY -#define MYNEWT_VAL_BLE_GATT_NOTIFY (1) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_READ -#define MYNEWT_VAL_BLE_GATT_READ (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_READ_LONG -#define MYNEWT_VAL_BLE_GATT_READ_LONG (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_READ_MAX_ATTRS -#define MYNEWT_VAL_BLE_GATT_READ_MAX_ATTRS (8) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_READ_MULT -#define MYNEWT_VAL_BLE_GATT_READ_MULT (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_READ_UUID -#define MYNEWT_VAL_BLE_GATT_READ_UUID (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_RESUME_RATE -#define MYNEWT_VAL_BLE_GATT_RESUME_RATE (1000) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_SIGNED_WRITE -#define MYNEWT_VAL_BLE_GATT_SIGNED_WRITE (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_WRITE -#define MYNEWT_VAL_BLE_GATT_WRITE (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_WRITE_LONG -#define MYNEWT_VAL_BLE_GATT_WRITE_LONG (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_WRITE_MAX_ATTRS -#define MYNEWT_VAL_BLE_GATT_WRITE_MAX_ATTRS (4) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_WRITE_NO_RSP -#define MYNEWT_VAL_BLE_GATT_WRITE_NO_RSP (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_GATT_WRITE_RELIABLE -#define MYNEWT_VAL_BLE_GATT_WRITE_RELIABLE (MYNEWT_VAL_BLE_ROLE_CENTRAL) -#endif - -#ifndef MYNEWT_VAL_BLE_HOST -#define MYNEWT_VAL_BLE_HOST (1) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_AUTO_START -#define MYNEWT_VAL_BLE_HS_AUTO_START (1) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_DEBUG -#define MYNEWT_VAL_BLE_HS_DEBUG (0) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL -#define MYNEWT_VAL_BLE_HS_FLOW_CTRL (0) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL -#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL (1000) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH -#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH (2) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT -#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT (0) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_LOG_LVL -#define MYNEWT_VAL_BLE_HS_LOG_LVL (0) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_LOG_MOD -#define MYNEWT_VAL_BLE_HS_LOG_MOD (4) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_PHONY_HCI_ACKS -#define MYNEWT_VAL_BLE_HS_PHONY_HCI_ACKS (0) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_REQUIRE_OS -#define MYNEWT_VAL_BLE_HS_REQUIRE_OS (1) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN -#define MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN (1) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN_TIMEOUT -#define MYNEWT_VAL_BLE_HS_STOP_ON_SHUTDOWN_TIMEOUT (2000) -#endif - -#ifndef MYNEWT_VAL_BLE_HS_SYSINIT_STAGE -#define MYNEWT_VAL_BLE_HS_SYSINIT_STAGE (200) -#endif - -#ifndef MYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM -#define MYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM (0) -#endif - -#ifndef MYNEWT_VAL_BLE_L2CAP_COC_MPS -#define MYNEWT_VAL_BLE_L2CAP_COC_MPS (MYNEWT_VAL_MSYS_1_BLOCK_SIZE-8) -#endif - -#ifndef MYNEWT_VAL_BLE_L2CAP_JOIN_RX_FRAGS -#define MYNEWT_VAL_BLE_L2CAP_JOIN_RX_FRAGS (1) -#endif - -#ifndef MYNEWT_VAL_BLE_L2CAP_MAX_CHANS -#define MYNEWT_VAL_BLE_L2CAP_MAX_CHANS (3*MYNEWT_VAL_BLE_MAX_CONNECTIONS) -#endif - -#ifndef MYNEWT_VAL_BLE_L2CAP_RX_FRAG_TIMEOUT -#define MYNEWT_VAL_BLE_L2CAP_RX_FRAG_TIMEOUT (30000) -#endif - -#ifndef MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS -#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1) -#endif - -#ifndef MYNEWT_VAL_BLE_MESH -#define MYNEWT_VAL_BLE_MESH (0) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_CONSOLE_BUFFER_SIZE -#define MYNEWT_VAL_BLE_MONITOR_CONSOLE_BUFFER_SIZE (128) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_RTT -#define MYNEWT_VAL_BLE_MONITOR_RTT (0) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED -#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED (1) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_NAME -#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_NAME ("btmonitor") -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_SIZE -#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_SIZE (256) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_UART -#define MYNEWT_VAL_BLE_MONITOR_UART (0) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_UART_BAUDRATE -#define MYNEWT_VAL_BLE_MONITOR_UART_BAUDRATE (1000000) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_UART_BUFFER_SIZE -#define MYNEWT_VAL_BLE_MONITOR_UART_BUFFER_SIZE (64) -#endif - -#ifndef MYNEWT_VAL_BLE_MONITOR_UART_DEV -#define MYNEWT_VAL_BLE_MONITOR_UART_DEV ("uart0") -#endif - -#ifndef MYNEWT_VAL_BLE_RPA_TIMEOUT -#define MYNEWT_VAL_BLE_RPA_TIMEOUT (300) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_BONDING -#define MYNEWT_VAL_BLE_SM_BONDING (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_IO_CAP -#define MYNEWT_VAL_BLE_SM_IO_CAP (BLE_HS_IO_NO_INPUT_OUTPUT) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_KEYPRESS -#define MYNEWT_VAL_BLE_SM_KEYPRESS (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_LEGACY -#define MYNEWT_VAL_BLE_SM_LEGACY (1) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_MAX_PROCS -#define MYNEWT_VAL_BLE_SM_MAX_PROCS (1) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_MITM -#define MYNEWT_VAL_BLE_SM_MITM (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_OOB_DATA_FLAG -#define MYNEWT_VAL_BLE_SM_OOB_DATA_FLAG (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_OUR_KEY_DIST -#define MYNEWT_VAL_BLE_SM_OUR_KEY_DIST (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_SC -#define MYNEWT_VAL_BLE_SM_SC (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS -#define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SM_THEIR_KEY_DIST -#define MYNEWT_VAL_BLE_SM_THEIR_KEY_DIST (0) -#endif - -#ifndef MYNEWT_VAL_BLE_STORE_MAX_BONDS -#define MYNEWT_VAL_BLE_STORE_MAX_BONDS (3) -#endif - -#ifndef MYNEWT_VAL_BLE_STORE_MAX_CCCDS -#define MYNEWT_VAL_BLE_STORE_MAX_CCCDS (8) -#endif - -/*** @apache-mynewt-nimble/nimble/host/services/gap */ -#ifndef MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE -#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM -#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM (-1) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION -#define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION (-1) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME -#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME ("nimble") -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH -#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH (31) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM -#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM (-1) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL -#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL -#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_SLAVE_LATENCY -#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_SLAVE_LATENCY (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_PPCP_SUPERVISION_TMO -#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_SUPERVISION_TMO (0) -#endif - -#ifndef MYNEWT_VAL_BLE_SVC_GAP_SYSINIT_STAGE -#define MYNEWT_VAL_BLE_SVC_GAP_SYSINIT_STAGE (301) -#endif - -/*** @apache-mynewt-nimble/nimble/host/services/gatt */ -#ifndef MYNEWT_VAL_BLE_SVC_GATT_SYSINIT_STAGE -#define MYNEWT_VAL_BLE_SVC_GATT_SYSINIT_STAGE (302) -#endif - -/*** @apache-mynewt-nimble/nimble/transport/ram */ -/* Overridden by @apache-mynewt-nimble/targets/riot (defined by @apache-mynewt-nimble/nimble/transport/ram) */ -#ifndef MYNEWT_VAL_BLE_ACL_BUF_COUNT -#define MYNEWT_VAL_BLE_ACL_BUF_COUNT (4) -#endif - -#ifndef MYNEWT_VAL_BLE_ACL_BUF_SIZE -#define MYNEWT_VAL_BLE_ACL_BUF_SIZE (255) -#endif - -#ifndef MYNEWT_VAL_BLE_HCI_EVT_BUF_SIZE -#define MYNEWT_VAL_BLE_HCI_EVT_BUF_SIZE (70) -#endif - -/* Overridden by @apache-mynewt-nimble/targets/riot (defined by @apache-mynewt-nimble/nimble/transport/ram) */ -#ifndef MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT -#define MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT (2) -#endif - -#ifndef MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT -#define MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT (8) -#endif - -#ifndef MYNEWT_VAL_BLE_TRANS_RAM_SYSINIT_STAGE -#define MYNEWT_VAL_BLE_TRANS_RAM_SYSINIT_STAGE (100) -#endif - -/*** newt */ -#ifndef MYNEWT_VAL_APP_NAME -#define MYNEWT_VAL_APP_NAME ("dummy_app") -#endif - -#ifndef MYNEWT_VAL_APP_dummy_app -#define MYNEWT_VAL_APP_dummy_app (1) -#endif - -#ifndef MYNEWT_VAL_ARCH_NAME -#define MYNEWT_VAL_ARCH_NAME ("cortex_m4") -#endif - -#ifndef MYNEWT_VAL_ARCH_cortex_m4 -#define MYNEWT_VAL_ARCH_cortex_m4 (1) -#endif - -#ifndef MYNEWT_VAL_BSP_NAME -#define MYNEWT_VAL_BSP_NAME ("nordic_pca10056") -#endif - -#ifndef MYNEWT_VAL_BSP_nordic_pca10056 -#define MYNEWT_VAL_BSP_nordic_pca10056 (1) -#endif - -#ifndef MYNEWT_VAL_NEWT_FEATURE_LOGCFG -#define MYNEWT_VAL_NEWT_FEATURE_LOGCFG (1) -#endif - -#ifndef MYNEWT_VAL_NEWT_FEATURE_SYSDOWN -#define MYNEWT_VAL_NEWT_FEATURE_SYSDOWN (1) -#endif - -#ifndef MYNEWT_VAL_TARGET_NAME -#define MYNEWT_VAL_TARGET_NAME ("riot") -#endif - -#ifndef MYNEWT_VAL_TARGET_riot -#define MYNEWT_VAL_TARGET_riot (1) +#ifndef MYNEWT_VAL_TIMER_5 +#define MYNEWT_VAL_TIMER_5 (1) #endif #endif diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c b/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c index 87936bd8..2bbcc598 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c +++ b/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "nimble/nimble_npl.h" static inline bool diff --git a/src/main.cpp b/src/main.cpp index 869e4246..41943892 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -201,6 +201,7 @@ void nimble_port_init(void) { } void nimble_port_ll_task_func(void *args) { + extern void ble_ll_task(void *); ble_ll_task(args); } } diff --git a/src/sdk_config.h b/src/sdk_config.h index a63eb6fb..505d0821 100644 --- a/src/sdk_config.h +++ b/src/sdk_config.h @@ -8460,15 +8460,15 @@ // NRF_LOG_ENABLED - nrf_log - Logger //========================================================== #ifndef NRF_LOG_ENABLED -#define NRF_LOG_ENABLED 0 +#define NRF_LOG_ENABLED 1 #endif #ifndef NRF_LOG_BACKEND_RTT_ENABLED -#define NRF_LOG_BACKEND_RTT_ENABLED 0 +#define NRF_LOG_BACKEND_RTT_ENABLED 1 #endif #ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT -#define NRF_LOG_BACKEND_SERIAL_USES_RTT 0 +#define NRF_LOG_BACKEND_SERIAL_USES_RTT 1 #endif // Log message pool - Configuration of log message pool @@ -12817,7 +12817,7 @@ // SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Maximum number of upstream buffers. #ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS -#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2 +#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 4 #endif // SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of downstream buffer. From 064e77f05ab54d522b3772fd6854368803373fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojte=CC=8Cch=20Jirkovsky=CC=81?= Date: Wed, 17 Jun 2020 09:02:28 +0200 Subject: [PATCH 2/8] Fix #include to relative paths --- src/graphics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/graphics.cpp b/src/graphics.cpp index 8c39c89a..3b53703c 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -7,9 +7,9 @@ #include "bootloader/boot_graphics.h" #include #include -#include +#include #include -#include +#include #include #include #include @@ -132,4 +132,4 @@ int main(void) { for (;;) { APP_ERROR_HANDLER(NRF_ERROR_FORBIDDEN); } -} \ No newline at end of file +} From 34fd4c5cf3ab0bd8e75b216b971c2f4dbef04266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojte=CC=8Cch=20Jirkovsky=CC=81?= Date: Wed, 17 Jun 2020 23:32:56 +0200 Subject: [PATCH 3/8] Fix link error because of missing file "nrf_common.ld" --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1609196a..9f43c782 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -534,6 +534,7 @@ include_directories( ) link_directories( + ../ ) @@ -666,4 +667,4 @@ elseif(USE_OPENOCD) COMMENT "flashing ${EXECUTABLE_NAME}.hex" ) -endif() \ No newline at end of file +endif() From a0b5cbbc1cb192b7c792aad79246d8132c32965b Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 19 Jun 2020 22:10:01 +0200 Subject: [PATCH 4/8] Disable all logging --- .../mynewt-nimble/porting/nimble/include/syscfg/syscfg.h | 4 ++-- src/sdk_config.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h b/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h index b30d7ec2..6efa3f28 100644 --- a/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h +++ b/src/libs/mynewt-nimble/porting/nimble/include/syscfg/syscfg.h @@ -659,11 +659,11 @@ #endif #ifndef MYNEWT_VAL_BLE_MONITOR_RTT -#define MYNEWT_VAL_BLE_MONITOR_RTT (1) +#define MYNEWT_VAL_BLE_MONITOR_RTT (0) #endif #ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED -#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED (1) +#define MYNEWT_VAL_BLE_MONITOR_RTT_BUFFERED (0) #endif #ifndef MYNEWT_VAL_BLE_MONITOR_RTT_BUFFER_NAME diff --git a/src/sdk_config.h b/src/sdk_config.h index 505d0821..e83bde4b 100644 --- a/src/sdk_config.h +++ b/src/sdk_config.h @@ -8460,15 +8460,15 @@ // NRF_LOG_ENABLED - nrf_log - Logger //========================================================== #ifndef NRF_LOG_ENABLED -#define NRF_LOG_ENABLED 1 +#define NRF_LOG_ENABLED 0 #endif #ifndef NRF_LOG_BACKEND_RTT_ENABLED -#define NRF_LOG_BACKEND_RTT_ENABLED 1 +#define NRF_LOG_BACKEND_RTT_ENABLED 0 #endif #ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT -#define NRF_LOG_BACKEND_SERIAL_USES_RTT 1 +#define NRF_LOG_BACKEND_SERIAL_USES_RTT 0 #endif // Log message pool - Configuration of log message pool From 238cda0b90c3ac4ae8acc7c298391b8d449d83a2 Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 19 Jun 2020 22:10:30 +0200 Subject: [PATCH 5/8] Apply fix for errata 87 (FPU issue). --- src/FreeRTOS/port_cmsis_systick.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/FreeRTOS/port_cmsis_systick.c b/src/FreeRTOS/port_cmsis_systick.c index 58c51bb7..b2cc14cd 100644 --- a/src/FreeRTOS/port_cmsis_systick.c +++ b/src/FreeRTOS/port_cmsis_systick.c @@ -251,6 +251,14 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) else #endif { + // Fix ERRATA 87 (https://infocenter.nordicsemi.com/index.jsp?topic=%252Fcom.nordic.infocenter.sdk5.v11.0.0%252Findex.html&cp=4_0_0) + // Clear FPU interrupt before going to sleep. This prevent unexpected wake-up. + #define FPU_EXCEPTION_MASK 0x0000009F + /* Clear exceptions and PendingIRQ from the FPU unit */ + __set_FPSCR(__get_FPSCR() & ~(FPU_EXCEPTION_MASK)); + (void) __get_FPSCR(); + NVIC_ClearPendingIRQ(FPU_IRQn); + /* No SD - we would just block interrupts globally. * BASEPRI cannot be used for that because it would prevent WFE from wake up. */ From b8f9d706673769b43c390eef1b34bb589da6643b Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 19 Jun 2020 22:11:21 +0200 Subject: [PATCH 6/8] Use PRIMASK instead of BASEPRI for critical sections in FreeRTOS. This is needed by NimBLE to be able to mask radio interrupt (which has priority 0). --- src/FreeRTOS/portmacro_cmsis.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FreeRTOS/portmacro_cmsis.h b/src/FreeRTOS/portmacro_cmsis.h index 3d2dee5c..0497538f 100644 --- a/src/FreeRTOS/portmacro_cmsis.h +++ b/src/FreeRTOS/portmacro_cmsis.h @@ -106,8 +106,8 @@ extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortRaiseBASEPRI() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortSetBASEPRI(x) -#define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI() -#define portENABLE_INTERRUPTS() vPortSetBASEPRI(0) +#define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" ) +#define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" ) #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() From 3dfba0b90d8549d17a2aa4d228f31fbdcf803e70 Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 19 Jun 2020 22:20:12 +0200 Subject: [PATCH 7/8] Update BLE status when BLE is connected. --- src/Components/Ble/NimbleController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp index 8c4675b7..561dbce4 100644 --- a/src/Components/Ble/NimbleController.cpp +++ b/src/Components/Ble/NimbleController.cpp @@ -180,8 +180,8 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { StartAdvertising(); bleController.Disconnect(); } else { - //bleController.Connect(); - //systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); + bleController.Connect(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); connectionHandle = event->connect.conn_handle; // Service discovery is deffered via systemtask } From 4f9adb2372a71bab3c38684420cf90b1a99a6c9a Mon Sep 17 00:00:00 2001 From: JF Date: Sat, 27 Jun 2020 16:11:42 +0200 Subject: [PATCH 8/8] Re-enable watchdog --- src/SystemTask/SystemTask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp index df08c07f..61b3c638 100644 --- a/src/SystemTask/SystemTask.cpp +++ b/src/SystemTask/SystemTask.cpp @@ -48,8 +48,8 @@ void SystemTask::Process(void *instance) { } void SystemTask::Work() { - //watchdog.Setup(7); - //watchdog.Start(); + watchdog.Setup(7); + watchdog.Start(); NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); APP_GPIOTE_INIT(2);