Linux Simulator TCP/UDP fails

Hello everyone.
I’m using the Posix / GCC provided by v10.4.0 version, teaching my students about the ecosystem of FreeRTOS and i’m have some trouble to make a UDP connection. I use UDP to control a in/out door into my lab.

I created a new file, called “main_solution” that is invoked on default main. This file creates a task that opens a socket.

The FreeRTOS_IPInit () function hangs on malloc.

Here is the log of gdb where the program hangs:

at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/MemMang/heap_3.c:64
pvReturn = malloc( xWantedSize );

And here is my code of “main_solution.c”

Are The UDP/TCP stack and functions provided by v10.4.0 on Linux Port functional or its just a demo?

Thanks!

I’m assuming malloc() is returning NULL?

Is that failing when the task that handles the TCP/IP stack is created inside FreeRTOS_IPInit()? Which is this call here: https://github.com/FreeRTOS/FreeRTOS/blob/master/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c#L1058

If so, what is the value of ipconfigIP_TASK_STACK_SIZE_WORDS - that is the constant that sets the IP task’s stack size - this is where it is set: https://github.com/FreeRTOS/FreeRTOS/blob/master/FreeRTOS/Demo/Posix_GCC/FreeRTOSIPConfig.h#L111

Unless ipconfigIP_TASK_STACK_SIZE_WORDS is massive, it is odd malloc() will fail, as if you are using heap_3 then it is using the malloc() implemented by the C library.

Can you try and remove the printf from the hook function you have defined (vApplicationIPNetworkEventHook) ?
printf is a thread safe function that takes a lock, so as the malloc function, this “might” be causing the malloc or printf to hang.

Is your program hanging all the time?

Could you also post the result of (gdb) info threads and (gdb) thread apply all bt full

If you could post your code in a way I could just copy and try it out, it would be great :slight_smile:

Hi. I found where the code hangs.

In FreeRTOS_IPInit():

xNetworkEventQueue = xQueueCreate( ( UBaseType_t ) ipconfigEVENT_QUEUE_LENGTH, ( UBaseType_t ) sizeof( IPStackEvent_t ) );

On First malloc:

pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) + xQueueSizeInBytes ); 

Then,

pvReturn = malloc( xWantedSize );

The code stucks and the trace output is saved to Trace.dump

There is the code:


Note:
The code is different from the one posted earlier, because I kept trying other alternatives to make it work, however, the logic is the same.

Thanks!

to post code place it between two rows of backtick characters

Thank you, Richard. There is the code:

#include <stdio.h>
#include <pthread.h>
 
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
 
 
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
 
/* Local includes. */
#include "console.h"
 
static void prvTaskOne( void *pvParameters );
 
static uint8_t MACAddress[ 6 ] = { 0x40, 0x49, 0x0F, 0xC0, 0x54, 0x63 };
static const uint8_t IPAddress[ 4 ] = { 127, 0, 0, 1 };
static const uint8_t NetMask[ 4 ] = { 0, 0, 0, 255 };
static const uint8_t GatewayAddress[ 4 ] = { 192, 168, 2, 1 };
 
//static const uint8_t DNSServerAddress[ 4 ] = { 194, 14, 11, 200 };
static const uint8_t DNSServerAddress[ 4 ] = { 200, 11, 14, 194 };
 
 
 
int solution(){
 
    FreeRTOS_IPInit( IPAddress,
                     NetMask,
                     GatewayAddress,
                     DNSServerAddress,
                     MACAddress );
        
 
    vTaskStartScheduler();
    return 0;
}
 
