aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-11-30 09:12:10 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-11-30 09:12:10 +0000
commit8a162d65ea7f9b84c6b895d0cebf8e6193f4f725 (patch)
tree5026324c6cbd169e5ac411bbc30786eb7088b3a8 /os
parent83fa155385e88ac06d6834604ab57c1132c5b0af (diff)
downloadChibiOS-8a162d65ea7f9b84c6b895d0cebf8e6193f4f725.tar.gz
ChibiOS-8a162d65ea7f9b84c6b895d0cebf8e6193f4f725.tar.bz2
ChibiOS-8a162d65ea7f9b84c6b895d0cebf8e6193f4f725.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6515 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/OTGv1/usb_lld.c6
-rw-r--r--os/nil/ports/ARMCMx/compilers/GCC/niltypes.h5
-rw-r--r--os/rt/ports/ARMCMx/compilers/GCC/chtypes.h5
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_ */
/** @} */