2024-06-05 09:26 PM - edited 2024-06-06 11:34 PM
I am trying to develop the Nx_TCP_Echo_Server example from scratch using library generation. While integrating MX_WIFI, I am encountering a compilation error related to NetX Duo and the Wi-Fi driver.
/Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: error: #error This file is included by the driver source, not compiled directly.
#error This file is included by the driver source, not compiled directly
/Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:27:2: error: #error This file is included by the driver source, not compiled directly. #error This file is included by the driver source, not compiled directly.
2024-06-07 12:55 AM
Hi
It's difficult to answer without knowing all the details of your project.
what do you mean by "using library generation" ?
As said in the error, nx_driver_framework.c must not be present in the IDE project file. It must not be compiled directly by the IDE.
It is included in nx_driver_emw3080.c.
What IDE are you using ? STM32CubeIDE ?
2024-06-07 05:13 AM
trying to develop athe Mxchip EMW380 WiFi module with the B-U585I-IOT02A board, using ThreadX RTOS and NetX Duo,
integrating temperature and barometric sensors (ISM330DHCX and LPS22HH) using I2C and establishing a WiFi connection via SPI2
and generated from .ioc file
https://wiki.stmicroelectronics.cn/stm32mpu/wiki/Introduction_to_NETXDUO
above example i have added driver file of mx_chip add to project file system and added the path for newly added file in C/C++m build setups , tree of project file added
and copied the app_thread.c .h and app_netx.c .h and other file from Nx_TCP_Echo_Server, to project file system
while compiling facing issue from
./Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:27:2: error: #error This file is included by the driver source, not compiled directly.
27 | #error This file is included by the driver source, not compiled directly.
| ^~~~~
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:33:1: error: unknown type name 'NX_DRIVER_INFORMATION'
33 | NX_DRIVER_INFORMATION nx_driver_information;
| ^~~~~~~~~~~~~~~~~~~~~
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: In function 'nx_driver_framework_entry_default':
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:258:48: error: 'NX_DRIVER_ERROR' undeclared (first use in this function); did you mean 'NX_CALLER_ERROR'?
258 | driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR;
| ^~~~~~~~~~~~~~~
| NX_CALLER_ERROR
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:258:48: note: each undeclared identifier is reported only once for each function it appears in
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: In function 'nx_driver_interface_attach':
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:312:24: error: request for member 'nx_driver_information_interface' in something not a structure or union
312 | nx_driver_information.nx_driver_information_interface = driver_req_ptr -> nx_ip_driver_interface;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: In function 'nx_driver_initialize':
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:378:24: error: request for member 'nx_driver_information_ip_ptr' in something not a structure or union
378 | nx_driver_information.nx_driver_information_ip_ptr = NX_NULL;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:381:24: error: request for member 'nx_driver_information_state' in something not a structure or union
381 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_NOT_INITIALIZED;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:381:55: error: 'NX_DRIVER_STATE_NOT_INITIALIZED' undeclared (first use in this function)
381 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_NOT_INITIALIZED;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:384:24: error: request for member 'nx_driver_information_packet_pool_ptr' in something not a structure or union
384 | nx_driver_information.nx_driver_information_packet_pool_ptr = ip_ptr -> nx_ip_default_packet_pool;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:387:24: error: request for member 'nx_driver_information_deferred_events' in something not a structure or union
387 | nx_driver_information.nx_driver_information_deferred_events = 0;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:412:26: error: request for member 'nx_driver_information_ip_ptr' in something not a structure or union
412 | nx_driver_information.nx_driver_information_ip_ptr = driver_req_ptr -> nx_ip_driver_ptr;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:422:26: error: request for member 'nx_driver_information_state' in something not a structure or union
422 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_INITIALIZED;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:422:57: error: 'NX_DRIVER_STATE_INITIALIZED' undeclared (first use in this function)
422 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_INITIALIZED;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:430:45: error: 'NX_DRIVER_ERROR' undeclared (first use in this function); did you mean 'NX_CALLER_ERROR'?
430 | driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR;
| ^~~~~~~~~~~~~~~
| NX_CALLER_ERROR
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: In function 'nx_driver_enable':
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:484:28: error: request for member 'nx_driver_information_state' in something not a structure or union
484 | if (nx_driver_information.nx_driver_information_state < NX_DRIVER_STATE_INITIALIZED)
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:484:59: error: 'NX_DRIVER_STATE_INITIALIZED' undeclared (first use in this function)
484 | if (nx_driver_information.nx_driver_information_state < NX_DRIVER_STATE_INITIALIZED)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:487:45: error: 'NX_DRIVER_ERROR' undeclared (first use in this function); did you mean 'NX_CALLER_ERROR'?
487 | driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR;
| ^~~~~~~~~~~~~~~
| NX_CALLER_ERROR
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:492:28: error: request for member 'nx_driver_information_state' in something not a structure or union
492 | if (nx_driver_information.nx_driver_information_state >= NX_DRIVER_STATE_LINK_ENABLED)
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:492:60: error: 'NX_DRIVER_STATE_LINK_ENABLED' undeclared (first use in this function); did you mean 'NX_IP_INTERFACE_LINK_ENABLED'?
492 | if (nx_driver_information.nx_driver_information_state >= NX_DRIVER_STATE_LINK_ENABLED)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NX_IP_INTERFACE_LINK_ENABLED
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:513:26: error: request for member 'nx_driver_information_state' in something not a structure or union
513 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_LINK_ENABLED;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: In function 'nx_driver_disable':
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:578:28: error: request for member 'nx_driver_information_state' in something not a structure or union
578 | if (nx_driver_information.nx_driver_information_state != NX_DRIVER_STATE_LINK_ENABLED)
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:578:60: error: 'NX_DRIVER_STATE_LINK_ENABLED' undeclared (first use in this function); did you mean 'NX_IP_INTERFACE_LINK_ENABLED'?
578 | if (nx_driver_information.nx_driver_information_state != NX_DRIVER_STATE_LINK_ENABLED)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NX_IP_INTERFACE_LINK_ENABLED
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:581:45: error: 'NX_DRIVER_ERROR' undeclared (first use in this function); did you mean 'NX_CALLER_ERROR'?
581 | driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR;
| ^~~~~~~~~~~~~~~
| NX_CALLER_ERROR
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:602:26: error: request for member 'nx_driver_information_state' in something not a structure or union
602 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_INITIALIZED;
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:602:57: error: 'NX_DRIVER_STATE_INITIALIZED' undeclared (first use in this function)
602 | nx_driver_information.nx_driver_information_state = NX_DRIVER_STATE_INITIALIZED;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c: In function 'nx_driver_packet_send':
| ^
../Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.c:1246:23: error: 'NX_DRIVER_ETHERNET_IP' undeclared (first use in this function)
1246 | if ((packet_type == NX_DRIVER_ETHERNET_IP) || (packet_type == NX_DRIVER_ETHERNET_IPV6))
| ^~~~~~~~~~~~~~~~~~~~~
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Middlewares/ST/netxduo/common/drivers/wifi/mxchip/subdir.mk:25: Middlewares/ST/netxduo/common/drivers/wifi/mxchip/nx_driver_framework.o] Error 1
make: *** Waiting for unfinished jobs....
2024-06-07 07:54 AM
Do you confirm you are using STM32CubeIDE to compile ?
The link you mention is wiki.stmicroelectronics.cn. I suggest you use wiki.st.com
The link points to a wiki that talks about stm32mpu. If you are working with a B-U585I-IOT02A, you should get information from stm32mcu wiki.
If you are using STM32CubeIDE , maybe you have used a project with "generate at root" option. In this mode, all the source files are installed in same folder as STM32CubeIDE .project and .cproject files, and in sub directory.
By default, STM32CubeIDE compiles all the source files (*.c files) that it finds near .cproject and .project and in sub directories.
The problem is that nx_driver_framework.c is in Middlewares/ST/netxduo/common/drivers/wifi/mxchip. It will be compiled automatically.
One solution is : if you used STM32CubeMX, change the project setting to generate STM32CubeIDE project but without "generate at root" option. It will create the STM32CubeIDE project files .project and .cproject in a STM32CubeIDE/ directory. The sources will be referenced with links in .project file. The problem is that it changes all your project.
Another solution is to rename nx_driver_framework.c as nx_driver_framework.h and change the #include line in nx_driver_emw3080.c to use the new name.