static void prvTaskOne(void *pvParameters){ 
    xSocket_t xSocket;
 
    console_print("Criando primeira task \n");
    xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
    configASSERT(xSocket != FREERTOS_INVALID_SOCKET);
    console_print("Socket criado");
 
    uint8_t ucBuffer[ 128 ];
    struct freertos_sockaddr xDestinationAddress;
    int32_t iReturned;
 
    /* Fill in the destination address and port number, which in this case is
    port 1024 on IP address 192.168.0.100. */
    xDestinationAddress.sin_addr = FreeRTOS_inet_addr_quick( 127, 0, 0, 1 );
    xDestinationAddress.sin_port = FreeRTOS_htons( 5000 );
 
    /* The local buffer is filled with the data to be sent, in this case it is
    just filled with 0xff. */
    memset( ucBuffer, 0xff, 128 );
 
    /* Send the buffer with ulFlags set to 0, so the FREERTOS_ZERO_COPY bit
    is clear. */
    iReturned = FreeRTOS_sendto(
                                    /* The socket being send to. */
                                    xSocket,
                                    /* The data being sent. */
                                    ucBuffer,
                                    /* The length of the data being sent. */
                                    128,
                                    /* ulFlags with the FREERTOS_ZERO_COPY bit clear. */
                                    0,
                                    /* Where the data is being sent. */
                                    &xDestinationAddress,
                                    /* Not used but should be set as shown. */
                                    sizeof( xDestinationAddress )
                               );
 
    if( iReturned == 128 )
    {
        /* The data was successfully queued for sending.  128 bytes will have
        been copied out of ucBuffer and into a buffer inside the IP stack.
        ucBuffer can be re-used now. */
        console_print("Dado enviado com sucesso! \n");
    }
    for(;;);
}
 
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
{
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
char cBuffer[ 16 ];
static BaseType_t xTasksAlreadyCreated = pdFALSE;
 
    /* If the network has just come up...*/
    if( eNetworkEvent == eNetworkUp )
    {
        /* Create the tasks that use the IP stack if they have not already been
        created. */
        if( xTasksAlreadyCreated == pdFALSE )
        {
            /* See the comments above the definitions of these pre-processor
            macros at the top of this file for a description of the individual
            demo tasks. */
                
                xTaskCreate( prvTaskOne,            /* The function that implements the task. */
                    "Rx",                           /* The text name assigned to the task - for debug only as it is not used by the kernel. */
                    configMINIMAL_STACK_SIZE*30,        /* The size of the stack to allocate to the task. */
                    NULL,                           /* The parameter passed to the task - not used in this simple case. */
                    5,/* The priority assigned to the task. */
                    NULL ); 
            xTasksAlreadyCreated = pdTRUE;
        }
 
        /* Print out the network configuration, which may have come from a DHCP
        server. */
        FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
        FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
    //  FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
 
        FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
    //  FreeRTOS_printf( ( "Subnet Mask: %s\r\n", cBuffer ) );
 
        FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
    //  FreeRTOS_printf( ( "Gateway Address: %s\r\n", cBuffer ) );
 
        FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
    //  FreeRTOS_printf( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
    }
    else
    {
    //  FreeRTOS_printf( "Application idle hook network down\n" );
    }
}

I got it working with a modification to the file console.c ( I will investigate why this is happening)

For now comment the lines

 //    xSemaphoreTake(xStdioMutex, portMAX_DELAY);

and

//    xSemaphoreGive(xStdioMutex);

and please try again:
I got this output:

[Posix_GCC]$ sudo ./build/posix_demo


The following network interfaces are available:

Interface 1 - eth0
              (No description)

Interface 2 - nflog
              (Linux netfilter log (NFLOG) interface)

Interface 3 - nfqueue
              (Linux netfilter queue (NFQUEUE) interface)

Interface 4 - any
              (Pseudo-device that captures on all interfaces)

Interface 5 - lo
              (No description)


The interface that will be opened is set by "configNETWORK_INTERFACE_TO_USE", which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 1.
Criando primeira task
Socket criadoDado enviado com sucesso!

It looks like success to me!

I made it working by enabling the two commented lines, I created a new main function and I forgot to call

console_init();

Just add that to your main function and uncomment the 2 lines back.
Other than that I keep getting the successful output

Hello. Thanks for the reply.
Did not work. I didn’t mention it before, but the console function was called before the solution () function.

I use Ubuntu 20.04. Could it be a problem with Posix or interface management? I say this because, when I used a previous version of Willian Davy’s linux port made available by the community, I had to add a flag (-lrt) to the makefile to compile the project.

I obviously tried here on my computer to add the -lrt flag, it didn’t work.

Here are the logs printed by the program. I removed all console_print () functions that were in the project.

Thanks.

Trace started.
The trace will be dumped to disk if a call to configASSERT() fails.

The trace will be dumped to disk if Enter is hit.
prvIPTask started


The following network interfaces are available:

Interface 1 - wlp2s0
              (No description)

Interface 2 - lo
              (No description)

Interface 3 - any
              (Pseudo-device that captures on all interfaces)

