Hi, and.. sorry . exactly say, It is lwip stack question in SDK(2.13 EVK-MIMXRT1020), but . Please help ..
I am developting project by using SDK with RT1020, so , really .. I do not know what I have to do..
. I will make 4ea tcp/udp task with 8 connections, each port. 2connection.
Question1.
I can not understand differences between [udp_new -> udp bind -> udp_recv-> udp_remove ] and
[sock(for udp) -> bind -> recvfrom -> close.] process. . tcpip case. same. tcp_new ~ tcp_bind~~~~
what is the difference ?? Purpose of use (TCP/UDP)_new() ??
Question 2.
From SDK example, (evkmimxrt1020_lwip_ipv4_ipv6_echo_freertos),
#define LWIP_TCPIP_CORE_LOCKING 1 in lwipopts.h so. After adding new task on stack_init.
static void stack_init(void *arg)
{
~~~
shell_task_init(NULL, 0);
xTaskCreate( Start_xxx, ( const char * const )"xxxLauncher",
configMINIMAL_STACK_SIZE + 4096 , NULL, INIT_THREAD_PRIO, NULL );
vTaskDelete(NULL);
}
static void Start_xxx(void *arg) {
~~~
udp_new();
udp_bind();
while(~~) {
udp_recv();
~~~ }
}
this code is stuck, with message "function called without core lock"
so, Every calling of udp_xxx() function group, I need to attach locking like below
LOCK_TCPIP_CORE();
udp_new();
UNLOCK_TCPIP_CORE();
LOCK_TCPIP_CORE();
udp_bind();
UNLOCK_TCPIP_CORE();
LOCK_TCPIP_CORE();
udp_recv();
UNLOCK_TCPIP_CORE();
But It is so uncomfortable... Why locking sentence is not inside udp_xxx();
and From googling with keyword "udp_new", nealy, I cannot find this uncomfortable code including lock/unlock before-after udp_xxxx()
So, Is there any good example (from SDK, or not) using tcp/udp_xxxx() func. ??
And Really , Do I need to add lock/unlock code back and forth of every tcp/udp_xxxx() func?
or How about this ? In lwipopts.h
/* ---------- Core locking ---------- */
#define LWIP_TCPIP_CORE_LOCKING 0
void sys_lock_tcpip_core(void);
#define LOCK_TCPIP_CORE() //sys_lock_tcpip_core()
void sys_unlock_tcpip_core(void);
#define UNLOCK_TCPIP_CORE() //sys_unlock_tcpip_core()
void sys_check_core_locking(void);
#define LWIP_ASSERT_CORE_LOCKED() //sys_check_core_locking()
void sys_mark_tcpip_thread(void);
#define LWIP_MARK_TCPIP_THREAD() //sys_mark_tcpip_thread()