Need help in figuring out how to allocate sizes to the array

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Aug 13 12:47:44 UTC 2020


On 13/08/2020 14:42, Richi Dubey wrote:

> I want to use arrays with size _CONFIGURE_MAXIMUM_PROCESSORS. Is it
> okay if I define the arrays with this size while writing the scheduler
> strong APA header file? I am asking this because the value of this
> header gets defined at the time the test case runs while the scheduler
> gets linked to the test case at the time of linking. So how would it
> work?

Do NOT use _CONFIGURE_MAXIMUM_PROCESSORS.

In <rtems/scheduler.h> please use something similar to the EDF scheduler 
instantiation:

#ifdef CONFIGURE_SCHEDULER_EDF_SMP
   #include <rtems/score/scheduleredfsmp.h>

   #ifndef CONFIGURE_MAXIMUM_PROCESSORS
     #error "CONFIGURE_MAXIMUM_PROCESSORS must be defined to configure 
the EDF SMP scheduler"
   #endif

   #define SCHEDULER_EDF_SMP_CONTEXT_NAME( name ) \
     SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name )

   #define RTEMS_SCHEDULER_EDF_SMP( name ) \
     static struct { \
       Scheduler_EDF_SMP_Context Base; \
       Scheduler_EDF_SMP_Ready_queue Ready[ CONFIGURE_MAXIMUM_PROCESSORS 
+ 1 ]; \
     } SCHEDULER_EDF_SMP_CONTEXT_NAME( name )

   #define RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name ) \
     { \
       &SCHEDULER_EDF_SMP_CONTEXT_NAME( name ).Base.Base.Base, \
       SCHEDULER_EDF_SMP_ENTRY_POINTS, \
       SCHEDULER_EDF_MAXIMUM_PRIORITY, \
       ( obj_name ) \
       SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
     }

   /* Provided for backward compatibility */

   #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \
     RTEMS_SCHEDULER_EDF_SMP( name )

   #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \
     RTEMS_SCHEDULER_TABLE_EDF_SMP( name, obj_name )
#endif



More information about the devel mailing list