Interface 4 - enp3s0
              (No description)

Interface 5 - bluetooth-monitor
              (Bluetooth Linux Monitor)

Interface 6 - nflog
              (Linux netfilter log (NFLOG) interface)

Interface 7 - nfqueue
              (Linux netfilter queue (NFQUEUE) interface)

Interface 8 - bluetooth0
              (Bluetooth adapter number 0)


The interface that will be opened is set by "configNETWORK_INTERFACE_TO_USE", which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 1.
opening interface wlp2s0
setting device modes of operation...

Trace output saved to Trace.dump

Hi,

Can you please post the stack traces for all threads whenever it blocks

(gdb) info threads
(gdb) thread apply all bt full

Alfred

On

(gdb) info threads
  Id   Target Id                                     Frame 
* 1    Thread 0x7ffff7d49740 (LWP 3921) "posix_demo" vAssertCalled (
    pcFileName=0x55555558b6d6 "main_blinky.c", ulLine=134) at main.c:316
  2    Thread 0x7ffff7d48700 (LWP 3925) "posix_demo" futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x5555555cd830)
    at ../sysdeps/nptl/futex-internal.h:183

On

(gdb) thread apply all bt full

Thread 2 (Thread 0x7ffff7d48700 (LWP 3925)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555555cd830) at ../sysdeps/nptl/futex-internal.h:183
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555555cd7e0, cond=0x5555555cd808) at pthread_cond_wait.c:508
        spin = 0
        buffer = {__routine = 0x7ffff7f4e050 <__condvar_cleanup_waiting>, __arg --Type <RET> for more, q to quit, c to continue without paging--A
= 0x7ffff7d47e20, __canceltype = 0, __prev = 0x0}
        cbuffer = {wseq = 0, cond = 0x5555555cd808, mutex = 0x5555555cd7e0, private = 0}
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = 0
        seq = 0
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--]
        buffer = <optimized out>
        cbuffer = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x5555555cd808, mutex=0x5555555cd7e0) at pthread_cond_wait.c:638
No locals.
#3  0x0000555555565fe2 in event_wait (ev=0x5555555cd7e0) at /home/dacara/Documents/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c:37
No locals.
#4  0x0000555555566886 in prvSuspendSelf (thread=0x5555555cd6e8) at /home/dacara/Documents/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:474
        iSig = <optimized out>
#5  0x00005555555667c4 in prvWaitForStart (pvParams=0x5555555cd6e8) at /home/dacara/Documents/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:415
        pxThread = 0x5555555cd6e8
#6  0x00007ffff7f47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737351288576, 31338120247264011, 140737488347470, 140737488347471, 140737488347664, 140737351286720, -313--Type <RET> for more, q to quit, c to continue without paging--
20197339790581, -31320471900896501}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#7  0x00007ffff7e6e103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 1 (Thread 0x7ffff7d49740 (LWP 3921)):
#0  vAssertCalled (pcFileName=0x55555558b6d6 "main_blinky.c", ulLine=134) at main.c:316
        xPrinted = 1
        ulSetToNonZeroInDebuggerToContinue = 0
#1  0x00005555555587b9 in main_blinky () at main_blinky.c:134
No locals.
#2  0x0000555555557f53 in main () at main.c:152
No locals.

Thanks,
I see assert was called from main for some reason
why are you calling main_blinky?
whats at those lines ?
can you please paste them?

Thread 1 (Thread 0x7ffff7d49740 (LWP 3921)):
#0  vAssertCalled (pcFileName=0x55555558b6d6 "main_blinky.c", ulLine=134) at main.c:316
        xPrinted = 1
        ulSetToNonZeroInDebuggerToContinue = 0
#1  0x00005555555587b9 in main_blinky () at main_blinky.c:134
No locals.
#2  0x0000555555557f53 in main () at main.c:152

Thanks

Oops. Sorry Alfred. I have another project on other file. Forget that previous log.

This is the real log:

(gdb) info threads
  Id   Target Id                                     Frame 
