Sintax error when using pack_struct_end.h and gcc compiler

I’m using STM32Cube IDE with gcc compiler. The code includes FreeRTOS + TCP and compiled without errors, but all header files containing pack_struct_end.h show syntax error after line with #include pack_struct_end.h and pack_struct_end.h file itself shows error at
__attribute__( ( packed ) );
…/Compiler/gcc directory is included in the Project include paths.
Checked all topics related to #include pack_struct_end.h, but didn’t find answer.

What is the error do you get? I did a quick test and STM32Cube with GCC does seem to work with __attribute__( ( packed ) ); .


You said it compiles but shows syntax errors - so I am assuming the compiler is not giving the errors but you are seeing errors being marked in the editor. Is that correct? If so, then ignore them. The compiler is all the counts - various editors try to do the compiler’s job and get it wrong, and in trying to be helpful in this way cause a lot of questions similar to this.

That’s right, it is confusing, when compilation has finished and files still show “syntax error”. First I ignored it, but I’m not getting correct response from stack ARP protocol, when pinging my board from PC, I thought it might be the reason.
I have to add, that errors are underlining code statements with yellow color, not with red, like in compile errors.

About the Eclipse syntax checks in the editor, you can go to “Window → preferences”, search “annotations”. You will see the warning and error symbols. Here you can disable them to get a clean vertical ruler, and no more squiggly underlining like I had here:


You wrote:

I’m not getting correct response from stack ARP protocol

I suppose you have defined ipconfigREPLY_TO_INCOMING_PINGS as 1?
Could you run WireShark while you send a few pings? Do you see a response?
Does your board receive packets at all? You can observe that in prvNetworkInterfaceInput() in NetworkInterface.c.

Have you checked the contents of your function HAL_ETH_MspInit(): it initialises the low-level hardware like GPIO, CLOCK, NVIC. You can see my STM32Fx version of HAL_ETH_MspInit() here.

Did you get the PHY OK ( see your other thread ).

About posting: within two months, you created 5 threads about the STM32.
It is OK to keep on using the same thread and ask more and more questions. That is easier for the reader: all information is kept together on a single web-page.
Thank you.

Thanks Hein,
Regarding syntax error:
I was able to get rid of squiggly underlining by disabling in Annotations “C/C++ Indexer Markers” (not sure what does it mean
) and why before getting rid of them, when placing mouse pointer above underlined statements it displayed “syntax error”.
Regarding pinging problem:
Yes, I have defined ipconfigREPLY_TO_INCOMING_PINGS as 1
WireShark when filtered only ARP protocol, showed both IP and MAC sent by PC correctly and also correct IP response value setup in board firmware, but MAC value of the firmware was wrong, always zero.
GPIO, CLOCK, NVIC, HAL_ETH_MspInit() were automatically created by STM32CubeMX. I double checked board schematic and stm32f407 reference manual and all initial settings (including HAL_ETH_MspInit()) by STM32CubeMX and it looked correct.
As I mentioned in previous link, HAL_ETH_Init() returned HAL_OK.