Hi All,
I’m working on getting Mongoose to compile under MCUxpresso for iMXRT. I’m hung up on one compile issue with mongoose.c:
“mongoose-master/mongoose.c:2665:56: error: macro “poll” requires 3 arguments, but only 2 given
m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);”
int mg_mgr_poll(struct mg_mgr *m, int timeout_ms) {
[…]
for (i = 0; i < m->num_ifaces; i++) {
m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);
}
[…]
}
But if I look in mongoose.h for the vtable poll definition it only specifies 2 arguments, as called. Where/how is my build picking up a vtable definition with 3 arguments?!
struct mg_iface_vtable {
[…]
time_t (*poll)(struct mg_iface *iface, int timeout_ms);
}
cpq
April 23, 2019, 12:29pm
2
I guess some of the header files has a poll
macro defined:
#define poll(a,b,c) ....
I suggest to add the -E
flag to the compilation line to see the preprocessed output, find mg_mgr_poll()
call and see where did the preprocessor take the poll definition from.
I did a build with -E. But I’m not seeing a mg_mgr_poll reference. How do I see the preproc references in MCUxpresso (ie Eclipse)…hrmm … ??
Invoking: MCU C Compiler
C:/NXP/IMXRT1060-EVK_CIRAS4/ThirdParty/mongoose-master/mongoose.c:2665:56: error: macro “poll” requires 3 arguments, but only 2 given
arm-none-eabi-gcc -std=gnu11 -E -D__MCUXPRESSO -D__USE_CMSIS -D__NEWLIB__ -DCPU_MIMXRT1062CVL5A -DXIP_EXTERNAL_FLASH=1 -DXIP_BOOT_HEADER_ENABLE=1 -DXIP_BOOT_HEADER_DCD_ENABLE=1 -DDEBUG -DSKIP_SYSCLK_INIT -DEW_MAX_SURFACE_CACHE_SIZE=0x200000 -DEW_MAX_GLYPH_SURFACE_WIDTH=256 -DEW_MAX_GLYPH_SURFACE_HEIGHT=256 -DEW_USE_DOUBLE_BUFFER=1 -DEW_CPU_LOAD_MEASURING=1 -DEW_USE_FREE_RTOS=0 -DEW_FRAME_BUFFER_COLOR_FORMAT=EW_FRAME_BUFFER_COLOR_FORMAT_RGB565 -DEW_SURFACE_ROTATION=0 -DFSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE -D__USE_IMXRT -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/Application/GeneratedCode" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/Application/Source" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/TargetSpecific" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/TargetSpecific/Drivers" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/mongoose-master" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip/src/include" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip/board" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip/port" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/TLSF" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/Xprintf" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/CMSIS/Include" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities/io" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities/log" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities/str" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/drivers" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/xip" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/PlatformPackage/RTE" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/PlatformPackage/RGB565" -O0 -fno-common -g -Wall -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -D__NEWLIB__ -MMD -MP -MF"startup_mimxrt1062.d" -MT"startup_mimxrt1062.o" -MT"startup_mimxrt1062.d" -o “startup_mimxrt1062.o” “…/startup_mimxrt1062.c”
m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);
arm-none-eabi-gcc -std=gnu11 -E -D__MCUXPRESSO -D__USE_CMSIS -D__NEWLIB__ -DCPU_MIMXRT1062CVL5A -DXIP_EXTERNAL_FLASH=1 -DXIP_BOOT_HEADER_ENABLE=1 -DXIP_BOOT_HEADER_DCD_ENABLE=1 -DDEBUG -DSKIP_SYSCLK_INIT -DEW_MAX_SURFACE_CACHE_SIZE=0x200000 -DEW_MAX_GLYPH_SURFACE_WIDTH=256 -DEW_MAX_GLYPH_SURFACE_HEIGHT=256 -DEW_USE_DOUBLE_BUFFER=1 -DEW_CPU_LOAD_MEASURING=1 -DEW_USE_FREE_RTOS=0 -DEW_FRAME_BUFFER_COLOR_FORMAT=EW_FRAME_BUFFER_COLOR_FORMAT_RGB565 -DEW_SURFACE_ROTATION=0 -DFSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE -D__USE_IMXRT -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/Application/GeneratedCode" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/Application/Source" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/TargetSpecific" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/TargetSpecific/Drivers" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/mongoose-master" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip/src/include" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip/board" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/lwip/port" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/TLSF" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/Xprintf" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/CMSIS/Include" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities/io" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities/log" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/utilities/str" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/drivers" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/ThirdParty/MCUXpressoSDK/devices/MIMXRT1062/xip" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/PlatformPackage/RTE" -I"C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Project/MCUXpresso/IMXRT1060-EVK/…/…/…/…/PlatformPackageFinished building: C:/NXP/IMXRT1060-EVK_CIRAS4/Application/Source/ppsys_util.c
^
/RGB565" -O0 -fno-common -g -Wall -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -D__NEWLIB__ -MMD -MP -MF"Application/GeneratedCode/Views.d" -MT"Application/GeneratedCode/Views.o" -MT"Application/GeneratedCode/Views.d" -o “Application/GeneratedCode/Views.o” “C:/NXP/IMXRT1060-EVK_CIRAS4/Application/GeneratedCode/Views.c”
Finished building: C:/NXP/IMXRT1060-EVK_CIRAS4/Application/GeneratedCode/Application.c
LWIP has a poll defined as well in tcp.h. But its not a macro, so that shouldnt be it.
#if LWIP_CALLBACK_API
/* Function to be called when more send buffer space is available. /
tcp_sent_fn sent;
/ Function to be called when (in-sequence) data has arrived. /
tcp_recv_fn recv;
/ Function to be called when a connection has been set up. /
tcp_connected_fn connected;
/ Function which is called periodically. /
tcp_poll_fn poll;
/ Function to be called whenever a fatal error occurs. /
tcp_err_fn errf;
#endif / LWIP_CALLBACK_API */
I stuck a 3rd argument of 0 in there just to see what would happen. Interestingly it complains about a LWIP variable now ( ‘lwip_poll’):
C:/NXP/IMXRT1060-EVK_CIRAS4/ThirdParty/mongoose-master/mongoose.c: In function ‘mg_mgr_poll’:
C:/NXP/IMXRT1060-EVK_CIRAS4/ThirdParty/mongoose-master/mongoose.c:2665:25: error: ‘const struct mg_iface_vtable’ has no member named ‘lwip_poll’
m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms,0);
cpq
April 23, 2019, 1:44pm
6
When you add -E
to the compilation line, the output should be a preprocessed source, with all macros expanded. I do not see that in your output. You keep posting something different.
Please read about the -E
flag, and cpp
binary (the C preprocessor), it’s output, etc.
Also, please enclose the source code, and the command outputs, in the triple backticks (this is the markdown syntax) to help readers of your posts.
Well, I have -E specified. What am I forgetting?
Ok, adding “-save-temps” allowed MCUxpresso to retain the .i preprocessor files.
But, that just deepened the mystery as ->poll has no arguments…??
# 2643 "C:/NXP/IMXRT1060-EVK_CIRAS4/ThirdParty/mongoose-master/mongoose.c"
; conn = tmp_conn) {
[...]
int mg_mgr_poll(struct mg_mgr *m, int timeout_ms) {
int i, num_calls_before = m->num_calls;
for (i = 0; i < m->num_ifaces; i++) {
m->ifaces[i]->vtable->poll;
}
return (m->num_calls - num_calls_before);
}