* 1    Thread 0x7ffff7d49740 (LWP 4559) "posix_demo" 0x00007ffff7d93322 in __GI___sigtimedwait (set=set@entry=0x7fffffffe260, info=info@entry=0x7fffffffe1a0, 
    timeout=timeout@entry=0x0) at ../sysdeps/unix/sysv/linux/sigtimedwait.c:29
  2    Thread 0x7ffff7d48700 (LWP 4563) "posix_demo" vAssertCalled (
    pcFileName=0x55555558b9d0 "/home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/timers.c", ulLine=386) at main.c:315
  3    Thread 0x7ffff7547700 (LWP 4564) "posix_demo" futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x5555555cd9c0)
    at ../sysdeps/nptl/futex-internal.h:183
  4    Thread 0x7ffff6d46700 (LWP 4565) "posix_demo" futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x5555555cdb54)
    at ../sysdeps/nptl/futex-internal.h:183



(gdb) thread apply all bt full

Thread 4 (Thread 0x7ffff6d46700 (LWP 4565)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555555cdb54) at ../sysdeps/nptl/futex-internal.h:183
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555555cdb00, cond=0x5555555cdb28) at pthread_cond_wait.c:508
        spin = 0
        buffer = {__routine = 0x7ffff7f4e050 <__condvar_cleanup_waiting>, __arg --Type <RET> for more, q to quit, c to continue without paging--
= 0x7ffff6d45d40, __canceltype = 0, __prev = 0x0}
        cbuffer = {wseq = 3, cond = 0x5555555cdb28, mutex = 0x5555555cdb00, private = 0}
        err = <optimized out>
        g = 1
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = 3
        seq = 1
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        buffer = <optimized out>
        cbuffer = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x5555555cdb28, mutex=0x5555555cdb00) at pthread_cond_wait.c:638
No locals.
#3  0x000055555556619b in event_wait (ev=0x5555555cdb00) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c:37
No locals.
#4  0x0000555555566a3f in prvSuspendSelf (thread=0x55555559fb98 <uxTimerTaskStack+1080>) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:474
        iSig = <optimized out>
#5  0x0000555555566a11 in prvSwitchThread (pxThreadToResume=0x5555555cd6e8, pxThreadToSuspend=0x55555559fb98 <uxTimerTaskStack+1080>) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:450
        uxSavedCriticalNesting = 1
#6  0x00005555555666d9 in vPortYieldFromISR () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:269
        xThreadToSuspend = 0x55555559fb98 <uxTimerTaskStack+1080>
        xThreadToResume = 0x5555555cd6e8
--Type <RET> for more, q to quit, c to continue without paging--
#7  0x00005555555666ee in vPortYield () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:277
No locals.
#8  0x000055555556564f in prvProcessTimerOrBlockTask (xNextExpireTime=0, xListWasEmpty=1) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/timers.c:633
        xTimeNow = 0
        xTimerListsWereSwitched = 0
#9  0x0000555555565582 in prvTimerTask (pvParameters=0x0) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/timers.c:579
        xNextExpireTime = 0
        xListWasEmpty = 1
#10 0x00005555555669a2 in prvWaitForStart (pvParams=0x55555559fb98 <uxTimerTaskStack+1080>) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:422
        pxThread = 0x55555559fb98 <uxTimerTaskStack+1080>
#11 0x00007ffff7f47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737334503168, -8720573914544905324, 140737488347342, 140737488347343, 140737488347536, 140737334501312, 8720553905332904852, 8720556378384589716}, mask_was_saved = 0}}, priv = {pad = {0--Type <RET> for more, q to quit, c to continue without paging--
x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#12 0x00007ffff7e6e103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 3 (Thread 0x7ffff7547700 (LWP 4564)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555555cd9c0) at ../sysdeps/nptl/futex-internal.h:183
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555555cd970, cond=0x5555555cd998) at pthread_cond_wait.c:508
        spin = 0
        buffer = {__routine = 0x7ffff7f4e050 <__condvar_cleanup_waiting>, __arg = 0x7ffff7546e20, __canceltype = 0, __prev = 0x0}
        cbuffer = {wseq = 0, cond = 0x5555555cd998, mutex = 0x5555555cd970, private = 0}
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = 0
        seq = 0
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
        buffer = <optimized out>
        cbuffer = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x5555555cd998, mutex=0x5555555cd970) at pthread_cond_wait.c:638
No locals.
#3  0x000055555556619b in event_wait (ev=0x5555555cd970) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c:37
No locals.
#4  0x0000555555566a3f in prvSuspendSelf (thread=0x55555559a468 <uxIdleTaskStack.4314+520>) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:474
        iSig = <optimized out>
