cancel
Showing results for 
Search instead for 
Did you mean: 

Data Align Packed Struct

jvavra
Associate III
Posted on April 10, 2014 at 14:18

I need to be sure that a struct I use has 32-bit alignment. My IDE (IAR) gives a preprocessor directive for this, which I am trying to use. However, the compiler keeps giving me warnings saying that I can't use this pragma here. Here is how I have used it within my header file where the struct is declared:

    &sharppragma data_alignment = 4

    typedef __packed struct

    {

        u8 data[1024];

    } BLOCK8_STRUCT;

Can anyone see anything wrong with what I'm trying to do?

Thanks

#stm32
1 REPLY 1
chen
Associate II
Posted on April 10, 2014 at 15:15

Hi

Looks to me like the code is trying do the pragma on a definition if the struct rather than on an instance of a struct.