Skip to content

Commit ffbf380

Browse files
committed
NO_CACHE also need to be aligned
Usualy NO_CACHE is used for data that is accessed by DMA. DMA needs so alignment. Set some safe 4 byte align for all NO_CACHE
1 parent f236b49 commit ffbf380

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

firmware/hw_layer/ports/stm32/stm32f4/global_port.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
#if defined(AT32F4XX)
1111
#define CCM_OPTIONAL
1212
#define SDRAM_OPTIONAL
13-
#define NO_CACHE
13+
#define NO_CACHE __attribute__((aligned(4)))
1414
#define BKUP_RAM_NOINIT
1515
#else
1616
// CCM memory is 64k
1717
#define CCM_OPTIONAL __attribute__((section(".ram4")))
1818
#define SDRAM_OPTIONAL __attribute__((section(".ram7")))
19-
#define NO_CACHE // F4 has no cache, do nothing
19+
#define NO_CACHE __attribute__((aligned(4))) // F4 has no cache, do nothing
2020
#define BKUP_RAM_NOINIT __attribute__((section(".bkup_ram_noinit")))
2121
#define MCU_HAS_CCM_RAM TRUE
2222
#endif

firmware/hw_layer/ports/stm32/stm32f7/global_port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// SRAM2 is 16k and set to disable dcache (see STM32_NOCACHE_ENABLE in mcuconf.h)
77
// we have another way to put something in no cache area - __nocache_ prefix in name
8-
#define NO_CACHE __attribute__((section(".ram2")))
8+
#define NO_CACHE __attribute__((aligned(4))) __attribute__((section(".ram2")))
99

1010
// TODO: test and switch to this
1111
// Current ChibiOS puts nocache data into SRAM3/DTCM that is not chached by design

firmware/hw_layer/ports/stm32/stm32h7/global_port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
//TODO: update LD file!
44
#define SDRAM_OPTIONAL __attribute__((section(".ram8")))
55
// SRAM3 is 32k and set to disable dcache
6-
#define NO_CACHE __attribute__((section(".ram3")))
6+
#define NO_CACHE __attribute__((aligned(4))) __attribute__((section(".ram3")))
77

88
#define BKUP_RAM_NOINIT __attribute__((section(".bkup_ram_noinit")))

0 commit comments

Comments
 (0)