#5  0x000055555556697d in prvWaitForStart (pvParams=0x55555559a468 <uxIdleTaskStack.4314+520>) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:415
        pxThread = 0x55555559a468 <uxIdleTaskStack.4314+520>
--Type <RET> for more, q to quit, c to continue without paging--
#6  0x00007ffff7f47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737342895872, -8720573914544905324, 140737488347406, 140737488347407, 140737488347600, 140737342894016, 8720555004307661716, 8720556378384589716}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#7  0x00007ffff7e6e103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 2 (Thread 0x7ffff7d48700 (LWP 4563)):
#0  vAssertCalled (pcFileName=0x55555558b9d0 "/home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/timers.c", ulLine=386) at main.c:315
        xPrinted = 1
        ulSetToNonZeroInDebuggerToContinue = 0
#1  0x0000555555564f65 in xTimerGenericCommand (xTimer=0x0, xCommandID=9, xOptionalValue=0, pxHigherPriorityTaskWoken=0x0, xTicksToWait=0) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/timers.c:386
        xReturn = 0
        xMessage = {xMessageID = 140737351284224, u = {xTimerParameters = {xMess--Type <RET> for more, q to quit, c to continue without paging--
ageValue = 93824992453492, pxTimer = 0x7ffff7d47650}, xCallbackParameters = {pxCallbackFunction = 0x55555558a374 <prvTraceUpdateCounters+109>, pvParameter1 = 0x7ffff7d47650, ulParameter2 = 1431872946}}}
#2  0x00005555555863a4 in vTimerPeriodicISRTests () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Demo/Common/Minimal/TimerDemo.c:760
        uxTick = 18446744073709551615
        xMargin = 20
#3  0x0000555555557643 in vFullDemoTickHookFunction () at main_full.c:512
        xTimerTask = 0x300000001
#4  0x0000555555558118 in vApplicationTickHook () at main.c:238
No locals.
#5  0x00005555555626e7 in xTaskIncrementTick () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/tasks.c:2843
        xConstTickCount = 1
        pxTCB = 0x7ffff7f62836
        xItemValue = 93824992728800
        xSwitchRequired = 0
#6  0x00005555555668a2 in vPortSystemTickHandler (sig=14) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:374
        pxThreadToSuspend = 0x5555555cd6e8
        pxThreadToResume = 0x8dc52544
        xExpectedTicks = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
#7  <signal handler called>
No locals.
#8  0x00007ffff7e6f77b in socket () at ../sysdeps/unix/syscall-template.S:78
No locals.
#9  0x00007ffff7f712f5 in ?? () from /lib/x86_64-linux-gnu/libpcap.so.0.8
No symbol table info available.
#10 0x00007ffff7f72615 in pcap_findalldevs () from /lib/x86_64-linux-gnu/libpcap.so.0.8
No symbol table info available.
#11 0x00005555555770d9 in prvGetAvailableNetworkInterfaces () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c:318
        ret = 0
        pxAllNetworkInterfaces = 0x0
#12 0x0000555555576c3b in xNetworkInterfaceInitialise () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c:109
        ret = 0
        pxAllNetworkInterfaces = 0x555555569423 <FreeRTOS_ClearARP+30>
#13 0x000055555556cb67 in prvProcessNetworkDownEvent () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c:1378
No locals.
--Type <RET> for more, q to quit, c to continue without paging--
#14 0x000055555556beb3 in prvIPTask (pvParameters=0x0) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c:402
        xReceivedEvent = {eEventType = eNetworkDownEvent, pvData = 0x0}
        xNextIPSleep = 1000
        pxSocket = 0x0
        xAddress = {sin_len = 224 '\340', sin_family = 215 '\327', sin_port = 21852, sin_addr = 21845}
#15 0x00005555555669a2 in prvWaitForStart (pvParams=0x5555555cd6e8) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:422
        pxThread = 0x5555555cd6e8
#16 0x00007ffff7f47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737351288576, -8720573914544905324, 140737488347422, 140737488347423, 140737488347616, 140737351286720, 8720556103282418580, 8720556378384589716}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#17 0x00007ffff7e6e103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
--Type <RET> for more, q to quit, c to continue without paging--
No locals.

