FreeRTOS problems under Ubuntu OS

abeltom87 wrote on Sunday, December 03, 2017:

I am trying to run two tasks using FreeRTOS APIs. I followed the Handson Tutorial pdf of FreeRTOS, but my task runs just once and stops.I am using the FreeRTOS kernel on x86 Intel. I am able to compie and run the code.

My OS is Ubuntu, I am using Eclipse Toolchain with GCC. If anyone has experience with this, they could give me some pointers as to how to do it right.

Here is my code:

static unsigned long uxQueueSendPassedCount = 0;

void vTask1(void *pvParameters)
{
   const char *str_to_display="This is task1\n\r";
   while(1)
   {
     printf("%s",str_to_display);
     vTaskDelay(1000);

   }

}

void vTask2(void *pvParameters)
{
    const char *str_to_display="This is task2\n\r";

    while(1)
    {
      printf("%s",str_to_display);
      vTaskDelay(1000);
    }

}

int main()
{

    xTaskCreate(vTask1, (signed char *)"Task1",1000,NULL,3,NULL);
    xTaskCreate(vTask2,(signed char *)"Task2",100,NULL,1,NULL);

    vTaskStartScheduler();
    while(1)
    {

    }
    return 0;

}

Other things i tried :

  1. Created just one task, with infinite loop and it runs as expected,
  2. Created just one task, added vtaskDelay, and i get an error “Segmentation fault (core dumped)”

heinbali01 wrote on Sunday, December 03, 2017:

When using the Windows simulating environment, you can not use Windows’ API’s, such as printf(). We did provide a safe way to print logging, see demo_logging.c:

    void vLoggingPrintf( const char *pcFormat, ... );

abeltom87 wrote on Sunday, December 03, 2017:

Thank you for your response Sir, but i am on Linux. And i adapted my software using this as a basis described here.

heinbali01 wrote on Monday, December 04, 2017:

I haven’t tried out the simulation under Linux, but I bet that calling printf() is not supported neither.