Problems compiling IP support with arm-gcc for Cortex4

stemora wrote on Thursday, July 27, 2017:

Hi all,
we inserted ‘base’ FreeRTOS in our projects and everything work fine.
Now I need to add the Ethernet support and I added the TCP package.
For a compile test I onlt added the FreeRTOS_IP.c file: it generates a lot of errors.
I dig them until I guess to have found the root problem: in list.h file some functions are defined with the constant PRIVILEGED_FUNCTION.
This one generates the error:

FreeRTOS\include/list.h:386:6: error: old-style parameter declarations in prototyped function definition

and all the other errors.
I found the definition of this constant in mpu_wrappers.h: this is included by portable.h file that is included by FreeRTOS.h file.
My guess the problem is due to the late inclusion of FreeRTOS.h in the FreeRTOS_IP.c file: the previous inclusions of the .h files do not see the constant definitions and produce the error.
If I move the FreeRTOS.h before the FreeRTOS_
.h files I get the error:

include/tcp/FreeRTOS_ARP.h:77:2: error: unknown type name 'MACAddress_t'
  MACAddress_t xMACAddress;  /* The MAC address of an ARP cache entry. */

but this type is defined in the FreeRTOS_IP.h that’s included after the FreeRTOS_APR.h.

I’m lost in the inclusion order of the h files …

Thanks

rtel wrote on Thursday, July 27, 2017:

I’m not sure what would happen if you only built one source file. I
would recommend opening one of the example projects provided in the +TCP
(Labs) download to see the files that are being built. That can be done
using the Win32 example, which only requires the free community edition
of Visual Studio. Once you have the example project opened in Visual
Studio it should build without any problems, then you can use it as a
reference as to which files to build and which include paths to set.

stemora wrote on Tuesday, August 01, 2017:

Ok,
I’m able to compile the TCP+FAT files but I needed to change in every *.c file the include order as follow (ex. for FreeRTOS_DHCP.c):

...
/* Standard includes. */
#include <stdint.h>

#include "FreeRTOS.h"	//SM
#include "list.h"
#include <tcp/FreeRTOS_IP.h>
#include <tcp/FreeRTOS_IP_Private.h>
#include <tcp/FreeRTOS_Sockets.h>

#include <tcp/FreeRTOS_ARP.h>
#include <tcp/FreeRTOS_DHCP.h>
//#include <tcp/FreeRTOS_IP.h>
//#include <tcp/FreeRTOS_IP_Private.h>
//#include <tcp/FreeRTOS_Sockets.h>
#include <tcp/FreeRTOS_TCP_IP.h>
#include <tcp/FreeRTOS_UDP_IP.h>
#include <tcp/NetworkBufferManagement.h>
#include <tcp/NetworkInterface.h>

/* FreeRTOS includes. */
//-#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
...

It sounds a bit strage but that’s it …

heinbali01 wrote on Tuesday, August 01, 2017:

I’m not sure how or where you obtained the source code, but the current FreeRTOS_DHPC.c ( and other source files ) use these includes:

/* Standard includes. */
#include <stdint.h>

/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"

/* FreeRTOS+TCP includes. */
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_TCP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_ARP.h"

The project assumes that you have these as an include directory:

    -I FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include
    -I FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/Compiler/ [ GCC | IAR | MSVC | Renesas ]
    -I FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/protocols/include

Your post is a bit confusing: you write about “+FAT” and you’re showing source files that belong to the FreeRTOS+TCP library.

Can you please tell where you downloaded the sources?

stemora wrote on Wednesday, August 02, 2017:

I’m very sorry.
I compared my files against the original ones and I discovered that my colleague changed them :frowning:
The files are perfectly compilable for an LPC1778.
Sorry again.

By the way, is there a NetworkInterface.c file available for NXP LPC1778 ?
I found a version from a newsletter’s subscriber but it include some files not included on my sdk (by NXP):

#include "lpc17xx_emac.h"
#include "lpc17xx_pinsel.h"

Where I can find them, please?