diff options
-rw-r--r-- | os/hal/ports/STM32/OTGv1/usb_lld.c | 6 | ||||
-rw-r--r-- | os/nil/ports/ARMCMx/compilers/GCC/niltypes.h | 5 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/compilers/GCC/chtypes.h | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/os/hal/ports/STM32/OTGv1/usb_lld.c b/os/hal/ports/STM32/OTGv1/usb_lld.c index 39464b367..433a75802 100644 --- a/os/hal/ports/STM32/OTGv1/usb_lld.c +++ b/os/hal/ports/STM32/OTGv1/usb_lld.c @@ -230,7 +230,7 @@ static uint8_t *otg_do_push(volatile uint32_t *fifop, uint8_t *buf, size_t n) { while (n > 0) {
/* Note, this line relies on the Cortex-M3/M4 ability to perform
unaligned word accesses and on the LSB-first memory organization.*/
- *fifop = *((uint32_t *)buf);
+ *fifop = *((PACKED_VAR uint32_t *)buf);
buf += 4;
n--;
}
@@ -328,7 +328,7 @@ static uint8_t *otg_do_pop(volatile uint32_t *fifop, uint8_t *buf, size_t n) { uint32_t w = *fifop;
/* Note, this line relies on the Cortex-M3/M4 ability to perform
unaligned word accesses and on the LSB-first memory organization.*/
- *((uint32_t *)buf) = w;
+ *((PACKED_VAR uint32_t *)buf) = w;
buf += 4;
n--;
}
@@ -357,7 +357,7 @@ static void otg_fifo_read_to_buffer(volatile uint32_t *fifop, if (max) {
/* Note, this line relies on the Cortex-M3/M4 ability to perform
unaligned word accesses and on the LSB-first memory organization.*/
- *((uint32_t *)buf) = w;
+ *((PACKED_VAR uint32_t *)buf) = w;
buf += 4;
max--;
}
diff --git a/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h b/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h index 8b206cb1d..5c4781909 100644 --- a/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h +++ b/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h @@ -77,6 +77,11 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ #define PORT_THD_FUNCTION(tname, arg) \
__attribute__((noreturn)) void tname(void *arg)
+/**
+ * @brief Packed variable specifier.
+ */
+#define PACKED_VAR __attribute__((packed))
+
#endif /* _NILTYPES_H_ */
/** @} */
diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h index 690b817a6..8acbbfa4e 100644 --- a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h +++ b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h @@ -101,6 +101,11 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ */
#define PORT_THD_FUNCTION(tname, arg) msg_t tname(void *arg)
+/**
+ * @brief Packed variable specifier.
+ */
+#define PACKED_VAR __attribute__((packed))
+
#endif /* _CHTYPES_H_ */
/** @} */
|