RA6M4 Azure RTOS nxd_bsd.c raw socket

Hi,

I am trying to use raw socket on nxd_bsd.c, but running into some errors. I can't find the function for _nx_driver_hardware_packet_received_callback and _nx_driver_hardware_packet_send.

Please can someone help me locate where these functions are?

Thanks in advance,

Victor

  • Hi Victor,

    Glad it worked.

    Do you have further questions regarding this issue then ?

  • Hi AZ,

    The code you sent did compile with no error, but that is an empty project. it has no function calls and the #define NX_BSD_RAW_SUPPORT  was not enabled in nx_bsd.h. So, if you add code and enable the #define NX_BSD_RAW_SUPPORT, you will see an error. You can add the code I sent yesterday to your project and compile.

    How do one insert a file here. I tried using insert, but was unable to upload a zip file of your project that I modified.

    The main question I have is, where is _nx_driver_hardware_packet_send function define? I can't locate it.

    Please, take a look at this from ST, https://github.com/STMicroelectronics/x-cube-azrtos-h7/blob/33d13302a3d58ec4c86091a6e81185996f3f75c8/Middlewares/ST/netxduo/common/drivers/nx_stm32_eth_driver.c. From line 1886 to 1996 shows that the function was provide to ST back in 2020. I am expecting there should be a function like that for RA processors.

    Thanks,

    Victor

  • According to NetX documentation on https://learn.microsoft.com/en-us/azure/rtos/netx-duo/netx-duo-bsd/chapter2 , in order to enable raw socket support: 

    So I do not think that NX_BSD_RAW_SUPPORT should be enabled.

  • Thanks for your reply. I have NX_ENABLE_IP_RAW_PACKET_FILTER and NX_BSD_RAW_SUPPORT enabled. I will disable NX_BSD_RAW_SUPPORT and try again.

  • Hi AZ,

    I really need to enable NX_BSD_RAW_SUPPORT for me to support LLDP protocol. When I disable it, I get the errors shown below.

    These errors is a result of sockaddr_ll struct not defined in nx_bsd.h, as shown below.

    As you can see, for me to use sockaddr_ll struct I need to enable NX_BSD_RAW_SUPPORT. 

    The problem I have is when I enable NX_BSD_RAW_SUPPORT, I get the errors shown below.

    The question is where are these defined or what do I need to do to be able use these functions?

    Thanks,

    Victor

  • Hello  Victor,

    As my colleague told you "These functions are provided by Azure RTOS so the full body of the function may be unavailable". This error occurs since your calling on your new thread's function bsd_initialize() function. Notice that you do not have to call this function since this is automatically called  by NetX BSD Support Module. If you will not call this function and call any other NetX BSD Support Module API  you will see that these errors ,no longer appear.

    Best Regards,

    IK

  • Hi IK,

    According to the Microsoft documentation, it says you need to call the bsd_initialize function (see link and description below). What function should I call in order to use the NetX BSD Support Module?

     

     

    Using NetX Duo BSD

    A NetX Duo BSD application project must include nxd_bsd.h after it includes tx_api.h and nx_api.h to be able to use BSD services specified later in this guide. The application must also include nxd_bsd.c in the build process. This file must be compiled in the same manner as other application files and its object form must be linked along with the files of the application. This is all that is required to use NetX Duo BSD.

    To utilize NetX Duo BSD services, the application must create an IP instance, create a packet pool for the BSD layer to allocate packets from, allocate memory space for the internal BSD thread stack, and specify the priority of the internal BSD thread. The BSD layer is initialized by calling bsd_initialize and passing in the parameters. This is demonstrated in the "Small Examples" later in this document but the prototype is shown below:

    CCopy

    INT bsd_initialize(NX_IP *default_ip, NX_PACKET_POOL *default_pool,

                        *CHAR *bsd_thread_stack_area,

                        *ULONG bsd_thread_stack_size,

                        *UINT bsd_thread_priority*);

    The default_ip is the IP instance the BSD layer operates on. The default_pool is used by the BSD services to allocate packets from. The next two parameters: bsd_thread_stack_area, bsd_thread_stack_size defines the stack area used by the internal BSD thread, and the last parameter, bsd_thread_priority, sets the priority of the thread.

    Best Regards,

    Victor

  • Hey IK,

    I'm working with Victor on this. Any thoughts on his comment below?

    The Microsoft documentation that Renesas refers to seems to be saying different than what you and AZ are saying. 

    Please advise what function is to be called to use the NetX module if bsd_initialize is not to be used. 

    Best Regards

  • Hi Victor,

    I have the same problem .  I can't find the function for _nx_driver_hardware_packet_received_callback and _nx_driver_hardware_packet_send.

    Was this problem solved?

    Thanks,

    Martin