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

10 REPLIES 10
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.

WHam.1
Associate III

May be my  you tube site will help you even though the speaking language is korean. 

https://www.youtube.com/watch?v=YVdNClVnT1s

 

WHam.1
Associate III

Please refer to my new youtube  for simpletest ECAT Master program Developed on STM32F769I-DISC board by using nxd_bsd and Netx Duo in Azure RTOS  operating combined with XMC4800 ECAT Slave Board.   

 

https://studio.youtube.com/video/NWQJTNXTehI/edit

 

WHam.1
Associate III

Neglect  my previous reply. Sorry for that.

 

Please refer to my new youtube  for simpletest ECAT Master program Developed on STM32F769I-DISC board by using nxd_bsd and Netx Duo in Azure RTOS  operating combined with XMC4800 ECAT Slave Board.   

https://www.youtube.com/watch?v=NWQJTNXTehI

 

JongOk Baek
Senior

Hello, robmilne.

 

I reached same error such as you.

Description	Resource	Path	Location	Type
expected ':', ',', ';', '}' or '__attribute__' before 'ULONG'	tx_api.h	/ZMG-390AZ_BSD/Middlewares/ST/threadx/common/inc	line 630	C/C++ Problem

So, I modified definition below. (with ';' semicolon end of the line)

#define TX_THREAD_EXTENSION_3						int bsd_errno;

 but, I reached error message below

error.png

I'm getting errors redefining libraries and definitions under internal gnu tools.

 

So, I uncomment the definition below in nxd_bsd.h

#define NX_BSD_RAW_SUPPORT
#define NX_BSD_ENABLE_NATIVE_API

Finally, the definition below throws an error:

#define NX_SOC_ERROR                       	-1                       /* Failure.                                                             */

'expected identifier before '-' token'

 

I wonder if this issue has been resolved.

Best regards,

 

 

 

robmilne
Associate III

Hi JongOk,

I abandoned this effort quite a while back. Sorry

-rob