Skip to content

Commit

Permalink
Merge pull request #3752 from jepler/gcc10
Browse files Browse the repository at this point in the history
build: Update to gcc10
  • Loading branch information
dhalbert committed Dec 17, 2020
2 parents 68dd4b2 + 4521dfb commit 8f9cd70
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ jobs:
run: |
sudo apt-get install -y gettext
pip install requests sh click setuptools awscli
wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
- name: Versions
run: |
gcc --version
Expand Down
48 changes: 25 additions & 23 deletions devices/ble_hci/common-hal/_bleio/att.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ STATIC struct {
typedef struct __packed {
uint8_t properties;
uint16_t value_handle;
uint8_t uuid[0]; // 2 or 16 bytes
uint8_t uuid[]; // 2 or 16 bytes
} characteristic_declaration_t;

STATIC uint8_t bleio_properties_to_ble_spec_properties(uint8_t bleio_properties) {
Expand Down Expand Up @@ -1010,21 +1010,22 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
}

int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {
struct __packed {

typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_read_group_req r;
} req = { {
.code = BT_ATT_OP_READ_GROUP_REQ,
}, {
.start_handle = start_handle,
.end_handle = end_handle,
}
};
req.r.uuid[0] = uuid & 0xff;
req.r.uuid[1] = uuid >> 8;
} req_t;

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

return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
req->h.code = BT_ATT_OP_READ_GROUP_REQ;
req->r.start_handle = start_handle;
req->r.end_handle = end_handle;
req->r.uuid[0] = uuid & 0xff;
req->r.uuid[1] = uuid >> 8;

return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
}

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

int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
struct __packed {
typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_read_type_req r;
} req = { {
.code = BT_ATT_OP_READ_TYPE_REQ,
}, {
.start_handle = start_handle,
.end_handle = end_handle,
}
};
req.r.uuid[0] = type & 0xff;
req.r.uuid[1] = type >> 8;
} req_t;

return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
uint8_t req_bytes[sizeof(req_t) + sizeof(type)];
req_t *req = (req_t *) req_bytes;

req->h.code = BT_ATT_OP_READ_TYPE_REQ;
req->r.start_handle = start_handle;
req->r.end_handle = end_handle;
req->r.uuid[0] = type & 0xff;
req->r.uuid[1] = type >> 8;

return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
}

STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
Expand Down
52 changes: 29 additions & 23 deletions devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct bt_att_info_128 {
#define BT_ATT_OP_FIND_INFO_RSP 0x05
struct bt_att_find_info_rsp {
uint8_t format;
uint8_t info[0];
uint8_t info[];
} __packed;

/* Find By Type Value Request */
Expand All @@ -78,7 +78,7 @@ struct bt_att_find_type_req {
uint16_t start_handle;
uint16_t end_handle;
uint16_t type;
uint8_t value[0];
uint8_t value[];
} __packed;

struct bt_att_handle_group {
Expand All @@ -89,27 +89,28 @@ struct bt_att_handle_group {
/* Find By Type Value Response */
#define BT_ATT_OP_FIND_TYPE_RSP 0x07
struct bt_att_find_type_rsp {
struct bt_att_handle_group list[0];
uint8_t _dummy[0];
struct bt_att_handle_group list[];
} __packed;

/* Read By Type Request */
#define BT_ATT_OP_READ_TYPE_REQ 0x08
struct bt_att_read_type_req {
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[0];
uint8_t uuid[];
} __packed;

struct bt_att_data {
uint16_t handle;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Read By Type Response */
#define BT_ATT_OP_READ_TYPE_RSP 0x09
struct bt_att_read_type_rsp {
uint8_t len;
struct bt_att_data data[0];
struct bt_att_data data[];
} __packed;

/* Read Request */
Expand All @@ -121,7 +122,8 @@ struct bt_att_read_req {
/* Read Response */
#define BT_ATT_OP_READ_RSP 0x0b
struct bt_att_read_rsp {
uint8_t value[0];
uint8_t _dummy[0];
uint8_t value[];
} __packed;

/* Read Blob Request */
Expand All @@ -134,49 +136,52 @@ struct bt_att_read_blob_req {
/* Read Blob Response */
#define BT_ATT_OP_READ_BLOB_RSP 0x0d
struct bt_att_read_blob_rsp {
uint8_t value[0];
uint8_t _dummy[0];
uint8_t value[];
} __packed;

/* Read Multiple Request */
#define BT_ATT_READ_MULT_MIN_LEN_REQ 0x04

#define BT_ATT_OP_READ_MULT_REQ 0x0e
struct bt_att_read_mult_req {
uint16_t handles[0];
uint8_t _dummy[0];
uint16_t handles[];
} __packed;

/* Read Multiple Respose */
#define BT_ATT_OP_READ_MULT_RSP 0x0f
struct bt_att_read_mult_rsp {
uint8_t value[0];
uint8_t _dummy[0];
uint8_t value[];
} __packed;

/* Read by Group Type Request */
#define BT_ATT_OP_READ_GROUP_REQ 0x10
struct bt_att_read_group_req {
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[0];
uint8_t uuid[];
} __packed;

struct bt_att_group_data {
uint16_t start_handle;
uint16_t end_handle;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Read by Group Type Response */
#define BT_ATT_OP_READ_GROUP_RSP 0x11
struct bt_att_read_group_rsp {
uint8_t len;
struct bt_att_group_data data[0];
struct bt_att_group_data data[];
} __packed;

/* Write Request */
#define BT_ATT_OP_WRITE_REQ 0x12
struct bt_att_write_req {
uint16_t handle;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Write Response */
Expand All @@ -187,15 +192,15 @@ struct bt_att_write_req {
struct bt_att_prepare_write_req {
uint16_t handle;
uint16_t offset;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Prepare Write Respond */
#define BT_ATT_OP_PREPARE_WRITE_RSP 0x17
struct bt_att_prepare_write_rsp {
uint16_t handle;
uint16_t offset;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Execute Write Request */
Expand All @@ -214,14 +219,14 @@ struct bt_att_exec_write_req {
#define BT_ATT_OP_NOTIFY 0x1b
struct bt_att_notify {
uint16_t handle;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Handle Value Indication */
#define BT_ATT_OP_INDICATE 0x1d
struct bt_att_indicate {
uint16_t handle;
uint8_t value[0];
uint8_t value[];
} __packed;

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

#define BT_ATT_OP_READ_MULT_VL_REQ 0x20
struct bt_att_read_mult_vl_req {
uint16_t handles[0];
uint8_t _dummy[0];
uint16_t handles[];
} __packed;

/* Read Multiple Respose */
#define BT_ATT_OP_READ_MULT_VL_RSP 0x21
struct bt_att_read_mult_vl_rsp {
uint16_t len;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Handle Multiple Value Notification */
#define BT_ATT_OP_NOTIFY_MULT 0x23
struct bt_att_notify_mult {
uint16_t handle;
uint16_t len;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Write Command */
#define BT_ATT_OP_WRITE_CMD 0x52
struct bt_att_write_cmd {
uint16_t handle;
uint8_t value[0];
uint8_t value[];
} __packed;

/* Signed Write Command */
#define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2
struct bt_att_signed_write_cmd {
uint16_t handle;
uint8_t value[0];
uint8_t value[];
} __packed;
22 changes: 11 additions & 11 deletions devices/ble_hci/common-hal/_bleio/hci_include/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ struct bt_hci_handle_count {
#define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035)
struct bt_hci_cp_host_num_completed_packets {
uint8_t num_handles;
struct bt_hci_handle_count h[0];
struct bt_hci_handle_count h[];
} __packed;

#define BT_HCI_OP_WRITE_INQUIRY_MODE BT_OP(BT_OGF_BASEBAND, 0x0045)
Expand Down Expand Up @@ -1099,7 +1099,7 @@ struct bt_hci_ext_adv_set {
struct bt_hci_cp_le_set_ext_adv_enable {
uint8_t enable;
uint8_t set_num;
struct bt_hci_ext_adv_set s[0];
struct bt_hci_ext_adv_set s[];
} __packed;

#define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN BT_OP(BT_OGF_LE, 0x003a)
Expand Down Expand Up @@ -1158,7 +1158,7 @@ struct bt_hci_cp_le_set_ext_scan_param {
uint8_t own_addr_type;
uint8_t filter_policy;
uint8_t phys;
struct bt_hci_ext_scan_phy p[0];
struct bt_hci_ext_scan_phy p[];
} __packed;

/* Extends BT_HCI_LE_SCAN_FILTER_DUP */
Expand Down Expand Up @@ -1189,7 +1189,7 @@ struct bt_hci_cp_le_ext_create_conn {
uint8_t own_addr_type;
bt_addr_le_t peer_addr;
uint8_t phys;
struct bt_hci_ext_conn_phy p[0];
struct bt_hci_ext_conn_phy p[];
} __packed;

#define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044)
Expand Down Expand Up @@ -1354,7 +1354,7 @@ struct bt_hci_evt_role_change {
#define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13
struct bt_hci_evt_num_completed_packets {
uint8_t num_handles;
struct bt_hci_handle_count h[0];
struct bt_hci_handle_count h[];
} __packed;

#define BT_HCI_EVT_PIN_CODE_REQ 0x16
Expand Down Expand Up @@ -1510,11 +1510,11 @@ struct bt_hci_evt_le_advertising_info {
uint8_t evt_type;
bt_addr_le_t addr;
uint8_t length;
uint8_t data[0];
uint8_t data[];
} __packed;
struct bt_hci_evt_le_advertising_report {
uint8_t num_reports;
struct bt_hci_evt_le_advertising_info adv_info[0];
struct bt_hci_evt_le_advertising_info adv_info[];
} __packed;

#define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03
Expand Down Expand Up @@ -1593,7 +1593,7 @@ struct bt_hci_evt_le_direct_adv_info {
} __packed;
struct bt_hci_evt_le_direct_adv_report {
uint8_t num_reports;
struct bt_hci_evt_le_direct_adv_info direct_adv_info[0];
struct bt_hci_evt_le_direct_adv_info direct_adv_info[];
} __packed;

#define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c
Expand Down Expand Up @@ -1628,11 +1628,11 @@ struct bt_hci_evt_le_ext_advertising_info {
uint16_t interval;
bt_addr_le_t direct_addr;
uint8_t length;
uint8_t data[0];
uint8_t data[];
} __packed;
struct bt_hci_evt_le_ext_advertising_report {
uint8_t num_reports;
struct bt_hci_evt_le_ext_advertising_info adv_info[0];
struct bt_hci_evt_le_ext_advertising_info adv_info[];
} __packed;

#define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e
Expand All @@ -1654,7 +1654,7 @@ struct bt_hci_evt_le_per_advertising_report {
uint8_t unused;
uint8_t data_status;
uint8_t length;
uint8_t data[0];
uint8_t data[];
} __packed;

#define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10
Expand Down

0 comments on commit 8f9cd70

Please sign in to comment.