diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/platforms/STM32/OTGv1/usb_lld.c | 6 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/chtypes.h | 5 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/chtypes.h | 5 | ||||
-rw-r--r-- | os/ports/RVCT/ARMCMx/chtypes.h | 5 |
4 files changed, 18 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c index 4af75ccd2..35b5335e5 100644 --- a/os/hal/platforms/STM32/OTGv1/usb_lld.c +++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c @@ -246,7 +246,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--;
}
@@ -345,7 +345,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--;
}
@@ -374,7 +374,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/ports/GCC/ARMCMx/chtypes.h b/os/ports/GCC/ARMCMx/chtypes.h index a94ae24ae..5116a79a7 100644 --- a/os/ports/GCC/ARMCMx/chtypes.h +++ b/os/ports/GCC/ARMCMx/chtypes.h @@ -75,6 +75,11 @@ typedef int32_t cnt_t; /**< Resources counter. */ */
#define PACK_STRUCT_END
+/**
+ * @brief Packed variable specifier.
+ */
+#define PACKED_VAR __attribute__((packed))
+
#endif /* _CHTYPES_H_ */
/** @} */
diff --git a/os/ports/IAR/ARMCMx/chtypes.h b/os/ports/IAR/ARMCMx/chtypes.h index 9855c4e00..d2a55bbfe 100644 --- a/os/ports/IAR/ARMCMx/chtypes.h +++ b/os/ports/IAR/ARMCMx/chtypes.h @@ -74,6 +74,11 @@ typedef int32_t cnt_t; /**< Resources counter. */ */
#define PACK_STRUCT_END
+/**
+ * @brief Packed variable specifier.
+ */
+#define PACKED_VAR __packed
+
#endif /* _CHTYPES_H_ */
/** @} */
diff --git a/os/ports/RVCT/ARMCMx/chtypes.h b/os/ports/RVCT/ARMCMx/chtypes.h index b3f19f674..ec76fd523 100644 --- a/os/ports/RVCT/ARMCMx/chtypes.h +++ b/os/ports/RVCT/ARMCMx/chtypes.h @@ -74,6 +74,11 @@ typedef int32_t cnt_t; /**< Resources counter. */ */
#define PACK_STRUCT_END
+/**
+ * @brief Packed variable specifier.
+ */
+#define PACKED_VAR __packed
+
#endif /* _CHTYPES_H_ */
/** @} */
|