-ftree-vrp better diagnostics on -Os builds; -fno-inline-functions for -O2; fix struct init in HCI bleio
This commit is contained in:
parent
bbbd621b18
commit
fb33c4e1c0
@ -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[]) {
|
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_hdr h;
|
||||||
struct bt_att_read_group_req r;
|
struct bt_att_read_group_req r;
|
||||||
} req = { {
|
} req_t;
|
||||||
.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;
|
|
||||||
|
|
||||||
|
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[]) {
|
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
|
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_hdr h;
|
||||||
struct bt_att_read_type_req r;
|
struct bt_att_read_type_req r;
|
||||||
} req = { {
|
} req_t;
|
||||||
.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;
|
|
||||||
|
|
||||||
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[]) {
|
STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
|
||||||
|
@ -94,21 +94,21 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CHIP_FAMILY), samd51)
|
ifeq ($(CHIP_FAMILY), samd51)
|
||||||
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
|
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
|
||||||
OPTIMIZATION_FLAGS ?= -Os
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
# TinyUSB defines
|
# TinyUSB defines
|
||||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CHIP_FAMILY), same51)
|
ifeq ($(CHIP_FAMILY), same51)
|
||||||
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
|
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
|
||||||
OPTIMIZATION_FLAGS ?= -Os
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
# TinyUSB defines
|
# TinyUSB defines
|
||||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CHIP_FAMILY), same54)
|
ifeq ($(CHIP_FAMILY), same54)
|
||||||
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
|
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
|
||||||
OPTIMIZATION_FLAGS ?= -Os
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
# TinyUSB defines
|
# TinyUSB defines
|
||||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||||
endif
|
endif
|
||||||
@ -116,6 +116,9 @@ endif
|
|||||||
# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
||||||
CFLAGS += $(OPTIMIZATION_FLAGS)
|
CFLAGS += $(OPTIMIZATION_FLAGS)
|
||||||
|
|
||||||
|
# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default.
|
||||||
|
CFLAGS += -ftree-vrp
|
||||||
|
|
||||||
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
|
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
|
||||||
#Debugging/Optimization
|
#Debugging/Optimization
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
|
@ -122,7 +122,7 @@ CFLAGS += \
|
|||||||
-fdata-sections \
|
-fdata-sections \
|
||||||
-Wall \
|
-Wall \
|
||||||
|
|
||||||
OPTIMIZATION_FLAGS ?= -O2
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
|
|
||||||
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
||||||
CFLAGS += $(OPTIMIZATION_FLAGS)
|
CFLAGS += $(OPTIMIZATION_FLAGS)
|
||||||
|
@ -80,7 +80,7 @@ ifeq ($(DEBUG), 1)
|
|||||||
OPTIMIZATION_FLAGS ?= -Og
|
OPTIMIZATION_FLAGS ?= -Og
|
||||||
else
|
else
|
||||||
CFLAGS += -DNDEBUG -ggdb3
|
CFLAGS += -DNDEBUG -ggdb3
|
||||||
OPTIMIZATION_FLAGS ?= -O2
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
# TODO: Test with -flto
|
# TODO: Test with -flto
|
||||||
### CFLAGS += -flto
|
### CFLAGS += -flto
|
||||||
endif
|
endif
|
||||||
|
@ -75,7 +75,7 @@ INC += \
|
|||||||
|
|
||||||
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
|
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
|
||||||
|
|
||||||
CFLAGS += -Os -DNDEBUG -ffreestanding
|
CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding
|
||||||
|
|
||||||
# TinyUSB defines
|
# TinyUSB defines
|
||||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024
|
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||||
@ -108,7 +108,7 @@ CFLAGS += \
|
|||||||
-g3 -Wno-unused-parameter \
|
-g3 -Wno-unused-parameter \
|
||||||
-ffunction-sections -fdata-sections -fstack-usage
|
-ffunction-sections -fdata-sections -fstack-usage
|
||||||
|
|
||||||
OPTIMIZATION_FLAGS ?= -O2
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
|
|
||||||
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
||||||
CFLAGS += $(OPTIMIZATION_FLAGS)
|
CFLAGS += $(OPTIMIZATION_FLAGS)
|
||||||
|
@ -89,7 +89,7 @@ ifeq ($(DEBUG), 1)
|
|||||||
CFLAGS += -ggdb3
|
CFLAGS += -ggdb3
|
||||||
OPTIMIZATION_FLAGS = -Og
|
OPTIMIZATION_FLAGS = -Og
|
||||||
else
|
else
|
||||||
OPTIMIZATION_FLAGS ?= -O2
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
CFLAGS += -DNDEBUG -ggdb3
|
CFLAGS += -DNDEBUG -ggdb3
|
||||||
CFLAGS += -flto -flto-partition=none
|
CFLAGS += -flto -flto-partition=none
|
||||||
endif
|
endif
|
||||||
|
@ -86,7 +86,7 @@ ifeq ($(DEBUG), 1)
|
|||||||
CFLAGS += -fno-inline -fno-ipa-sra
|
CFLAGS += -fno-inline -fno-ipa-sra
|
||||||
else
|
else
|
||||||
CFLAGS += -DNDEBUG
|
CFLAGS += -DNDEBUG
|
||||||
OPTIMIZATION_FLAGS ?= -O2
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
CFLAGS += -ggdb3
|
CFLAGS += -ggdb3
|
||||||
# TODO: Test with -flto
|
# TODO: Test with -flto
|
||||||
# CFLAGS += -flto
|
# CFLAGS += -flto
|
||||||
@ -95,6 +95,9 @@ endif
|
|||||||
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
||||||
CFLAGS += $(OPTIMIZATION_FLAGS)
|
CFLAGS += $(OPTIMIZATION_FLAGS)
|
||||||
|
|
||||||
|
# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default.
|
||||||
|
CFLAGS += -ftree-vrp
|
||||||
|
|
||||||
# MCU Series is defined by the HAL package and doesn't need to be specified here
|
# MCU Series is defined by the HAL package and doesn't need to be specified here
|
||||||
C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT)
|
C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user