Thread 1 (Thread 0x7ffff7d49740 (LWP 4559)):
#0  0x00007ffff7d93322 in __GI___sigtimedwait (set=set@entry=0x7fffffffe260, info=info@entry=0x7fffffffe1a0, timeout=timeout@entry=0x0) at ../sysdeps/unix/sysv/linux/sigtimedwait.c:29
        resultvar = 18446744073709551612
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
        result = <optimized out>
#1  0x00007ffff7f52f6c in __sigwait (set=0x7fffffffe260, sig=0x7fffffffe25c) at ../sysdeps/unix/sysv/linux/sigwait.c:28
        si = {si_signo = 0, si_errno = 0, si_code = 1432148820, __pad0 = 21845, _sifields = {_pad = {0, 0, 1431874272, 21845, -7680, 32767, 1431660992, 21845, -7104, 32767, 0, 0, 0, 0, 1431724767, 21845, -7616, 32767, 1432148736, 21845, -7648, 32767, 1431726707, 21845, 0, 0, 1431960472, 21845}, _kill = {si_pid = 0, si_uid = 0}, _timer = {si_tid = 0, si_overrun = 0, si_sigval = {sival_int = 1431874272, sival_ptr = 0x55555558aae0 <__libc_csu_init>}}, _rt = {si_pid = 0, si_uid = 0, si_sigval = {sival_int = 1431874272, sival_ptr = 0x55555558aae0 <__libc_csu_init>}}, _sigchld = {si_pid = 0, si_uid = 0, si_status = 1431874272, si_utime = 140737488347648, si_stime = 93824992242112}, _sigfault = {si_addr = 0x0, si_addr_lsb = -21792, _bounds = {_addr_bnd = {_lower = 0x7fffffffe200, _upper = 0x5555555569c0 <_start>}, _pkey = 4294959616}}, _sigpoll = {si_band = 0, si_fd = 143187--Type <RET> for more, q to quit, c to continue without paging--
4272}, _sigsys = {_call_addr = 0x0, _syscall = 1431874272, _arch = 21845}}}
        ret = <optimized out>
#2  0x0000555555566500 in xPortStartScheduler () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c:197
        iSignal = 32767
        xSignals = {__val = {512, 0 <repeats 15 times>}}
#3  0x0000555555561bca in vTaskStartScheduler () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/tasks.c:2075
        xReturn = 1
#4  0x0000555555556d36 in solution () at main_solution.c:40
No locals.
#5  0x0000555555558090 in main () at main.c:156
No locals.

No worries,

I think the problem is here:

#1  0x0000555555564f65 in xTimerGenericCommand (xTimer=0x0, xCommandID=9, xOptionalValue=0, pxHigherPriorityTaskWoken=0x0, xTicksToWait=0) at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Source/timers.c:386
        xReturn = 0
        xMessage = {xMessageID = 140737351284224, u = {xTimerParameters = {xMessageValue = 93824992453492, pxTimer = 0x7ffff7d47650}, xCallbackParameters = {pxCallbackFunction = 0x55555558a374 <prvTraceUpdateCounters+109>, pvParameter1 = 0x7ffff7d47650, ulParameter2 = 1431872946}}}
#2  0x00005555555863a4 in vTimerPeriodicISRTests () at /home/dacara/Downloads/FreeRTOSv10.4.0/FreeRTOS/FreeRTOS/Demo/Common/Minimal/TimerDemo.c:760
        uxTick = 18446744073709551615
        xMargin = 20
#3  0x0000555555557643 in vFullDemoTickHookFunction () at main_full.c:512
        xTimerTask = 0x300000001

You are calling the function ‘vFullDemoTickHookFunction’ which you should not as it is only for the main_full.c demo

        #if (mainSELECTED_APPLICATION == FULL_DEMO )
        {
              vFullDemoTickHookFunction();
        }
        #endif /* mainSELECTED_APPLICATION */

I would assume you are setting

        #define mainSELECTED_APPLICATION  FULL_DEMO 

just comment out the vFullDemoTickHookFunction() line

Thank you, Alfred. It works.
Now i have other problem, the data was not sent to endpoint.

I will investigate more about what happen here.

Thank you.

You’re welcome!

Make sure the destination is not on the same host, sending to/from a Virtual Machine is ok,
as the host machine (ubuntu in your case) is not sending ARP responses to the FreeRTOS TCP/IP stack if the destination is on the same Ubuntu box.