Integrating BSD library with Azure threadx RTOS

Prasad V 0 Reputation points
2023-04-18T14:09:49.2266667+00:00

Hi , I need to integrate BSD socket library into threadx RTOS for development. I followed the steps mentioned in the page https://learn.microsoft.com/en-us/azure/rtos/netx-duo/netx-duo-bsd/chapter1 I observe re-declaration error with the steps mentioned. Can you please help in integration? STM32 CubeIDE with AZURE RTOS version 6.1.12 is used for integration.

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
333 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 16,046 Reputation points
    2023-04-25T20:04:22.2533333+00:00

    Hi @Prasad V , Greetings! To set and integrate BSD with Azure RTOS, please follow the steps outlined in the article Installation and use of Azure RTOS NetX Duo BSD. The required files nxd_bsd.h and nxd_bsd.c can be obtained from the GitHub link. The demo samples can be found from the Samples directive of the GitHub repository.

    1. In order to use NetX Duo BSD place the above files in the directory where NetX Duo is installed. For example, if NetX Duo is installed in the directory "\threadx\arm7\green" then the nxd_bsd.h and nxd_bsd.c files should be copied into this directory.
    2. The ThreadX library must define bsd_errno in the thread local storage. Please find additional details below
      1. In tx_port.h, set one of the TX_THREAD_EXTENSION macros as follows:
        • #define TX_THREAD_EXTENSION_3 int bsd_errno
        • If TX_THREAD_EXTENSION_3 is already used, the user is free to use one of the other TX_THREAD_EXTENSION macros.
      2. Rebuild the ThreadX library
    3. Before using NetX Duo BSD Services, the NetX Duo library must be built with NX_ENABLE_EXTENDED_NOTIFY_SUPPORT defined. By default it is not defined. If the BSD raw sockets are to be used, the NetX Duo library must be built with NX_ENABLE_IP_RAW_PACKET_FILTER defined.
    4. 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. Please find the snippet below
       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*);
    

    Hope this helps! Please let us know if you have any additional questions or need further assistance on this in the comments below.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.