From b1e8a80477403bb00bdb44a155d831f25cf7fb7b Mon Sep 17 00:00:00 2001 From: George Harris Date: Sat, 25 Jan 2020 22:35:39 +0100 Subject: Fix unaligned access with LTO (#7801) Forces 4 byte alignment for USB input & output buffers to prevent unaligned accesses by chibios with LTO enabled --- tmk_core/protocol/chibios/usb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tmk_core/protocol/chibios/usb_main.c') diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 966524c9dd..5a10ef69f2 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -246,8 +246,8 @@ typedef struct { .in_size = stream##_EPSIZE, \ .out_size = stream##_EPSIZE, \ .fixed_size = fixedsize, \ - .ib = (uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ - .ob = (uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ + .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ + .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ } \ } -- cgit v1.2.3