Skip to content

Commit a5cbaaf

Browse files
authored
Merge pull request #9 from leftger/feat/add-ble-headers
BLE Bindgen
2 parents 136f49a + 0e87ec5 commit a5cbaaf

File tree

9 files changed

+749
-170
lines changed

9 files changed

+749
-170
lines changed

.github/workflows/rust.yml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@ name: Rust
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ["main"]
88

99
env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615

1716
steps:
18-
- uses: actions/checkout@v4
19-
- name: ⚡ Cache
20-
uses: actions/cache@v4
21-
with:
22-
path: |
23-
~/.cargo/registry
24-
~/.cargo/git
25-
target
26-
key: ${{ runner.os }}-cargo
27-
- name: Set permissions
28-
run: chmod +x d
29-
- name: Load sources
30-
run: ./d download-all
31-
- name: Run build
32-
run: cargo run --release --bin stm32-bindings-gen
33-
- name: Run package build
34-
run: cd build/stm32-bindings && cargo build --target=thumbv8m.main-none-eabihf
17+
- uses: actions/checkout@v4
18+
- name: ⚡ Cache
19+
uses: actions/cache@v4
20+
with:
21+
path: |
22+
~/.cargo/registry
23+
~/.cargo/git
24+
target
25+
key: ${{ runner.os }}-cargo
26+
- name: Install ARM GCC toolchain
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y gcc-arm-none-eabi
30+
- name: Set permissions
31+
run: chmod +x d
32+
- name: Load sources
33+
run: ./d download-all
34+
- name: Run build
35+
run: cargo run --release --bin stm32-bindings-gen
36+
- name: Run package build
37+
run: cd build/stm32-bindings && cargo build --target=thumbv8m.main-none-eabihf

stm32-bindings-gen/inc/app_conf.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* Stub configuration header used during bindings generation. */
2+
3+
#ifndef STM32_BINDINGS_GEN_APP_CONF_H
4+
#define STM32_BINDINGS_GEN_APP_CONF_H
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
/* Provide minimal definitions so that ST middleware headers compile under bindgen. */
11+
12+
#ifndef LOG_LEVEL_INFO
13+
#define LOG_LEVEL_INFO (0)
14+
#endif
15+
16+
#ifndef LOG_INFO_APP
17+
#define LOG_INFO_APP(...)
18+
#endif
19+
20+
#ifndef CFG_LOG_SUPPORTED
21+
#define CFG_LOG_SUPPORTED (0U)
22+
#endif
23+
24+
#ifndef PWR_LDO_SUPPLY
25+
#define PWR_LDO_SUPPLY (0U)
26+
#endif
27+
28+
#ifndef RADIO_INTR_NUM
29+
#define RADIO_INTR_NUM (0U)
30+
#endif
31+
32+
#ifndef RADIO_INTR_PRIO_HIGH
33+
#define RADIO_INTR_PRIO_HIGH (0U)
34+
#endif
35+
36+
#ifndef RADIO_INTR_PRIO_LOW
37+
#define RADIO_INTR_PRIO_LOW (0U)
38+
#endif
39+
40+
#ifdef __cplusplus
41+
}
42+
#endif
43+
44+
#endif /* STM32_BINDINGS_GEN_APP_CONF_H */

stm32-bindings-gen/inc/ble-wba.h

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#ifndef BLE_WBA_BINDINGS_H_
2+
#define BLE_WBA_BINDINGS_H_
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include <stdbool.h>
9+
#include <stddef.h>
10+
#include <stdint.h>
11+
#include "cmsis_compiler.h"
12+
13+
/* Toolchain abstraction utilities */
14+
15+
16+
/* Link Layer command interface */
17+
#include "bsp.h"
18+
#include "common_types.h"
19+
#include "dtm.h"
20+
#include "event_manager.h"
21+
#include "evnt_schdlr_gnrc_if.h"
22+
#include "hci.h"
23+
#include "ll_error.h"
24+
#include "ll_intf.h"
25+
#include "ll_intf_cmn.h"
26+
#include "mac_host_intf.h"
27+
#include "mem_intf.h"
28+
#include "os_wrapper.h"
29+
#include "platform.h"
30+
#include "power_table.h"
31+
#include "pta.h"
32+
#include "ral.h"
33+
#include "rfd_dev_config.h"
34+
35+
36+
/* Core BLE stack */
37+
#include "blestack.h"
38+
#include "ble_bufsize.h"
39+
#include "ble_codec.h"
40+
#include "ble_const.h"
41+
#include "ble_core.h"
42+
#include "ble_defs.h"
43+
#include "ble_legacy.h"
44+
#include "ble_std.h"
45+
#include "bleplat.h"
46+
47+
/* Auto-generated ACI command definitions */
48+
#include "auto/ble_events.h"
49+
#include "auto/ble_gap_aci.h"
50+
#include "auto/ble_gatt_aci.h"
51+
#include "auto/ble_hal_aci.h"
52+
#include "auto/ble_hci_le.h"
53+
#include "auto/ble_l2cap_aci.h"
54+
#include "auto/ble_raw_api.h"
55+
#include "auto/ble_types.h"
56+
#include "auto/ble_vs_codes.h"
57+
58+
/* BLE Audio stack */
59+
#include "ble_audio_stack.h"
60+
#include "ble_audio_plat.h"
61+
#include "audio_types.h"
62+
#include "bap_bufsize.h"
63+
#include "bap_types.h"
64+
#include "cap.h"
65+
#include "cap_types.h"
66+
#include "ccp.h"
67+
#include "ccp_types.h"
68+
#include "csip.h"
69+
#include "csip_types.h"
70+
#include "ltv_utils.h"
71+
#include "mcp.h"
72+
#include "mcp_types.h"
73+
#include "micp.h"
74+
#include "micp_types.h"
75+
#include "vcp.h"
76+
#include "vcp_types.h"
77+
78+
/* Codec manager interfaces */
79+
#include "codec_if.h"
80+
#include "codec_mngr.h"
81+
82+
/* LC3 codec interfaces */
83+
#include "LC3.h"
84+
#include "LC3_decoder.h"
85+
#include "LC3_encoder.h"
86+
87+
#ifdef __cplusplus
88+
} /* extern "C" */
89+
#endif
90+
91+
#endif /* BLE_WBA_BINDINGS_H_ */

