FreeRTOS send ethernet frames

I’m trying to forward raw ethernet frames generated by an application. I have seen several examples using lwip to handle TCP and UDP packets, however I need to work at lower level. In linux kernel is possible to work with net_device structure and related functions to receive and send raw packets. Is it possible also in FreeRTOS?

Thanks in advance

Which services from a network stack do you need at all ?
Raw ethernet frames are basically handled by your ethernet (MAC) driver.

Thanks, I just need to be able to receive ethernet frames and send them out. Actually I’m using FreeRTOS on top of the Xilinx Ultrascale. I imagine that lwip and the RTOS tcp stack is able to use such low level functionalities.

Xilinx provide a BSP that accesses the MAC hardware - can you just use that BSP without lwIP?

Yes, but I was wondering if there exist something in the middle since Xilinx BSP is quite complex and examples are not very clear.

The Xilinx support for LWIP can be found here:

This support provides the Xilinx MAC interface to LWIP so perhaps you can use it as examples for your raw interface.
If there is a middle interface it will be in LWIP and not part of FreeRTOS.

FreeRTOS does include FreeRTOS+TCP and there is a port for the Xilinx MAC here:

that code could be used as an example for creating a raw interface. Taking a simplistic look at it, there are fewer files in the +TCP interface so perhaps it will be easier to extract an example.

FreeRTOS+TCP indeed has a port for Xilinx UltraScale. I uploaded a testing makefile project for UltraScale here.

FreeRTOS+TCP lets you send raw packets by doing a system call eNetworkTxEvent.
For reception there is an application hook that you can use, see ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES .

In case you decide to use FreeRTOS+TCP, you can ask any further questions in this thread.

Thanks to everyone for the replies. All considered I’m looking to use directly FreeRTOS+TCP and I’m trying to understand the examples to make the raw interface.

I have imported FreeRTOS in my Vitis project (I started with a new HelloWorld FreeRTOS application). However, when I try to compile it I get the following error (refers to this link)

…/src/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/xilinx_ultrascale/uncached_memory.c:79:26: error: ‘XPAR_PS7_DDR_0_S_AXI_HIGHADDR’ undeclared (first use in this function); did you mean ‘XPAR_PSU_DDR_0_S_AXI_HIGHADDR’?

Anyone had this issue?

Doesn’t it say the following?

#if ( ipconfigULTRASCALE == 1 )
    /* Reserve 2 MB of memory. */
    #define uncMEMORY_SIZE        0x200000U
    /* Reserve 1 MB of memory. */
    #define uncMEMORY_SIZE        0x100000U
    #define DDR_MEMORY_END        ( XPAR_PS7_DDR_0_S_AXI_HIGHADDR + 1 )
    #define uncMEMORY_ATTRIBUTE   0x1C02
#endif /* ( ipconfigULTRASCALE == 1 ) */

If you #define ipconfigULTRASCALE 1 in your FreeRTOSIPConfig.h, it should compile.

Note that this module “uncached_memory.c” is shared with the Xilinx Zynq 7000 project.