This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

'Packed' attribute support for STM32F4 (Cortex-M4)

Hi.

My target is a STM32 MCU with a Cortex-M4.

I have downloaded the arm-none-eabi toolchain for Windows 10 (gcc-arm-none-eabi-8-2018-q4-major).

I am compiling using Makefile and Cygwin.

In my software I need to use packed structures but when I compile my source code I have this warning message:

Fullscreen
1
warning: 'packed' attribute ignored [-Wattributes]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

To be sure I tested the feature with this code

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
typedef __packed struct
{
uint8_t field1;
uint32_t field2;
} test_pack;
int main(void)
{
test_pack t1;
printf("%d", sizeof(t1));
return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The expected result is 5 but the output is 8.

I found that '__packed' is defined in "gcc-arm-none-eabi-8-2018\arm-none-eabi\include\sys".

I have included these paths to compile command:

Fullscreen
1
2
3
gcc-arm-none-eabi-8-2018/arm-none-eabi/include
gcc-arm-none-eabi-8-2018/lib/gcc/arm-none-eabi/8.2.1/include
gcc-arm-none-eabi-8-2018/lib/gcc/arm-none-eabi/8.2.1/include-fixed
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Is the 'packed' attribute supported/working? Am I missing something or doing something wrong?

Thanks.

0