Skip to content

Commit 8f9cd70

Browse files
authored
Merge pull request #3752 from jepler/gcc10
build: Update to gcc10
2 parents 68dd4b2 + 4521dfb commit 8f9cd70

File tree

19 files changed

+110
-89
lines changed

19 files changed

+110
-89
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ jobs:
343343
run: |
344344
sudo apt-get install -y gettext
345345
pip install requests sh click setuptools awscli
346-
wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
347-
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
346+
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
347+
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
348348
- name: Versions
349349
run: |
350350
gcc --version

devices/ble_hci/common-hal/_bleio/att.c

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ STATIC struct {
6161
typedef struct __packed {
6262
uint8_t properties;
6363
uint16_t value_handle;
64-
uint8_t uuid[0]; // 2 or 16 bytes
64+
uint8_t uuid[]; // 2 or 16 bytes
6565
} characteristic_declaration_t;
6666

6767
STATIC uint8_t bleio_properties_to_ble_spec_properties(uint8_t bleio_properties) {
@@ -1010,21 +1010,22 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
10101010
}
10111011

10121012
int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {
1013-
struct __packed {
1013+
1014+
typedef struct __packed {
10141015
struct bt_att_hdr h;
10151016
struct bt_att_read_group_req r;
1016-
} req = { {
1017-
.code = BT_ATT_OP_READ_GROUP_REQ,
1018-
}, {
1019-
.start_handle = start_handle,
1020-
.end_handle = end_handle,
1021-
}
1022-
};
1023-
req.r.uuid[0] = uuid & 0xff;
1024-
req.r.uuid[1] = uuid >> 8;
1017+
} req_t;
10251018

1019+
uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)];
1020+
req_t *req = (req_t *) req_bytes;
10261021

1027-
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
1022+
req->h.code = BT_ATT_OP_READ_GROUP_REQ;
1023+
req->r.start_handle = start_handle;
1024+
req->r.end_handle = end_handle;
1025+
req->r.uuid[0] = uuid & 0xff;
1026+
req->r.uuid[1] = uuid >> 8;
1027+
1028+
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
10281029
}
10291030

10301031
STATIC void process_read_group_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
@@ -1305,20 +1306,21 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
13051306
}
13061307

13071308
int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
1308-
struct __packed {
1309+
typedef struct __packed {
13091310
struct bt_att_hdr h;
13101311
struct bt_att_read_type_req r;
1311-
} req = { {
1312-
.code = BT_ATT_OP_READ_TYPE_REQ,
1313-
}, {
1314-
.start_handle = start_handle,
1315-
.end_handle = end_handle,
1316-
}
1317-
};
1318-
req.r.uuid[0] = type & 0xff;
1319-
req.r.uuid[1] = type >> 8;
1312+
} req_t;
13201313

1321-
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
1314+
uint8_t req_bytes[sizeof(req_t) + sizeof(type)];
1315+
req_t *req = (req_t *) req_bytes;
1316+
1317+
req->h.code = BT_ATT_OP_READ_TYPE_REQ;
1318+
req->r.start_handle = start_handle;
1319+
req->r.end_handle = end_handle;
1320+
req->r.uuid[0] = type & 0xff;
1321+
req->r.uuid[1] = type >> 8;
1322+
1323+
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
13221324
}
13231325

