Ticket #1924: config.patch
File config.patch, 32.9 KB (added by Sebastian Huber, on 11/09/11 at 11:58:22) |
---|
-
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
66 66 const char *bsp_boot_cmdline; 67 67 68 68 /* 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 /*74 69 * These are the prototypes and helper routines which are used 75 70 * when the BSP lets the framework handle RAM allocation between 76 71 * the RTEMS Workspace and C Program Heap. … … 84 79 ) 85 80 { 86 81 if ( heap_start == BSP_BOOTCARD_HEAP_USES_WORK_AREA ) { 87 if ( ! rtems_unified_work_area) {82 if ( !rtems_configuration_get_unified_work_area() ) { 88 83 uintptr_t work_space_size = rtems_configuration_get_work_space_size(); 89 84 90 85 heap_start = (char *) work_area_start + work_space_size; … … 121 116 void *heap_start = NULL; 122 117 uintptr_t heap_size = 0; 123 118 uintptr_t sbrk_amount = 0; 124 uint32_t status; 119 uintptr_t work_space_size = 0; 120 uint32_t status = 0; 125 121 126 122 /* 127 123 * Special case for PowerPC: The interrupt disable mask is stored in SPRG0. … … 158 154 */ 159 155 if ( rtems_malloc_sbrk_helpers ) { 160 156 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 ) { 162 159 /* Need to use sbrk right now */ 163 160 uintptr_t sbrk_now; 164 161 165 sbrk_now = ( Configuration.work_space_size - work_area_size) / sbrk_amount;162 sbrk_now = (work_space_size - work_area_size) / sbrk_amount; 166 163 sbrk( sbrk_now * sbrk_amount ); 167 164 } 168 165 } … … 171 168 printk("Configuration error!\n" 172 169 "Application was configured with CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK\n" 173 170 "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; 176 174 } 177 175 #endif 178 176 … … 185 183 * 186 184 * NOTE: Use cast to (void *) and %p since these are uintptr_t types. 187 185 */ 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 ) { 189 188 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, 192 191 (void *) work_area_size 193 192 ); 194 bsp_cleanup(1); 195 return 1; 193 status = 1; 194 bsp_cleanup( status ); 195 return status; 196 196 } 197 197 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 ); 201 200 } 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 } 203 206 } 204 207 205 208 #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
35 35 } 36 36 #else 37 37 rtems_malloc_statistics_t rtems_malloc_statistics; 38 extern bool rtems_unified_work_area;39 38 40 39 void RTEMS_Malloc_Initialize( 41 40 void *heap_begin, … … 43 42 size_t sbrk_amount 44 43 ) 45 44 { 45 bool separate_areas = !rtems_configuration_get_unified_work_area(); 46 46 /* 47 47 * If configured, initialize the statistics support 48 48 */ … … 86 86 * left over from another process. This would be a security violation. 87 87 */ 88 88 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() ) { 93 90 memset( heap_begin, 0, heap_size ); 94 91 } 95 92 … … 99 96 * STDIO cannot work because there will be no buffers. 100 97 */ 101 98 102 if ( !rtems_unified_work_area) {99 if ( separate_areas ) { 103 100 uintptr_t status = _Protected_heap_Initialize( 104 101 RTEMS_Malloc_Heap, 105 102 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
24 24 #include <rtems/score/protectedheap.h> 25 25 #include "internal.h" 26 26 27 extern bool rtems_unified_work_area;28 29 27 void rtems_shell_print_unified_work_area_message(void) 30 28 { 31 29 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" 33 31 ); 34 32 } 35 33 -
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
764 764 #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE 765 765 #endif 766 766 767 #define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \ 768 (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE) 769 767 770 /** 768 771 * @brief Idle task stack size configuration 769 772 * … … 777 780 #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE 778 781 #endif 779 782 #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 780 786 781 787 /** 782 788 * @brief Interrupt stack size configuration … … 855 861 #ifdef CONFIGURE_UNIFIED_WORK_AREAS 856 862 #include <rtems/score/wkspace.h> 857 863 Heap_Control *RTEMS_Malloc_Heap = &_Workspace_Area; 858 bool rtems_unified_work_area = true;859 864 #else 860 865 Heap_Control RTEMS_Malloc_Area; 861 866 Heap_Control *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area; 862 bool rtems_unified_work_area = false;863 867 #endif 864 868 #endif 865 869 … … 1241 1245 #define CONFIGURE_LIBBLOCK_SEMAPHORES 0 1242 1246 #endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */ 1243 1247 1248 #ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 1249 #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0 1250 #endif 1251 1244 1252 #if defined(RTEMS_MULTIPROCESSING) 1245 1253 /* 1246 1254 * Default Multiprocessing Configuration Table. The defaults are … … 1273 1281 #define CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \ 1274 1282 _Configure_Object_RAM((_proxies) + 1, sizeof(Thread_Proxy_control) ) 1275 1283 1276 #ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK1277 #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 01278 #endif1279 1280 1284 #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER 1281 1285 #include <mpci.h> 1282 1286 #define CONFIGURE_MP_MPCI_TABLE_POINTER &MPCI_table … … 1521 1525 1522 1526 #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \ 1523 1527 _Configure_From_workspace( \ 1524 CONFIGURE_MINIMUM_TASK_STACK_SIZE + \1525 1528 sizeof (POSIX_API_Control) + \ 1526 1529 (sizeof (void *) * (CONFIGURE_MAXIMUM_POSIX_KEYS)) \ 1527 1530 ) … … 1639 1642 1640 1643 #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 1641 1644 #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \ 1642 (CONFIGURE_MINIMUM_TASK_STACK_SIZE * 2)1645 CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE 1643 1646 #endif 1644 1647 1645 1648 #ifdef CONFIGURE_INIT … … 1685 1688 CONFIGURE_MAXIMUM_POSIX_SPINLOCKS ) + \ 1686 1689 CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS( \ 1687 1690 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 ) \ 1690 1692 ) 1691 1693 #else 1692 1694 … … 1728 1730 #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0 1729 1731 #endif 1730 1732 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 1738 1733 #else 1739 1734 #define CONFIGURE_GNAT_MUTEXES 0 1740 1735 #define CONFIGURE_MAXIMUM_ADA_TASKS 0 1741 1736 #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0 1742 #define CONFIGURE_ADA_TASKS_STACK 01743 1737 #endif 1744 1738 1745 1739 #ifdef CONFIGURE_ENABLE_GO … … 1795 1789 #define CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB 0 1796 1790 #endif 1797 1791 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 1798 1799 1799 1800 /* 1800 1801 * Calculate the RAM size based on the maximum number of objects configured. … … 1813 1814 ( \ 1814 1815 _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \ 1815 1816 (_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 + \ 1818 1818 CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB + \ 1819 1819 CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \ 1820 1820 CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER)) + \ … … 1833 1833 (CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \ 1834 1834 CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS( \ 1835 1835 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) \ 1838 1837 ) 1839 1838 #else 1840 1839 #define CONFIGURE_MEMORY_FOR_MP 0 1841 1840 #endif 1842 1841 1843 1842 /** 1844 * This is so we can account for tasks with stacks greater than minimum1845 * size. This is in bytes.1846 */1847 #ifndef CONFIGURE_EXTRA_TASK_STACKS1848 #define CONFIGURE_EXTRA_TASK_STACKS 01849 #endif1850 1851 /**1852 1843 * The following macro is used to calculate the memory allocated by RTEMS 1853 1844 * for the message buffers associated with a particular message queue. 1854 1845 * There is a fixed amount of overhead per message. … … 1915 1906 _Configure_Object_RAM(1, sizeof(API_Mutex_Control)) 1916 1907 1917 1908 /** 1918 * This defines the formula used to compute the amount of memory1919 * 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 /**1927 1909 * This calculates the amount of memory reserved for the IDLE tasks. 1928 1910 * In an SMP system, each CPU core has its own idle task. 1929 1911 */ 1930 1912 #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 1933 1914 #else 1934 #define CONFIGURE_MEMORY_FOR_IDLE_TASK \ 1935 CONFIGURE_IDLE_TASKS(1) 1915 #define CONFIGURE_IDLE_TASKS_COUNT 1 1936 1916 #endif 1937 1917 1938 1918 /** 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 /** 1939 1926 * This macro accounts for general RTEMS system overhead. 1940 1927 */ 1941 1928 #define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \ … … 1946 1933 CONFIGURE_API_MUTEX_MEMORY /* allocation mutex */ \ 1947 1934 ) 1948 1935 1949 /*1950 * Now account for any extra memory that initialization tasks or threads1951 * may have requested.1952 */1953 1954 /**1955 * This accounts for any extra memory required by the Classic API1956 * 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 #else1962 #define CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 01963 #endif1964 1965 /**1966 * This accounts for any extra memory required by the POSIX API1967 * 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 #else1974 #define CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 01975 #endif1976 1977 /**1978 * This macro provides a summation of the various initialization task1979 * 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 1985 1936 /** 1986 1937 * This macro provides a summation of the various task and thread 1987 1938 * requirements. … … 2030 1981 #define CONFIGURE_MEMORY_FOR_SMP 0 2031 1982 #endif 2032 1983 2033 #if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)2034 /**2035 * This is a debug mechanism, so if you need to, the executable will2036 * have a structure with various partial values. Add to this as you2037 * need to. Viewing this structure in gdb combined with dumping2038 * the Configuration structures generated should help a lot in tracing2039 * 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_API2071 /* 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 #endif2083 } 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_API2117 /* 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 #endif2134 };2135 #endif2136 2137 1984 /** 2138 1985 * This calculates the memory required for the executive workspace. 2139 1986 */ … … 2145 1992 CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS) + \ 2146 1993 CONFIGURE_MEMORY_FOR_CLASSIC + \ 2147 1994 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 + \2151 1995 CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \ 2152 1996 CONFIGURE_MEMORY_FOR_MP + \ 2153 1997 CONFIGURE_MEMORY_FOR_SMP + \ 2154 1998 CONFIGURE_MESSAGE_BUFFER_MEMORY + \ 2155 (CONFIGURE_MEMORY_OVERHEAD * 1024) + \ 2156 (CONFIGURE_EXTRA_TASK_STACKS) + (CONFIGURE_ADA_TASKS_STACK) \ 1999 (CONFIGURE_MEMORY_OVERHEAD * 1024) \ 2157 2000 ) & ~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 2158 2016 #endif 2159 2017 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 2160 2091 #ifdef CONFIGURE_INIT 2161 2092 /** 2162 2093 * This is the Classic API Configuration Table. … … 2230 2161 rtems_configuration_table Configuration = { 2231 2162 NULL, /* filled in by BSP */ 2232 2163 CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */ 2164 CONFIGURE_STACK_SPACE_SIZE, /* required stack space */ 2233 2165 CONFIGURE_MAXIMUM_USER_EXTENSIONS, /* maximum dynamic extensions */ 2234 2166 CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */ 2235 2167 CONFIGURE_TICKS_PER_TIMESLICE, /* ticks per timeslice quantum */ … … 2239 2171 CONFIGURE_TASK_STACK_ALLOCATOR, /* stack allocator */ 2240 2172 CONFIGURE_TASK_STACK_DEALLOCATOR, /* stack deallocator */ 2241 2173 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 2242 2186 CONFIGURE_MAXIMUM_DRIVERS, /* maximum device drivers */ 2243 2187 CONFIGURE_NUMBER_OF_DRIVERS, /* static device drivers */ 2244 2188 Device_drivers, /* pointer to driver table */ … … 2318 2262 ****************************************************************** 2319 2263 */ 2320 2264 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 2321 2390 /* 2322 2391 * Make sure a task/thread of some sort is configured. 2323 2392 * -
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
104 104 */ 105 105 uintptr_t work_space_size; 106 106 107 /** This field specifies the size in bytes of the RTEMS thread stack space. 108 */ 109 uintptr_t stack_space_size; 110 107 111 /** This field specifies the maximum number of dynamically installed 108 112 * used extensions. 109 113 */ … … 152 156 */ 153 157 bool do_zero_of_workspace; 154 158 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 155 176 uint32_t maximum_drivers; 156 177 uint32_t number_of_device_drivers; 157 178 rtems_driver_address_table *Device_driver_table; … … 193 214 #define rtems_configuration_get_table() \ 194 215 (&Configuration) 195 216 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 196 229 #define rtems_configuration_get_work_space_start() \ 197 230 (Configuration.work_space_start) 198 231 232 #define rtems_configuration_set_work_space_start( _start ) \ 233 do { Configuration.work_space_start = (_start); } while (0) 234 199 235 #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) 201 242 202 243 #define rtems_configuration_get_maximum_extensions() \ 203 244 (Configuration.maximum_extensions) … … 254 295 255 296 #if defined(RTEMS_MULTIPROCESSING) 256 297 #define rtems_configuration_get_user_multiprocessing_table() \ 257 298 (Configuration.User_multiprocessing_table) 258 299 #else 259 #define rtems_configuration_get_user_multiprocessing_table() NULL 300 #define rtems_configuration_get_user_multiprocessing_table() \ 301 NULL 260 302 #endif 261 303 262 304 #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
33 33 void _Workspace_Handler_initialization(void) 34 34 { 35 35 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(); 38 38 39 if ( Configuration.do_zero_of_workspace)39 if ( rtems_configuration_get_do_zero_of_workspace() ) 40 40 memset( starting_address, 0, size ); 41 41 42 42 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
41 41 42 42 void force_error() 43 43 { 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 ); 46 47 47 48 rtems_initialize_data_structures();; 48 49 /* 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
19 19 20 20 void force_error() 21 21 { 22 Configuration.work_space_size = sizeof(void *); 22 rtems_configuration_set_work_space_size( sizeof(void *) ); 23 rtems_configuration_set_stack_space_size( 0 ); 23 24 rtems_initialize_data_structures(); 24 25 25 26 /* we will not run this far */