2024-08-10 12:51 AM
Hello All,
Can you guys please help me where I can find the info on what the pragma pack means how and when to use it I am new to c and ingeneral to arm controllers ,any help hints are appreciated, I googled but a lot of confusing results for a person with no knowledge about this topic
Thanks again
Solved! Go to Solution.
2024-08-10 01:32 AM
You need the compiler documentation.
As you've posted in STM32CubeIDE, the compiler it uses is GCC - so you need the GCC documentation:
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/pragmas-accepted-by-gcc.html
Specifically:
Structure packing can also be achieved using __attribute__:
https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Packed-Structures.html
https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Type-Attributes.html
On structure packing/padding in general:
https://en.wikipedia.org/wiki/Data_structure_alignment
http://www.catb.org/esr/structure-packing/
2024-08-10 01:32 AM
You need the compiler documentation.
As you've posted in STM32CubeIDE, the compiler it uses is GCC - so you need the GCC documentation:
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/pragmas-accepted-by-gcc.html
Specifically:
Structure packing can also be achieved using __attribute__:
https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Packed-Structures.html
https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Type-Attributes.html
On structure packing/padding in general:
https://en.wikipedia.org/wiki/Data_structure_alignment
http://www.catb.org/esr/structure-packing/
2024-08-17 05:24 AM
Dear Andrew,
Thank you so much for your help it is much appreciated ,
Sorry for my late reply I was out of the country on work only goy back 2 days ago
Thank you so much once again
Regards PJe
2024-08-20 02:50 AM
You're welcome.
Please mark the solution:
https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256