diff --git a/soes/esc.h b/soes/esc.h index f6f4535..d3beed0 100644 --- a/soes/esc.h +++ b/soes/esc.h @@ -573,7 +573,7 @@ typedef struct CC_PACKED CC_PACKED_END CC_PACKED_BEGIN -typedef struct CC_PACKED +typedef struct CC_PACKED CC_ALIGNED(4) { _MBXh mbxheader; _COEh coeheader; @@ -585,7 +585,7 @@ typedef struct CC_PACKED CC_PACKED_END CC_PACKED_BEGIN -typedef struct CC_PACKED +typedef struct CC_PACKED CC_ALIGNED(4) { _MBXh mbxheader; _COEh coeheader; diff --git a/soes/esc_coe.c b/soes/esc_coe.c index 14b832a..851f8e1 100644 --- a/soes/esc_coe.c +++ b/soes/esc_coe.c @@ -1022,8 +1022,8 @@ static void SDO_downloadsegment (void) (coesdo->command & COE_TOGGLEBIT); /* copy toggle bit */ init_coesdo(coeres, COE_SDORESPONSE, command, 0, 0); - uint32_t *mbxdata = (uint32_t *)&(coesdo->index); /* data pointer */ - copy2mbx (mbxdata, (uint8_t *)ESCvar.data, size); + void *mbxdata = &(coesdo->index); /* data pointer */ + copy2mbx (mbxdata, ESCvar.data, size); if (coesdo->command & COE_COMMAND_LASTSEGMENTBIT) { diff --git a/soes/include/sys/gcc/cc.h b/soes/include/sys/gcc/cc.h index b3067b0..c4598bd 100644 --- a/soes/include/sys/gcc/cc.h +++ b/soes/include/sys/gcc/cc.h @@ -32,6 +32,7 @@ extern "C" #define CC_PACKED_BEGIN #define CC_PACKED_END #define CC_PACKED __attribute__((packed)) +#define CC_ALIGNED(n) __attribute__((aligned (n))) #ifdef __rtk__ #define CC_ASSERT(exp) ASSERT (exp)