cancel
Showing results for 
Search instead for 
Did you mean: 

NetX Duo BSD integration

robmilne
Associate III

Has anyone successfully used the BSD addon for netxduo inside CubeIDE?  I followed the instructions at the top of https://learn.microsoft.com/en-us/azure/rtos/netx/netx-bsd/chapter2 (the #define TX_THREAD_EXTENSION_3 int bsd_errno needed a trailing semi-colon) but the netx timeval and fd_set definitions conflict with the CubeIDE environment (/ST/STM32CubeIDE_1.10.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/arm-none-eabi/include/select.h and /ST/STM32CubeIDE_1.10.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/arm-none-eabi/include/sys/_timeval.h).

My only reason for using BSD is to to implement ModbusTCP with libmodbus .  I would gladly opt for a native netx implementation of ModbusTCP if anyone knows of one.

1 ACCEPTED SOLUTION

Accepted Solutions
Haithem Rahmani
ST Employee

hi @robmilne,

if you have a "nx_user.h" file in your project, please add the following

#ifdef __BSD_VISIBLE
#undef __BSD_VISIBLE
#endif

this should solve your problem.

 

regards
haithem.

 

View solution in original post

4 REPLIES 4
Haithem Rahmani
ST Employee

hi @robmilne,

if you have a "nx_user.h" file in your project, please add the following

#ifdef __BSD_VISIBLE
#undef __BSD_VISIBLE
#endif

this should solve your problem.

 

regards
haithem.

 

robmilne
Associate III

Hi Haithem,

Thanks!

Your code stops compiler errors for the NetXDuo BSD addon files, but I get build errors after I add the libmodbus sources to my project.  I think building my own ModbusTCP from scratch using NetX will be less complicated than figuring out how to make this sockets-based library work with CubeIDE.  I did find a Renesas project that integrated libmodbus with NetX+BSD, but it was tailored to their environment and the libmodbus version was not current.

Btw, I had already reached this point by defining __BSD_VISIBLE as 0 in ..\tools\arm-none-eabi\include\sys\features.h, but your method is much better.

-rob

Hello, thank you for your assistance. I also encountered the fd_set conflict issue when using the IDE, and defining nx as 0 did not resolve it. Do you have any other suggestions or solutions?

Unfortunately, no. I abandoned this approach and modified my modbustcp library to use native NetX.