stm32-bindings-gen/inc/string.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef STM32_BINDINGS_GEN_STUB_STRING_H
2+
#define STM32_BINDINGS_GEN_STUB_STRING_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include <stddef.h>
9+
10+
void *memcpy(void *dest, const void *src, size_t n);
11+
void *memmove(void *dest, const void *src, size_t n);
12+
void *memset(void *s, int c, size_t n);
13+
int memcmp(const void *s1, const void *s2, size_t n);
14+
15+
size_t strlen(const char *s);
16+
size_t strnlen(const char *s, size_t maxlen);
17+
char *strcpy(char *dest, const char *src);
18+
char *strncpy(char *dest, const char *src, size_t n);
19+
char *strcat(char *dest, const char *src);
20+
char *strncat(char *dest, const char *src, size_t n);
21+
int strcmp(const char *s1, const char *s2);
22+
int strncmp(const char *s1, const char *s2, size_t n);
23+
24+
#ifdef __cplusplus
25+
}
26+
#endif
27+
28+
#endif /* STM32_BINDINGS_GEN_STUB_STRING_H */

stm32-bindings-gen/inc/wba_wpan_mac.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#include "st_mac_802_15_4_sap.h"
2+
#include "st_mac_802_15_4_types.h"
3+
#include "st_mac_802_15_4_core.h"
4+
#include "st_mac_802_15_4_sys.h"
5+
#include "st_mac_802_15_4_config.h"
6+
#include "st_mac_802_15_4_core_config.h"
7+
#include "st_mac_802_15_4_sys_svc.h"
8+
#include "st_mac_802_15_4_svc.h"
9+
#include "st_mac_802_15_4_ext_svc.h"
10+
#include "st_mac_802_15_4_raw_svc.h"
11+
#include "st_mac_802_15_4_dbg_svc.h"
12+
#include "st_mac_buffer_management.h"
13+
#include "st_mac_queue.h"
14+
#include "stm_queue.h"
15+
#include "utilities_common.h"
216

317
/* Define to prevent recursive inclusion -------------------------------------*/
418
#ifndef APP_CONF_H
@@ -459,4 +473,4 @@ extern "C"
459473
} /* extern "C" */
460474
#endif
461475

462-
#endif /* APP_CERTIFICATION_MAC_802_15_4_PROCESS_H */
476+
#endif /* APP_CERTIFICATION_MAC_802_15_4_PROCESS_H */
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
#[cfg(feature = "wba_wpan_ble")]
2-
mod wba_wpan_ble;
2+
pub mod ble_stack;
33
#[cfg(feature = "wba_wpan_mac")]
4-
mod wba_wpan_mac;
4+
pub mod wba_wpan_mac;
5+
6+
#[cfg(feature = "wba_wpan_ble")]
7+
pub use self::ble_stack as ble;
8+
#[cfg(feature = "wba_wpan_ble")]
9+
pub use self::ble_stack as ble_wba;
10+
#[cfg(feature = "wba_wpan_mac")]
11+
pub use self::wba_wpan_mac as mac;
12+
#[cfg(feature = "wba_wpan_mac")]
13+
pub use self::wba_wpan_mac as mac_802_15_4;
14+
#[cfg(feature = "wba_wpan_mac")]
15+
pub use self::wba_wpan_mac as wpan_wba;

stm32-bindings-gen/res/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
#![allow(non_camel_case_types)]
55
#![doc(html_no_source)]
66

7-
mod bindings;
7+
pub mod bindings;
8+
pub use bindings::*;

0 commit comments

Comments
 (0)