Can't create two tasks

TUAZ TORCHON, Dimitri dimitri.tuaztorchon at airbus.com
Mon Nov 2 16:23:18 UTC 2015



From: Joel Sherrill [mailto:joel.sherrill at gmail.com]
Sent: Monday, November 02, 2015 4:38 PM
To: TUAZ TORCHON, Dimitri
Cc: rtems-users at rtems.org
Subject: Re: Can't create two tasks



On Mon, Nov 2, 2015 at 9:11 AM, TUAZ TORCHON, Dimitri <dimitri.tuaztorchon at airbus.com<mailto:dimitri.tuaztorchon at airbus.com>> wrote:
Hi everyone,

I use RTEMS on a MicroBlaze processor (implemented in a Spartan6 FPGA, on a SP605 evaluation kit), and I can’t create two tasks. I have tried this simple code :


This isn't in the main tree so where did you get this? I assume from Hesham's github. Is that correct?

More below.

Indeed : I’m able to run a HelloWorld, use interrupts, GPIOs…

rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code status_rtems;

  printf("\n*** Test begins *** \n\n");

  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );

  /* Creating and executing task 1 */
  status_rtems = rtems_task_create(
                                   Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
                                   RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
                                   );
  printf("\n At the end of task create 1, status_rtems = %d\n",(int)status_rtems);

  status_rtems = rtems_task_start( Task_id[ 1 ], print1, 1 );
  printf("\n At the end of task start 1, status_rtems = %d\n",(int)status_rtems);

  /* Creating and executing task 2 */
  status_rtems = rtems_task_create(
                                    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
                                    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
                                    );
  printf("\n At the end of task create 2, status_rtems = %d\n",(int)status_rtems);

  status_rtems = rtems_task_start( Task_id[ 2 ], print2, 1 );
  printf("\n At the end of task start 2, status_rtems = %d\n",(int)status_rtems);

  rtems_task_delete(RTEMS_SELF);
}

rtems_task print1(rtems_task_argument unused){
  printf("\nTask 1 is executing !\n");

  while(1){}
}

rtems_task print2(rtems_task_argument unused){
  printf("\nTask 2 is executing !\n");

  while(1){}
}


And in my terminal I’ve got this :



*** Test begins ***

At the end of task create 1, status_rtems = 0

At the end of task start 1, status_rtems = 0

At the end of task create 1, status_rtems = 13

At the end of task start 1, status_rtems = 14

Task 1 is executing


As you can see, task 1 is created, and executes fine. But the creating of task 2 return the status : RTEMS_UNSATISFIED - not enough memory for stack/FP context.
However, I have plenty of space left on my RTEMS Workspace, and I do not use floating point context.
Going deeper with GDB, I have found that is the allocation in the heap that goes bad :
In function _Heap_Allocate_aligned_with_boundary (in cpukit/score/src/heapallocate.c), the Heap_Block “block” and “free_list_tail” have their fields next and prev pointing to themself.

I also tried to delete task 1 after the creation (the deleting was successful), but I have got the same error when creating task 2.

As anyone of you has an explication ?


What are your CONFIGURE_ settings? You definitely need two tasks and some extra
stack space reserved.


#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER



#define CONFIGURE_RTEMS_INIT_TASKS_TABLE



#define CONFIGURE_EXTRA_TAASKS_STACK (6 * RTEMS_MINIMUM_STACK_SIZE)



#define CONFIGURE_UNLIMITED_OBJECTS



#define CONFIGURE_MEMORY_OVERHEAD 10



#define CONFIGURE_INIT

#include <rtems/confdefs.h>


Thanks a lot,
Dimitri Tuaz






***************************************************************

Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des informations confidentielles et/ou protegees ou dont la diffusion est restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. Airbus Defence and Space et les sociétés Airbus Group declinent toute responsabilite en cas de corruption par virus, d'alteration ou de falsification de ce courriel lors de sa transmission par voie electronique.

This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Airbus Defence and Space and Airbus Group companies disclaim any and all liability if this email transmission was virus corrupted, altered or falsified.

---------------------------------------------------------------------

Airbus Defence and Space SAS (393 341 516 RCS Versailles) - Capital: 16.587.728 EUR - Siege social: 51-61 Route de Verneuil, 78130 Les Mureaux, France


_______________________________________________
users mailing list
users at rtems.org<mailto:users at rtems.org>
http://lists.rtems.org/mailman/listinfo/users


***************************************************************
Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des informations confidentielles et/ou protegees ou dont la diffusion est restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. Airbus Defence and Space et les sociétés Airbus Group declinent toute responsabilite en cas de corruption par virus, d'alteration ou de falsification de ce courriel lors de sa transmission par voie electronique.
This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Airbus Defence and Space and Airbus Group companies disclaim any and all liability if this email transmission was virus corrupted, altered or falsified. 
---------------------------------------------------------------------
Airbus Defence and Space SAS (393 341 516 RCS Versailles) - Capital: 16.587.728 EUR - Siege social: 51-61 Route de Verneuil, 78130 Les Mureaux, France
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20151102/1f95655b/attachment-0002.html>


More information about the users mailing list