Skip to content

Commit 25eb1f0

Browse files
committed
Add compile guards for code that exists in the controller binary
1 parent bc8431b commit 25eb1f0

File tree

7 files changed

+40
-2
lines changed

7 files changed

+40
-2
lines changed

src/nimble/nimble/host/src/ble_sm_alg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ ble_sm_alg_g2(const uint8_t *u, const uint8_t *v, const uint8_t *x,
515515
return 0;
516516
}
517517

518+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
518519
int
519520
ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
520521
const uint8_t *our_priv_key, uint8_t *out_dhkey)
@@ -611,6 +612,7 @@ ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_
611612
swap_buf(out_dhkey, dh, 32);
612613
return 0;
613614
}
615+
#endif
614616

615617
/* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */
616618
static const uint8_t ble_sm_alg_dbg_priv_key[32] = {
@@ -690,6 +692,7 @@ void mbedtls_free_keypair(void)
690692
}
691693
#endif
692694

695+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
693696
/**
694697
* pub: 64 bytes
695698
* priv: 32 bytes
@@ -726,6 +729,7 @@ ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
726729

727730
return 0;
728731
}
732+
#endif
729733

730734
#if MYNEWT_VAL(SELFTEST)
731735
/* Unit tests rely on custom RNG function not being set */

src/nimble/porting/nimble/src/endian.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
* under the License.
1818
*/
1919

20+
#include "syscfg/syscfg.h"
21+
22+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
23+
2024
#include "nimble/porting/nimble/include/os/endian.h"
2125

2226
void
@@ -266,3 +270,5 @@ swap_buf(uint8_t *dst, const uint8_t *src, int len)
266270
dst[len - 1 - i] = src[i];
267271
}
268272
}
273+
274+
#endif

src/nimble/porting/nimble/src/mem.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
* under the License.
1818
*/
1919

20+
#include "syscfg/syscfg.h"
21+
22+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
23+
2024
#include <stdlib.h>
2125
#include "nimble/porting/nimble/include/os/os.h"
2226
#include "nimble/porting/nimble/include/mem/mem.h"
@@ -326,3 +330,5 @@ mem_pullup_obj(struct os_mbuf **om, uint16_t len)
326330
return (*om)->om_data;
327331

328332
}
333+
334+
#endif

src/nimble/porting/nimble/src/os_mbuf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
*
3434
*/
3535

36+
#include "syscfg/syscfg.h"
37+
38+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
39+
3640
#include "nimble/porting/nimble/include/os/os.h"
3741
#include "nimble/porting/nimble/include/os/os_trace_api.h"
3842
#include "nimble/porting/nimble/include/modlog/modlog.h"
@@ -1262,3 +1266,5 @@ os_mbuf_pack_chains(struct os_mbuf *m1, struct os_mbuf *m2)
12621266

12631267
return m1;
12641268
}
1269+
1270+
#endif

src/nimble/porting/nimble/src/os_mempool.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
* under the License.
1818
*/
1919

20+
#include "syscfg/syscfg.h"
21+
22+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
23+
2024
#include "nimble/porting/nimble/include/os/os.h"
2125
#include "nimble/porting/nimble/include/os/os_trace_api.h"
2226

2327
#include <string.h>
2428
#include <assert.h>
2529
#include <stdbool.h>
26-
#include "nimble/porting/nimble/include/syscfg/syscfg.h"
2730
#include "nimble/porting/nimble/include/modlog/modlog.h"
2831
#if !MYNEWT_VAL(OS_SYSVIEW_TRACE_MEMPOOL)
2932
#define OS_TRACE_DISABLE_FILE_API
@@ -485,3 +488,5 @@ os_mempool_module_init(void)
485488
{
486489
STAILQ_INIT(&g_os_mempool_list);
487490
}
491+
492+
#endif

src/nimble/porting/nimble/src/os_msys_init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
* under the License.
1818
*/
1919

20+
#include "syscfg/syscfg.h"
21+
22+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
23+
2024
#include <assert.h>
2125
#include "nimble/porting/nimble/include/os/os.h"
2226
#include "nimble/porting/nimble/include/mem/mem.h"
@@ -220,3 +224,5 @@ void os_msys_init(void)
220224
SYSINIT_PANIC_ASSERT(rc == 0);
221225
#endif
222226
}
227+
228+
#endif

src/nimble/porting/npl/freertos/src/npl_os_freertos.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
* under the License.
1818
*/
1919

20+
#include "syscfg/syscfg.h"
21+
22+
#if !CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
23+
2024
#include <assert.h>
2125
#include <stddef.h>
2226
#include <string.h>
2327
#include <stdlib.h>
24-
#include "nimble/porting/nimble/include/syscfg/syscfg.h"
2528
#include "nimble/console/console.h"
2629

2730
#include "nimble/nimble/include/nimble/nimble_npl.h"
@@ -1405,3 +1408,5 @@ void npl_freertos_funcs_deinit(void)
14051408
}
14061409
npl_funcs = NULL;
14071410
}
1411+
1412+
#endif

0 commit comments

Comments
 (0)