Ticket #1924: config.patch

File config.patch, 32.9 KB (added by Sebastian Huber, on 11/09/11 at 11:58:22)

Configuration changes.

  • c/src/lib/libbsp/shared/bootcard.c

    RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/shared/bootcard.c,v
    retrieving revision 1.52
    diff -u -r1.52 bootcard.c
     
    6666const char *bsp_boot_cmdline;
    6767
    6868/*
    69  * Are we using a single heap for the RTEMS Workspace and C Program Heap?
    70  */
    71 extern bool rtems_unified_work_area;
    72 
    73 /*
    7469 *  These are the prototypes and helper routines which are used
    7570 *  when the BSP lets the framework handle RAM allocation between
    7671 *  the RTEMS Workspace and C Program Heap.
     
    8479)
    8580{
    8681  if ( heap_start == BSP_BOOTCARD_HEAP_USES_WORK_AREA ) {
    87     if ( ! rtems_unified_work_area ) {
     82    if ( !rtems_configuration_get_unified_work_area() ) {
    8883      uintptr_t work_space_size = rtems_configuration_get_work_space_size();
    8984
    9085      heap_start = (char *) work_area_start + work_space_size;
     
    121116  void                  *heap_start = NULL;
    122117  uintptr_t              heap_size = 0;
    123118  uintptr_t              sbrk_amount = 0;
    124   uint32_t               status;
     119  uintptr_t              work_space_size = 0;
     120  uint32_t               status = 0;
    125121
    126122  /*
    127123   * Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
     
    158154   */
    159155  if ( rtems_malloc_sbrk_helpers ) {
    160156    sbrk_amount = bsp_sbrk_init(work_area_start, &work_area_size);
    161     if ( work_area_size <  Configuration.work_space_size && sbrk_amount > 0 ) {
     157    work_space_size = rtems_configuration_get_work_space_size();
     158    if ( work_area_size <  work_space_size && sbrk_amount > 0 ) {
    162159      /* Need to use sbrk right now */
    163160      uintptr_t sbrk_now;
    164161
    165       sbrk_now = (Configuration.work_space_size - work_area_size) / sbrk_amount;
     162      sbrk_now = (work_space_size - work_area_size) / sbrk_amount;
    166163      sbrk( sbrk_now * sbrk_amount );
    167164    }
    168165  }
     
    171168    printk("Configuration error!\n"
    172169           "Application was configured with CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK\n"
    173170           "but BSP was configured w/o sbrk support\n");
    174     bsp_cleanup(1);
    175     return 1;
     171    status = 1;
     172    bsp_cleanup( status );
     173    return status;
    176174  }
    177175#endif
    178176
     
    185183   *
    186184   *  NOTE: Use cast to (void *) and %p since these are uintptr_t types.
    187185   */
    188   if ( work_area_size <= Configuration.work_space_size ) {
     186  work_space_size = rtems_configuration_get_work_space_size();
     187  if ( work_area_size <= work_space_size ) {
    189188    printk(
    190       "bootcard: work space too big for work area: %p > %p\n",
    191       (void *) Configuration.work_space_size,
     189      "bootcard: work space too big for work area: %p >= %p\n",
     190      (void *) work_space_size,
    192191      (void *) work_area_size
    193192    );
    194     bsp_cleanup(1);
    195     return 1;
     193    status = 1;
     194    bsp_cleanup( status );
     195    return status;
    196196  }
    197197
    198   if ( rtems_unified_work_area ) {
    199     Configuration.work_space_start = work_area_start;
    200     Configuration.work_space_size  = work_area_size;
     198  if ( !rtems_configuration_get_unified_work_area() ) {
     199    rtems_configuration_set_work_space_start( work_area_start );
    201200  } else {
    202     Configuration.work_space_start = work_area_start;
     201    rtems_configuration_set_work_space_start( work_area_start );
     202    rtems_configuration_set_work_space_size( work_area_size );
     203    if ( !rtems_configuration_get_stack_allocator_avoids_work_space() ) {
     204      rtems_configuration_set_stack_space_size( 0 );
     205    }
    203206  }
    204207
    205208  #if (BSP_DIRTY_MEMORY == 1)
  • cpukit/libcsupport/src/malloc_initialize.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/malloc_initialize.c,v
    retrieving revision 1.15
    diff -u -r1.15 malloc_initialize.c
     
    3535}
    3636#else
    3737rtems_malloc_statistics_t rtems_malloc_statistics;
    38 extern bool rtems_unified_work_area;
    3938
    4039void RTEMS_Malloc_Initialize(
    4140  void *heap_begin,
     
    4342  size_t sbrk_amount
    4443)
    4544{
     45  bool separate_areas = !rtems_configuration_get_unified_work_area();
    4646  /*
    4747   *  If configured, initialize the statistics support
    4848   */
     
    8686   *  left over from another process.  This would be a security violation.
    8787   */
    8888
    89   if (
    90     !rtems_unified_work_area
    91       && rtems_configuration_get_do_zero_of_workspace()
    92   ) {
     89  if ( separate_areas && rtems_configuration_get_do_zero_of_workspace() ) {
    9390     memset( heap_begin, 0, heap_size );
    9491  }
    9592
     
    9996   *  STDIO cannot work because there will be no buffers.
    10097   */
    10198
    102   if ( !rtems_unified_work_area ) {
     99  if ( separate_areas ) {
    103100    uintptr_t status = _Protected_heap_Initialize(
    104101      RTEMS_Malloc_Heap,
    105102      heap_begin,
  • cpukit/libmisc/shell/main_wkspaceinfo.c

    RCS file: /usr1/CVS/rtems/cpukit/libmisc/shell/main_wkspaceinfo.c,v
    retrieving revision 1.7
    diff -u -r1.7 main_wkspaceinfo.c
     
    2424#include <rtems/score/protectedheap.h>
    2525#include "internal.h"
    2626
    27 extern bool rtems_unified_work_area;
    28 
    2927void rtems_shell_print_unified_work_area_message(void)
    3028{
    3129  printf( "\nC Program Heap and RTEMS Workspace are %s.\n",
    32     ((rtems_unified_work_area) ? "the same" : "separate")
     30    rtems_configuration_get_unified_work_area() ? "the same" : "separate"
    3331  );
    3432}
    3533
  • cpukit/sapi/include/confdefs.h

    RCS file: /usr1/CVS/rtems/cpukit/sapi/include/confdefs.h,v
    retrieving revision 1.173
    diff -u -r1.173 confdefs.h
     
    764764  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
    765765#endif
    766766
     767#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
     768  (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
     769
    767770/**
    768771 *  @brief Idle task stack size configuration
    769772 *
     
    777780    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
    778781  #endif
    779782#endif
     783#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
     784  #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
     785#endif
    780786
    781787/**
    782788 *  @brief Interrupt stack size configuration
     
    855861  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
    856862    #include <rtems/score/wkspace.h>
    857863    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
    858     bool           rtems_unified_work_area = true;
    859864  #else
    860865    Heap_Control   RTEMS_Malloc_Area;
    861866    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
    862     bool           rtems_unified_work_area = false;
    863867  #endif
    864868#endif
    865869
     
    12411245  #define CONFIGURE_LIBBLOCK_SEMAPHORES 0
    12421246#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
    12431247
     1248#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
     1249  #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
     1250#endif
     1251
    12441252#if defined(RTEMS_MULTIPROCESSING)
    12451253  /*
    12461254   *  Default Multiprocessing Configuration Table.  The defaults are
     
    12731281      #define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \
    12741282        _Configure_Object_RAM((_proxies) + 1, sizeof(Thread_Proxy_control) )
    12751283
    1276       #ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK
    1277         #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0
    1278       #endif
    1279 
    12801284      #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER
    12811285        #include <mpci.h>
    12821286        #define CONFIGURE_MP_MPCI_TABLE_POINTER         &MPCI_table
     
    15211525
    15221526  #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
    15231527    _Configure_From_workspace( \
    1524       CONFIGURE_MINIMUM_TASK_STACK_SIZE + \
    15251528      sizeof (POSIX_API_Control) + \
    15261529     (sizeof (void *) * (CONFIGURE_MAXIMUM_POSIX_KEYS)) \
    15271530    )
     
    16391642
    16401643      #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
    16411644        #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
    1642                 (CONFIGURE_MINIMUM_TASK_STACK_SIZE * 2)
     1645          CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
    16431646      #endif
    16441647
    16451648      #ifdef CONFIGURE_INIT
     
    16851688          CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ) + \
    16861689      CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \
    16871690          CONFIGURE_MAXIMUM_POSIX_RWLOCKS ) + \
    1688       CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ) + \
    1689       (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE) \
     1691      CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ) \
    16901692     )
    16911693#else
    16921694
     
    17281730    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
    17291731  #endif
    17301732
    1731   /**
    1732    * Ada tasks are allocated twice the minimum stack space.
    1733    */
    1734   #define CONFIGURE_ADA_TASKS_STACK \
    1735     (CONFIGURE_MAXIMUM_ADA_TASKS * \
    1736       (CONFIGURE_MINIMUM_TASK_STACK_SIZE + (6 * 1024)))
    1737 
    17381733#else
    17391734  #define CONFIGURE_GNAT_MUTEXES           0
    17401735  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
    17411736  #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
    1742   #define CONFIGURE_ADA_TASKS_STACK        0
    17431737#endif
    17441738
    17451739#ifdef CONFIGURE_ENABLE_GO
     
    17951789  #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0
    17961790#endif
    17971791
     1792/**
     1793 *  This is so we can account for tasks with stacks greater than minimum
     1794 *  size.  This is in bytes.
     1795 */
     1796#ifndef CONFIGURE_EXTRA_TASK_STACKS
     1797  #define CONFIGURE_EXTRA_TASK_STACKS 0
     1798#endif
    17981799
    17991800/*
    18001801 *  Calculate the RAM size based on the maximum number of objects configured.
     
    18131814 ( \
    18141815  _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \
    18151816  (_Configure_Max_Objects(_tasks) * \
    1816    (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
    1817     CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API + \
     1817    (CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API + \
    18181818    CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB + \
    18191819    CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \
    18201820    CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER))  + \
     
    18331833    (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \
    18341834     CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \
    18351835             CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS) + \
    1836      CONFIGURE_MEMORY_FOR_TASKS(1, 1) + \
    1837      CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK \
     1836     CONFIGURE_MEMORY_FOR_TASKS(1, 1) \
    18381837  )
    18391838#else
    18401839  #define CONFIGURE_MEMORY_FOR_MP  0
    18411840#endif
    18421841
    18431842/**
    1844  *  This is so we can account for tasks with stacks greater than minimum
    1845  *  size.  This is in bytes.
    1846  */
    1847 #ifndef CONFIGURE_EXTRA_TASK_STACKS
    1848   #define CONFIGURE_EXTRA_TASK_STACKS 0
    1849 #endif
    1850 
    1851 /**
    18521843 *  The following macro is used to calculate the memory allocated by RTEMS
    18531844 *  for the message buffers associated with a particular message queue.
    18541845 *  There is a fixed amount of overhead per message.
     
    19151906  _Configure_Object_RAM(1, sizeof(API_Mutex_Control))
    19161907
    19171908/**
    1918  *  This defines the formula used to compute the amount of memory
    1919  *  reserved for IDLE task control structures and stacks.
    1920  */
    1921 #define CONFIGURE_IDLE_TASKS(_count) \
    1922     (CONFIGURE_MEMORY_FOR_TASKS(_count, 0) + \
    1923       _count * _Configure_From_workspace( \
    1924        (CONFIGURE_IDLE_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)))
    1925 
    1926 /**
    19271909 *  This calculates the amount of memory reserved for the IDLE tasks.
    19281910 *  In an SMP system, each CPU core has its own idle task.
    19291911 */
    19301912#if defined(RTEMS_SMP)
    1931   #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
    1932           CONFIGURE_IDLE_TASKS(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
     1913  #define CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_SMP_MAXIMUM_PROCESSORS
    19331914#else
    1934   #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
    1935           CONFIGURE_IDLE_TASKS(1)
     1915  #define CONFIGURE_IDLE_TASKS_COUNT 1
    19361916#endif
    19371917
    19381918/**
     1919 *  This defines the formula used to compute the amount of memory
     1920 *  reserved for IDLE task control structures.
     1921 */
     1922#define CONFIGURE_MEMORY_FOR_IDLE_TASK \
     1923  CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_IDLE_TASKS_COUNT, 0)
     1924
     1925/**
    19391926 *  This macro accounts for general RTEMS system overhead.
    19401927 */
    19411928#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
     
    19461933    CONFIGURE_API_MUTEX_MEMORY                     /* allocation mutex */ \
    19471934  )
    19481935
    1949 /*
    1950  *  Now account for any extra memory that initialization tasks or threads
    1951  *  may have requested.
    1952  */
    1953 
    1954 /**
    1955  *  This accounts for any extra memory required by the Classic API
    1956  *  Initialization Task.
    1957  */
    1958 #if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1959   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
    1960       (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1961 #else
    1962   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
    1963 #endif
    1964 
    1965 /**
    1966  *  This accounts for any extra memory required by the POSIX API
    1967  *  Initialization Thread.
    1968  */
    1969 #if defined(RTEMS_POSIX_API) && \
    1970     (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1971   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
    1972     (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
    1973 #else
    1974   #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
    1975 #endif
    1976 
    1977 /**
    1978  *  This macro provides a summation of the various initialization task
    1979  *  and thread stack requirements.
    1980  */
    1981 #define CONFIGURE_INITIALIZATION_THREADS_STACKS \
    1982     (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
    1983     CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
    1984 
    19851936/**
    19861937 *  This macro provides a summation of the various task and thread
    19871938 *  requirements.
     
    20301981  #define CONFIGURE_MEMORY_FOR_SMP 0
    20311982#endif
    20321983
    2033 #if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
    2034   /**
    2035    *  This is a debug mechanism, so if you need to, the executable will
    2036    *  have a structure with various partial values.  Add to this as you
    2037    *  need to.  Viewing this structure in gdb combined with dumping
    2038    *  the Configuration structures generated should help a lot in tracing
    2039    *  down errors and analyzing where over and under allocations are.
    2040    */
    2041   typedef struct {
    2042     uint32_t SYSTEM_OVERHEAD;
    2043     uint32_t STATIC_EXTENSIONS;
    2044     uint32_t INITIALIZATION_THREADS_STACKS;
    2045 
    2046     uint32_t PER_INTEGER_TASK;
    2047     uint32_t FP_OVERHEAD;
    2048     uint32_t CLASSIC;
    2049     uint32_t POSIX;
    2050 
    2051     /* System overhead pieces */
    2052     uint32_t INTERRUPT_VECTOR_TABLE;
    2053     uint32_t INTERRUPT_STACK_MEMORY;
    2054     uint32_t MEMORY_FOR_IDLE_TASK;
    2055     uint32_t MEMORY_FOR_SCHEDULER;
    2056     uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
    2057 
    2058     /* Classic API Pieces */
    2059     uint32_t CLASSIC_TASKS;
    2060     uint32_t TASK_VARIABLES;
    2061     uint32_t TIMERS;
    2062     uint32_t SEMAPHORES;
    2063     uint32_t MESSAGE_QUEUES;
    2064     uint32_t PARTITIONS;
    2065     uint32_t REGIONS;
    2066     uint32_t PORTS;
    2067     uint32_t PERIODS;
    2068     uint32_t BARRIERS;
    2069     uint32_t USER_EXTENSIONS;
    2070 #ifdef RTEMS_POSIX_API
    2071     /* POSIX API Pieces */
    2072     uint32_t POSIX_MUTEXES;
    2073     uint32_t POSIX_CONDITION_VARIABLES;
    2074     uint32_t POSIX_KEYS;
    2075     uint32_t POSIX_TIMERS;
    2076     uint32_t POSIX_QUEUED_SIGNALS;
    2077     uint32_t POSIX_MESSAGE_QUEUES;
    2078     uint32_t POSIX_SEMAPHORES;
    2079     uint32_t POSIX_BARRIERS;
    2080     uint32_t POSIX_SPINLOCKS;
    2081     uint32_t POSIX_RWLOCKS;
    2082 #endif
    2083   } Configuration_Debug_t;
    2084 
    2085   Configuration_Debug_t Configuration_Memory_Debug = {
    2086     /* General Information */
    2087     CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
    2088     CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
    2089     CONFIGURE_INITIALIZATION_THREADS_STACKS,
    2090     CONFIGURE_MEMORY_FOR_TASKS(1, 0),
    2091     CONFIGURE_MEMORY_FOR_TASKS(0, 1),
    2092     CONFIGURE_MEMORY_FOR_CLASSIC,
    2093     CONFIGURE_MEMORY_FOR_POSIX,
    2094 
    2095     /* System overhead pieces */
    2096     CONFIGURE_INTERRUPT_VECTOR_TABLE,
    2097     CONFIGURE_INTERRUPT_STACK_MEMORY,
    2098     CONFIGURE_MEMORY_FOR_IDLE_TASK,
    2099     CONFIGURE_MEMORY_FOR_SCHEDULER,
    2100     CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
    2101 
    2102     /* Classic API Pieces */
    2103     CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
    2104     CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES +
    2105       CONFIGURE_GOROUTINES_TASK_VARIABLES),
    2106     CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
    2107     CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
    2108     CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
    2109     CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
    2110     CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
    2111     CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
    2112     CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
    2113     CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS),
    2114     CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
    2115 
    2116 #ifdef RTEMS_POSIX_API
    2117     /* POSIX API Pieces */
    2118     CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
    2119       CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
    2120     CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
    2121       CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
    2122       CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES),
    2123     CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ),
    2124     CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
    2125       CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
    2126     CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
    2127       CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
    2128     CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
    2129     CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ),
    2130     CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ),
    2131     CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ),
    2132     CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
    2133 #endif
    2134   };
    2135 #endif
    2136 
    21371984/**
    21381985 *  This calculates the memory required for the executive workspace.
    21391986 */
     
    21451992     CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS) + \
    21461993   CONFIGURE_MEMORY_FOR_CLASSIC + \
    21471994   CONFIGURE_MEMORY_FOR_POSIX + \
    2148    (CONFIGURE_MAXIMUM_POSIX_THREADS * CONFIGURE_MINIMUM_TASK_STACK_SIZE ) + \
    2149    (CONFIGURE_MAXIMUM_GOROUTINES * CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
    2150    CONFIGURE_INITIALIZATION_THREADS_STACKS + \
    21511995   CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
    21521996   CONFIGURE_MEMORY_FOR_MP + \
    21531997   CONFIGURE_MEMORY_FOR_SMP + \
    21541998   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
    2155    (CONFIGURE_MEMORY_OVERHEAD * 1024) + \
    2156    (CONFIGURE_EXTRA_TASK_STACKS) + (CONFIGURE_ADA_TASKS_STACK) \
     1999   (CONFIGURE_MEMORY_OVERHEAD * 1024) \
    21572000) & ~0x7)
     2001
     2002/*
     2003 *  Now account for any extra memory that initialization tasks or threads
     2004 *  may have requested.
     2005 */
     2006
     2007/**
     2008 *  This accounts for any extra memory required by the Classic API
     2009 *  Initialization Task.
     2010 */
     2011#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE)
     2012  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \
     2013      (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)
     2014#else
     2015  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0
    21582016#endif
    21592017
     2018/**
     2019 *  This accounts for any extra memory required by the POSIX API
     2020 *  Initialization Thread.
     2021 */
     2022#if defined(RTEMS_POSIX_API) && \
     2023    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
     2024      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
     2025  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
     2026    (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
     2027      CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
     2028#else
     2029  #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0
     2030#endif
     2031
     2032/**
     2033 *  This macro provides a summation of the various initialization task
     2034 *  and thread stack requirements.
     2035 */
     2036#define CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \
     2037    (CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \
     2038    CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART)
     2039
     2040#define CONFIGURE_IDLE_TASKS_STACK \
     2041  (CONFIGURE_IDLE_TASKS_COUNT * \
     2042    _Configure_From_workspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
     2043
     2044#define CONFIGURE_TASKS_STACK \
     2045  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_TASKS ) * \
     2046    _Configure_From_workspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
     2047
     2048#define CONFIGURE_POSIX_THREADS_STACK \
     2049  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \
     2050    _Configure_From_workspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
     2051
     2052#define CONFIGURE_GOROUTINES_STACK \
     2053  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \
     2054    _Configure_From_workspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
     2055
     2056#define CONFIGURE_ADA_TASKS_STACK \
     2057  (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \
     2058    _Configure_From_workspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) )
     2059
     2060#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */
     2061
     2062#define CONFIGURE_IDLE_TASKS_STACK 0
     2063#define CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0
     2064#define CONFIGURE_TASKS_STACK 0
     2065#define CONFIGURE_POSIX_THREADS_STACK 0
     2066#define CONFIGURE_GOROUTINES_STACK 0
     2067#define CONFIGURE_ADA_TASKS_STACK 0
     2068
     2069#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0
     2070  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK"
     2071#endif
     2072
     2073#if CONFIGURE_EXTRA_TASK_STACKS != 0
     2074  #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS"
     2075#endif
     2076
     2077#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */
     2078
     2079#define CONFIGURE_STACK_SPACE_SIZE \
     2080  ( \
     2081    CONFIGURE_IDLE_TASKS_STACK + \
     2082    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \
     2083    CONFIGURE_TASKS_STACK + \
     2084    CONFIGURE_POSIX_THREADS_STACK + \
     2085    CONFIGURE_GOROUTINES_STACK + \
     2086    CONFIGURE_ADA_TASKS_STACK + \
     2087    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \
     2088    CONFIGURE_EXTRA_TASK_STACKS \
     2089  )
     2090
    21602091#ifdef CONFIGURE_INIT
    21612092  /**
    21622093   *  This is the Classic API Configuration Table.
     
    22302161  rtems_configuration_table Configuration = {
    22312162    NULL,                                     /* filled in by BSP */
    22322163    CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
     2164    CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
    22332165    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
    22342166    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
    22352167    CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
     
    22392171    CONFIGURE_TASK_STACK_ALLOCATOR,           /* stack allocator */
    22402172    CONFIGURE_TASK_STACK_DEALLOCATOR,         /* stack deallocator */
    22412173    CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY,   /* true to clear memory */
     2174    #ifdef CONFIGURE_UNIFIED_WORK_AREAS       /* true for unified work areas */
     2175      true,
     2176    #else
     2177      false,
     2178    #endif
     2179    #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid
     2180                                                 work space for thread stack
     2181                                                 allocation */
     2182      true,
     2183    #else
     2184      false,
     2185    #endif
    22422186    CONFIGURE_MAXIMUM_DRIVERS,                /* maximum device drivers */
    22432187    CONFIGURE_NUMBER_OF_DRIVERS,              /* static device drivers */
    22442188    Device_drivers,                           /* pointer to driver table */
     
    23182262 ******************************************************************
    23192263 */
    23202264
     2265#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
     2266  /**
     2267   *  This is a debug mechanism, so if you need to, the executable will
     2268   *  have a structure with various partial values.  Add to this as you
     2269   *  need to.  Viewing this structure in gdb combined with dumping
     2270   *  the Configuration structures generated should help a lot in tracing
     2271   *  down errors and analyzing where over and under allocations are.
     2272   */
     2273  typedef struct {
     2274    uint32_t SYSTEM_OVERHEAD;
     2275    uint32_t STATIC_EXTENSIONS;
     2276    uint32_t INITIALIZATION_THREADS_STACKS;
     2277
     2278    uint32_t PER_INTEGER_TASK;
     2279    uint32_t FP_OVERHEAD;
     2280    uint32_t CLASSIC;
     2281    uint32_t POSIX;
     2282
     2283    /* System overhead pieces */
     2284    uint32_t INTERRUPT_VECTOR_TABLE;
     2285    uint32_t INTERRUPT_STACK_MEMORY;
     2286    uint32_t MEMORY_FOR_IDLE_TASK;
     2287    uint32_t MEMORY_FOR_SCHEDULER;
     2288    uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
     2289
     2290    /* Classic API Pieces */
     2291    uint32_t CLASSIC_TASKS;
     2292    uint32_t TASK_VARIABLES;
     2293    uint32_t TIMERS;
     2294    uint32_t SEMAPHORES;
     2295    uint32_t MESSAGE_QUEUES;
     2296    uint32_t PARTITIONS;
     2297    uint32_t REGIONS;
     2298    uint32_t PORTS;
     2299    uint32_t PERIODS;
     2300    uint32_t BARRIERS;
     2301    uint32_t USER_EXTENSIONS;
     2302
     2303#ifdef RTEMS_POSIX_API
     2304    /* POSIX API Pieces */
     2305    uint32_t POSIX_MUTEXES;
     2306    uint32_t POSIX_CONDITION_VARIABLES;
     2307    uint32_t POSIX_KEYS;
     2308    uint32_t POSIX_TIMERS;
     2309    uint32_t POSIX_QUEUED_SIGNALS;
     2310    uint32_t POSIX_MESSAGE_QUEUES;
     2311    uint32_t POSIX_SEMAPHORES;
     2312    uint32_t POSIX_BARRIERS;
     2313    uint32_t POSIX_SPINLOCKS;
     2314    uint32_t POSIX_RWLOCKS;
     2315#endif
     2316
     2317    /* Stack space sizes */
     2318    uint32_t IDLE_TASKS_STACK;
     2319    uint32_t INITIALIZATION_THREADS_EXTRA_STACKS;
     2320    uint32_t TASKS_STACK;
     2321    uint32_t POSIX_THREADS_STACK;
     2322    uint32_t GOROUTINES_STACK;
     2323    uint32_t ADA_TASKS_STACK;
     2324    uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK;
     2325    uint32_t EXTRA_TASK_STACKS;
     2326  } Configuration_Debug_t;
     2327
     2328  Configuration_Debug_t Configuration_Memory_Debug = {
     2329    /* General Information */
     2330    CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD,
     2331    CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS,
     2332    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
     2333    CONFIGURE_MEMORY_FOR_TASKS(1, 0),
     2334    CONFIGURE_MEMORY_FOR_TASKS(0, 1),
     2335    CONFIGURE_MEMORY_FOR_CLASSIC,
     2336    CONFIGURE_MEMORY_FOR_POSIX,
     2337
     2338    /* System overhead pieces */
     2339    CONFIGURE_INTERRUPT_VECTOR_TABLE,
     2340    CONFIGURE_INTERRUPT_STACK_MEMORY,
     2341    CONFIGURE_MEMORY_FOR_IDLE_TASK,
     2342    CONFIGURE_MEMORY_FOR_SCHEDULER,
     2343    CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
     2344
     2345    /* Classic API Pieces */
     2346    CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0),
     2347    CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES +
     2348      CONFIGURE_GOROUTINES_TASK_VARIABLES),
     2349    CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS),
     2350    CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_SEMAPHORES),
     2351    CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES),
     2352    CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS),
     2353    CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ),
     2354    CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS),
     2355    CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS),
     2356    CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS),
     2357    CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
     2358
     2359#ifdef RTEMS_POSIX_API
     2360    /* POSIX API Pieces */
     2361    CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
     2362      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
     2363    CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
     2364      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
     2365      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES),
     2366    CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ),
     2367    CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
     2368      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
     2369    CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
     2370      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
     2371    CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
     2372    CONFIGURE_MEMORY_FOR_POSIX_BARRIERS( CONFIGURE_MAXIMUM_POSIX_BARRIERS ),
     2373    CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS( CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ),
     2374    CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( CONFIGURE_MAXIMUM_POSIX_RWLOCKS ),
     2375    CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
     2376#endif
     2377
     2378    /* Stack space sizes */
     2379    CONFIGURE_IDLE_TASKS_STACK,
     2380    CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS,
     2381    CONFIGURE_TASKS_STACK,
     2382    CONFIGURE_POSIX_THREADS_STACK,
     2383    CONFIGURE_GOROUTINES_STACK,
     2384    CONFIGURE_ADA_TASKS_STACK,
     2385    CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK,
     2386    CONFIGURE_EXTRA_TASK_STACKS
     2387  };
     2388#endif
     2389
    23212390/*
    23222391 *  Make sure a task/thread of some sort is configured.
    23232392 *
  • cpukit/sapi/include/rtems/config.h

    RCS file: /usr1/CVS/rtems/cpukit/sapi/include/rtems/config.h,v
    retrieving revision 1.56
    diff -u -r1.56 config.h
     
    104104   */
    105105  uintptr_t                      work_space_size;
    106106
     107  /** This field specifies the size in bytes of the RTEMS thread stack space.
     108   */
     109  uintptr_t                      stack_space_size;
     110
    107111  /** This field specifies the maximum number of dynamically installed
    108112   *  used extensions.
    109113   */
     
    152156   */
    153157  bool                           do_zero_of_workspace;
    154158
     159  /**
     160   * @brief Specifies if a unified work area is used or not.
     161   *
     162   * If this element is @a true, then the RTEMS Workspace and the C Program
     163   * Heap use the same heap, otherwise they use separate heaps.
     164   */
     165  bool                           unified_work_area;
     166
     167  /**
     168   * @brief Specifies if the stack allocator avoids the work space.
     169   *
     170   * If this element is @a true, then the stack allocator must not allocate the
     171   * thread stacks from the RTEMS Workspace, otherwise it should allocate the
     172   * thread stacks from the RTEMS Workspace.
     173   */
     174  bool                           stack_allocator_avoids_work_space;
     175
    155176  uint32_t                       maximum_drivers;
    156177  uint32_t                       number_of_device_drivers;
    157178  rtems_driver_address_table    *Device_driver_table;
     
    193214#define rtems_configuration_get_table() \
    194215        (&Configuration)
    195216
     217#define rtems_configuration_get_unified_work_area() \
     218        (Configuration.unified_work_area)
     219
     220#define rtems_configuration_get_stack_allocator_avoids_work_space() \
     221        (Configuration.stack_allocator_avoids_work_space)
     222
     223#define rtems_configuration_get_stack_space_size() \
     224        (Configuration.stack_space_size)
     225
     226#define rtems_configuration_set_stack_space_size( _size ) \
     227        do { Configuration.stack_space_size = (_size); } while (0)
     228
    196229#define rtems_configuration_get_work_space_start() \
    197230        (Configuration.work_space_start)
    198231
     232#define rtems_configuration_set_work_space_start( _start ) \
     233        do { Configuration.work_space_start = (_start); } while (0)
     234
    199235#define rtems_configuration_get_work_space_size() \
    200         (Configuration.work_space_size)
     236        (Configuration.work_space_size + \
     237          (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
     238            0 : rtems_configuration_get_stack_space_size()))
     239
     240#define rtems_configuration_set_work_space_size( _size ) \
     241        do { Configuration.work_space_size = (_size); } while (0)
    201242
    202243#define rtems_configuration_get_maximum_extensions() \
    203244        (Configuration.maximum_extensions)
     
    254295
    255296#if defined(RTEMS_MULTIPROCESSING)
    256297  #define rtems_configuration_get_user_multiprocessing_table() \
    257           (Configuration.User_multiprocessing_table)
     298        (Configuration.User_multiprocessing_table)
    258299#else
    259   #define rtems_configuration_get_user_multiprocessing_table() NULL
     300  #define rtems_configuration_get_user_multiprocessing_table() \
     301        NULL
    260302#endif
    261303
    262304#define rtems_configuration_get_rtems_api_configuration() \
  • cpukit/score/src/wkspace.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/wkspace.c,v
    retrieving revision 1.35
    diff -u -r1.35 wkspace.c
     
    3333void _Workspace_Handler_initialization(void)
    3434{
    3535  uintptr_t memory_available = 0;
    36   void *starting_address = Configuration.work_space_start;
    37   uintptr_t size = Configuration.work_space_size;
     36  void *starting_address = rtems_configuration_get_work_space_start();
     37  uintptr_t size = rtems_configuration_get_work_space_size();
    3838
    39   if ( Configuration.do_zero_of_workspace )
     39  if ( rtems_configuration_get_do_zero_of_workspace() )
    4040   memset( starting_address, 0, size );
    4141
    4242  memory_available = _Heap_Initialize(
  • testsuites/sptests/spfatal08/testcase.h

    RCS file: /usr1/CVS/rtems/testsuites/sptests/spfatal08/testcase.h,v
    retrieving revision 1.6
    diff -u -r1.6 testcase.h
     
    4141
    4242void force_error()
    4343{
    44   Configuration.work_space_start = Workspace;
    45   Configuration.work_space_size  = 256;
     44  rtems_configuration_set_work_space_start( Workspace );
     45  rtems_configuration_set_work_space_size( sizeof(Workspace) );
     46  rtems_configuration_set_stack_space_size( 0 );
    4647
    4748  rtems_initialize_data_structures();;
    4849  /* we will not run this far */
  • testsuites/sptests/spfatal12/testcase.h

    RCS file: /usr1/CVS/rtems/testsuites/sptests/spfatal12/testcase.h,v
    retrieving revision 1.1
    diff -u -r1.1 testcase.h
     
    1919
    2020void force_error()
    2121{
    22   Configuration.work_space_size  = sizeof(void *);
     22  rtems_configuration_set_work_space_size( sizeof(void *) );
     23  rtems_configuration_set_stack_space_size( 0 );
    2324  rtems_initialize_data_structures();
    2425
    2526  /* we will not run this far */