From e9618f1ba25c0560f490ce831e10d1906fa686b1 Mon Sep 17 00:00:00 2001 From: ldursw <37294448+ldursw@users.noreply.github.com> Date: Wed, 24 Mar 2021 11:30:19 -0300 Subject: [PATCH] Fix SDIO buffer alignment (#21396) --- Marlin/src/feature/binary_stream.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Marlin/src/feature/binary_stream.h b/Marlin/src/feature/binary_stream.h index 32ebcce2f..ba5d4e8bc 100644 --- a/Marlin/src/feature/binary_stream.h +++ b/Marlin/src/feature/binary_stream.h @@ -51,7 +51,12 @@ inline int bs_read_serial(const uint8_t index) { #if ENABLED(BINARY_STREAM_COMPRESSION) static heatshrink_decoder hsd; - static uint8_t decode_buffer[512] = {}; + #ifdef BOTH(ARDUINO_ARCH_STM32F1, SDIO_SUPPORT) + // STM32 requires a word-aligned buffer for SD card transfers via DMA + static __attribute__((aligned(sizeof(size_t)))) uint8_t decode_buffer[512] = {}; + #else + static uint8_t decode_buffer[512] = {}; + #endif #endif class SDFileTransferProtocol {