Video: https://mongoose.ws/downloads/mongoose_netxduo.mp4
- Load Nx_TCP_Echo_Server example for STM32H573II Add IO retargeting to main.c:
int _write(int fd, unsigned char *buf, int len) {
if (fd == 1 || fd == 2) { // stdout or stderr ?
HAL_UART_Transmit(&huart1, buf, len, 999); // Print to the UART
}
return len;
}
Edit app_netxduo.c , fix TCP thread creation - stack size.
static char stk[8192];
ret = tx_thread_create(&AppTCPThread, "App TCP Thread", App_TCP_Thread_Entry, 0, stk, sizeof(stk),
NX_APP_THREAD_PRIORITY, NX_APP_THREAD_PRIORITY, TX_NO_TIME_SLICE, TX_DONT_START);
Edit app_netxduo.h, MAX TCP CLIENTS -> 5, NX_APP_PACKET_POOL_SIZE -> 50 Edit app_azure_rtos_config.h, NX_APP_MEM_POOL_SIZE -> 200k Cannot be edited via MX.
Build, flash, make sure it works.
- Generate wizard project for default dashboard, use integrate mode
- Add mongoose/mongoose_config.h with the following:
#define MG_ARCH MG_ARCH_THREADX
#define MG_ENABLE_PACKED_FS 1
-
Add BSD layer to NextDuo: Copy to mongoose dir: https://raw.githubusercontent.com/eclipse-threadx/netxduo/refs/tags/v6.4.0_rel/addons/BSD/nxd_bsd.c https://raw.githubusercontent.com/eclipse-threadx/netxduo/refs/tags/v6.4.0_rel/addons/BSD/nxd_bsd.h
Add to tx_user.h: #define TX_THREAD_USER_EXTENSION int bsd_errno; Add to nx_user.h #define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT Add CCRX build preprocessor constant Project -> Properties -> C/C++ -> Settings -> MCU Compiler -> Preprocessor
-
Add generated mongoose networking to the netx project: Middlewares / Add / Folder / Advanced / Link to alternate location / Choose generated mongoose dir Right click on mongosoe -> Add include paths
-
Add snippet to the beginning of app_netxduo.c :: App_Main_Thread_Entry:
static char bsd_stack[8192];
bsd_initialize(&NetXDuoEthIpInstance, &NxAppPool, bsd_stack, sizeof(bsd_stack), NX_APP_THREAD_PRIORITY);
mongoose_init();
for (;;) {
mongoose_poll();
}
Overall: netxduo feels very flaky and fragile. looses network when encounters an issue Difficult to configure all those constants, memory chunks, etc VERY difficult to configure from scratch using CubeMX (not using pre-built examples) Examples are low quality