13241326
STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {

devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct bt_att_info_128 {
6969
#define BT_ATT_OP_FIND_INFO_RSP 0x05
7070
struct bt_att_find_info_rsp {
7171
uint8_t format;
72-
uint8_t info[0];
72+
uint8_t info[];
7373
} __packed;
7474

7575
/* Find By Type Value Request */
@@ -78,7 +78,7 @@ struct bt_att_find_type_req {
7878
uint16_t start_handle;
7979
uint16_t end_handle;
8080
uint16_t type;
81-
uint8_t value[0];
81+
uint8_t value[];
8282
} __packed;
8383

8484
struct bt_att_handle_group {
@@ -89,27 +89,28 @@ struct bt_att_handle_group {
8989
/* Find By Type Value Response */
9090
#define BT_ATT_OP_FIND_TYPE_RSP 0x07
9191
struct bt_att_find_type_rsp {
92-
struct bt_att_handle_group list[0];
92+
uint8_t _dummy[0];
93+
struct bt_att_handle_group list[];
9394
} __packed;
9495

9596
/* Read By Type Request */
9697
#define BT_ATT_OP_READ_TYPE_REQ 0x08
9798
struct bt_att_read_type_req {
9899
uint16_t start_handle;
99100
uint16_t end_handle;
100-
uint8_t uuid[0];
101+
uint8_t uuid[];
101102
} __packed;
102103

103104
struct bt_att_data {
104105
uint16_t handle;
105-
uint8_t value[0];
106+
uint8_t value[];
106107
} __packed;
107108

108109
/* Read By Type Response */
109110
#define BT_ATT_OP_READ_TYPE_RSP 0x09
110111
struct bt_att_read_type_rsp {
111112
uint8_t len;
112-
struct bt_att_data data[0];
113+
struct bt_att_data data[];
113114
} __packed;
114115

115116
/* Read Request */
@@ -121,7 +122,8 @@ struct bt_att_read_req {
121122
/* Read Response */
122123
#define BT_ATT_OP_READ_RSP 0x0b
123124
struct bt_att_read_rsp {
124-
uint8_t value[0];
125+
uint8_t _dummy[0];
126+
uint8_t value[];
125127
} __packed;
126128

127129
/* Read Blob Request */
@@ -134,49 +136,52 @@ struct bt_att_read_blob_req {
134136
/* Read Blob Response */
135137
#define BT_ATT_OP_READ_BLOB_RSP 0x0d
136138
struct bt_att_read_blob_rsp {
137-
uint8_t value[0];
139+
uint8_t _dummy[0];
140+
uint8_t value[];
138141
} __packed;
139142

140143
/* Read Multiple Request */
141144
#define BT_ATT_READ_MULT_MIN_LEN_REQ 0x04
142145

143146
#define BT_ATT_OP_READ_MULT_REQ 0x0e
144147
struct bt_att_read_mult_req {
145-
uint16_t handles[0];
148+
uint8_t _dummy[0];
149+
uint16_t handles[];
146150
} __packed;
147151

148152
/* Read Multiple Respose */
149153
#define BT_ATT_OP_READ_MULT_RSP 0x0f
150154
struct bt_att_read_mult_rsp {
151-
uint8_t value[0];
155+
uint8_t _dummy[0];
156+
uint8_t value[];
152157
} __packed;
153158

154159
/* Read by Group Type Request */
155160
#define BT_ATT_OP_READ_GROUP_REQ 0x10
156161
struct bt_att_read_group_req {
157162
uint16_t start_handle;
158163
uint16_t end_handle;
159-
uint8_t uuid[0];
164+
uint8_t uuid[];
160165
} __packed;
161166

162167
struct bt_att_group_data {
163168
uint16_t start_handle;
164169
uint16_t end_handle;
165-
uint8_t value[0];
170+
uint8_t value[];
166171
} __packed;
167172

168173
/* Read by Group Type Response */
169174
#define BT_ATT_OP_READ_GROUP_RSP 0x11
170175
struct bt_att_read_group_rsp {
171176
uint8_t len;
172-
struct bt_att_group_data data[0];
177+
struct bt_att_group_data data[];
173178
} __packed;
174179

175180
/* Write Request */
176181
#define BT_ATT_OP_WRITE_REQ 0x12
177182
struct bt_att_write_req {
178183
uint16_t handle;
179-
uint8_t value[0];
184+
uint8_t value[];
180185
} __packed;
181186

182187
/* Write Response */
@@ -187,15 +192,15 @@ struct bt_att_write_req {
187192
struct bt_att_prepare_write_req {
188193
uint16_t handle;
189194
uint16_t offset;
190-
uint8_t value[0];
195+
uint8_t value[];
191196
} __packed;
192197

193198
/* Prepare Write Respond */
194199
#define BT_ATT_OP_PREPARE_WRITE_RSP 0x17
195200
struct bt_att_prepare_write_rsp {
196201
uint16_t handle;
197202
uint16_t offset;
198-
uint8_t value[0];
203+
uint8_t value[];
199204
} __packed;
200205

201206
/* Execute Write Request */
@@ -214,14 +219,14 @@ struct bt_att_exec_write_req {
214219
#define BT_ATT_OP_NOTIFY 0x1b
215220
struct bt_att_notify {
216221
uint16_t handle;
217-
uint8_t value[0];
222+
uint8_t value[];
218223
} __packed;
219224

220225
/* Handle Value Indication */
221226
#define BT_ATT_OP_INDICATE 0x1d
222227
struct bt_att_indicate {
223228
uint16_t handle;
224-
uint8_t value[0];
229+
uint8_t value[];
225230
} __packed;
226231

227232
/* Handle Value Confirm */
@@ -233,34 +238,35 @@ struct bt_att_signature {
233238

234239
#define BT_ATT_OP_READ_MULT_VL_REQ 0x20
235240
struct bt_att_read_mult_vl_req {
236-
uint16_t handles[0];
241+
uint8_t _dummy[0];
242+
uint16_t handles[];
237243
} __packed;
238244

239245
/* Read Multiple Respose */
240246
#define BT_ATT_OP_READ_MULT_VL_RSP 0x21
241247
struct bt_att_read_mult_vl_rsp {
242248
uint16_t len;
243-
uint8_t value[0];
249+
uint8_t value[];
244250
} __packed;
245251

246252
/* Handle Multiple Value Notification */
247253
#define BT_ATT_OP_NOTIFY_MULT 0x23
248254
struct bt_att_notify_mult {
249255
uint16_t handle;
250256
uint16_t len;
251-
uint8_t value[0];
257+
uint8_t value[];
252258
} __packed;
253259

254260
/* Write Command */
255261
#define BT_ATT_OP_WRITE_CMD 0x52
256262
struct bt_att_write_cmd {
257263
uint16_t handle;
258-
uint8_t value[0];
264+
uint8_t value[];
259265
} __packed;
260266

261267
/* Signed Write Command */
262268
#define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2
263269
struct bt_att_signed_write_cmd {
264270
uint16_t handle;
265-
uint8_t value[0];
271+
uint8_t value[];
266272
} __packed;

devices/ble_hci/common-hal/_bleio/hci_include/hci.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ struct bt_hci_handle_count {
454454
#define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035)
455455
struct bt_hci_cp_host_num_completed_packets {
456456
uint8_t num_handles;
457-
struct bt_hci_handle_count h[0];
457+
struct bt_hci_handle_count h[];
458458
} __packed;
459459

460460
#define BT_HCI_OP_WRITE_INQUIRY_MODE BT_OP(BT_OGF_BASEBAND, 0x0045)
@@ -1099,7 +1099,7 @@ struct bt_hci_ext_adv_set {
10991099
struct bt_hci_cp_le_set_ext_adv_enable {
11001100
uint8_t enable;
11011101
uint8_t set_num;
1102-
struct bt_hci_ext_adv_set s[0];
1102+
struct bt_hci_ext_adv_set s[];
11031103
} __packed;
11041104

11051105
#define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN BT_OP(BT_OGF_LE, 0x003a)
@@ -1158,7 +1158,7 @@ struct bt_hci_cp_le_set_ext_scan_param {
11581158
uint8_t own_addr_type;
11591159
uint8_t filter_policy;
11601160
uint8_t phys;
1161-
struct bt_hci_ext_scan_phy p[0];
1161+
struct bt_hci_ext_scan_phy p[];
11621162
} __packed;
11631163

11641164
/* Extends BT_HCI_LE_SCAN_FILTER_DUP */
@@ -1189,7 +1189,7 @@ struct bt_hci_cp_le_ext_create_conn {
11891189
uint8_t own_addr_type;
11901190
bt_addr_le_t peer_addr;
11911191
uint8_t phys;
1192-
struct bt_hci_ext_conn_phy p[0];
1192+
struct bt_hci_ext_conn_phy p[];
11931193
} __packed;
11941194

11951195
#define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044)
@@ -1354,7 +1354,7 @@ struct bt_hci_evt_role_change {
13541354
#define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13
13551355
struct bt_hci_evt_num_completed_packets {
13561356
uint8_t num_handles;
1357-
struct bt_hci_handle_count h[0];
1357+
struct bt_hci_handle_count h[];
13581358
} __packed;
13591359

13601360
#define BT_HCI_EVT_PIN_CODE_REQ 0x16
@@ -1510,11 +1510,11 @@ struct bt_hci_evt_le_advertising_info {
15101510
uint8_t evt_type;
15111511
bt_addr_le_t addr;
15121512
uint8_t length;
1513-
uint8_t data[0];
1513+
uint8_t data[];
15141514
} __packed;
15151515
struct bt_hci_evt_le_advertising_report {
15161516
uint8_t num_reports;
1517-
struct bt_hci_evt_le_advertising_info adv_info[0];
1517+
struct bt_hci_evt_le_advertising_info adv_info[];
15181518
} __packed;
15191519

15201520
#define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03
@@ -1593,7 +1593,7 @@ struct bt_hci_evt_le_direct_adv_info {
15931593
} __packed;
15941594
struct bt_hci_evt_le_direct_adv_report {
15951595
uint8_t num_reports;
1596-
struct bt_hci_evt_le_direct_adv_info direct_adv_info[0];
1596+
struct bt_hci_evt_le_direct_adv_info direct_adv_info[];
15971597
} __packed;
15981598

15991599
#define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c
@@ -1628,11 +1628,11 @@ struct bt_hci_evt_le_ext_advertising_info {
16281628
uint16_t interval;
16291629
bt_addr_le_t direct_addr;
16301630
uint8_t length;
1631-
uint8_t data[0];
1631+
uint8_t data[];
16321632
} __packed;
16331633
struct bt_hci_evt_le_ext_advertising_report {
16341634
uint8_t num_reports;
1635-
struct bt_hci_evt_le_ext_advertising_info adv_info[0];
1635+
struct bt_hci_evt_le_ext_advertising_info adv_info[];
16361636
} __packed;
16371637

16381638
#define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e
@@ -1654,7 +1654,7 @@ struct bt_hci_evt_le_per_advertising_report {
16541654
uint8_t unused;
16551655
uint8_t data_status;
16561656
uint8_t length;
1657-
uint8_t data[0];
1657+
uint8_t data[];
16581658
} __packed;
16591659

16601660
#define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10

0 commit comments

Comments
 (0)