with Nucleo STM32F302R8 support (until merged)
Dependents: m2x-demo-all-cc3000
Fork of mbed-rtos by
RTX_Conf_CM.c
00001 /*---------------------------------------------------------------------------- 00002 * RL-ARM - RTX 00003 *---------------------------------------------------------------------------- 00004 * Name: RTX_Conf_CM.C 00005 * Purpose: Configuration of CMSIS RTX Kernel for Cortex-M 00006 * Rev.: V4.60 00007 *---------------------------------------------------------------------------- 00008 * 00009 * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH 00010 * All rights reserved. 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions are met: 00013 * - Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * - Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * - Neither the name of ARM nor the names of its contributors may be used 00019 * to endorse or promote products derived from this software without 00020 * specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 00026 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *---------------------------------------------------------------------------*/ 00034 00035 #include "cmsis_os.h" 00036 00037 00038 /*---------------------------------------------------------------------------- 00039 * RTX User configuration part BEGIN 00040 *---------------------------------------------------------------------------*/ 00041 00042 //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- 00043 // 00044 // <h>Thread Configuration 00045 // ======================= 00046 // 00047 // <o>Number of concurrent running threads <0-250> 00048 // <i> Defines max. number of threads that will run at the same time. 00049 // counting "main", but not counting "osTimerThread" 00050 // <i> Default: 6 00051 #ifndef OS_TASKCNT 00052 # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347) || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\ 00053 || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) || defined(TARGET_NRF51822) || defined(TARGET_STM32F411RE) 00054 # define OS_TASKCNT 14 00055 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ 00056 || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ 00057 || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) 00058 # define OS_TASKCNT 6 00059 # else 00060 # error "no target defined" 00061 # endif 00062 #endif 00063 00064 // <o>Scheduler (+ interrupts) stack size [bytes] <64-4096:8><#/4> 00065 #ifndef OS_SCHEDULERSTKSIZE 00066 # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347) || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\ 00067 || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) || defined(TARGET_NRF51822) || defined(TARGET_STM32F411RE) 00068 # define OS_SCHEDULERSTKSIZE 256 00069 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ 00070 || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ 00071 || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) 00072 # define OS_SCHEDULERSTKSIZE 128 00073 # else 00074 # error "no target defined" 00075 # endif 00076 #endif 00077 00078 // <o>Idle stack size [bytes] <64-4096:8><#/4> 00079 // <i> Defines default stack size for the Idle thread. 00080 #ifndef OS_IDLESTKSIZE 00081 #define OS_IDLESTKSIZE 128 00082 #endif 00083 00084 // <o>Timer Thread stack size [bytes] <64-4096:8><#/4> 00085 // <i> Defines stack size for Timer thread. 00086 // <i> Default: 200 00087 #ifndef OS_TIMERSTKSZ 00088 #define OS_TIMERSTKSZ WORDS_STACK_SIZE 00089 #endif 00090 00091 // <q>Check for stack overflow 00092 // <i> Includes the stack checking code for stack overflow. 00093 // <i> Note that additional code reduces the Kernel performance. 00094 #ifndef OS_STKCHECK 00095 #define OS_STKCHECK 1 00096 #endif 00097 00098 // <o>Processor mode for thread execution 00099 // <0=> Unprivileged mode 00100 // <1=> Privileged mode 00101 // <i> Default: Privileged mode 00102 #ifndef OS_RUNPRIV 00103 #define OS_RUNPRIV 1 00104 #endif 00105 00106 // </h> 00107 // <h>SysTick Timer Configuration 00108 // ============================== 00109 // 00110 // <o>Timer clock value [Hz] <1-1000000000> 00111 // <i> Defines the timer clock value. 00112 // <i> Default: 6000000 (6MHz) 00113 #ifndef OS_CLOCK 00114 # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) 00115 # define OS_CLOCK 96000000 00116 00117 # elif defined(TARGET_LPC1347) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_STM32F302R8) 00118 # define OS_CLOCK 72000000 00119 00120 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F051R8) || defined(TARGET_LPC11U68) 00121 # define OS_CLOCK 48000000 00122 00123 # elif defined(TARGET_LPC812) 00124 # define OS_CLOCK 36000000 00125 00126 # elif defined(TARGET_LPC824) 00127 # define OS_CLOCK 30000000 00128 00129 # elif defined(TARGET_STM32F100RB) 00130 # define OS_CLOCK 24000000 00131 00132 # elif defined(TARGET_LPC4088) || defined(TARGET_K64F) 00133 # define OS_CLOCK 120000000 00134 00135 # elif defined(TARGET_LPC4337) 00136 # define OS_CLOCK 204000000 00137 00138 # elif defined(TARGET_STM32F407) || defined(TARGET_F407VG) 00139 # define OS_CLOCK 168000000 00140 00141 # elif defined(TARGET_NRF51822) 00142 # define OS_CLOCK 16000000 00143 00144 # elif defined(TARGET_STM32F401RE) 00145 # define OS_CLOCK 84000000 00146 00147 # elif defined(TARGET_STM32F411RE) 00148 # define OS_CLOCK 100000000 00149 00150 #elif defined(TARGET_STM32F103RB) 00151 # define OS_CLOCK 72000000 00152 00153 # else 00154 # error "no target defined" 00155 # endif 00156 #endif 00157 00158 // <o>Timer tick value [us] <1-1000000> 00159 // <i> Defines the timer tick value. 00160 // <i> Default: 1000 (1ms) 00161 #ifndef OS_TICK 00162 #define OS_TICK 1000 00163 #endif 00164 00165 // </h> 00166 00167 // <h>System Configuration 00168 // ======================= 00169 // 00170 // <e>Round-Robin Thread switching 00171 // =============================== 00172 // 00173 // <i> Enables Round-Robin Thread switching. 00174 #ifndef OS_ROBIN 00175 #define OS_ROBIN 1 00176 #endif 00177 00178 // <o>Round-Robin Timeout [ticks] <1-1000> 00179 // <i> Defines how long a thread will execute before a thread switch. 00180 // <i> Default: 5 00181 #ifndef OS_ROBINTOUT 00182 #define OS_ROBINTOUT 5 00183 #endif 00184 00185 // </e> 00186 00187 // <e>User Timers 00188 // ============== 00189 // <i> Enables user Timers 00190 #ifndef OS_TIMERS 00191 #define OS_TIMERS 1 00192 #endif 00193 00194 // <o>Timer Thread Priority 00195 // <1=> Low 00196 // <2=> Below Normal 00197 // <3=> Normal 00198 // <4=> Above Normal 00199 // <5=> High 00200 // <6=> Realtime (highest) 00201 // <i> Defines priority for Timer Thread 00202 // <i> Default: High 00203 #ifndef OS_TIMERPRIO 00204 #define OS_TIMERPRIO 5 00205 #endif 00206 00207 // <o>Timer Callback Queue size <1-32> 00208 // <i> Number of concurrent active timer callback functions. 00209 // <i> Default: 4 00210 #ifndef OS_TIMERCBQSZ 00211 #define OS_TIMERCBQS 4 00212 #endif 00213 00214 // </e> 00215 00216 // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries 00217 // <12=> 12 entries <16=> 16 entries 00218 // <24=> 24 entries <32=> 32 entries 00219 // <48=> 48 entries <64=> 64 entries 00220 // <96=> 96 entries 00221 // <i> ISR functions store requests to this buffer, 00222 // <i> when they are called from the interrupt handler. 00223 // <i> Default: 16 entries 00224 #ifndef OS_FIFOSZ 00225 #define OS_FIFOSZ 16 00226 #endif 00227 00228 // </h> 00229 00230 //------------- <<< end of configuration section >>> ----------------------- 00231 00232 // Standard library system mutexes 00233 // =============================== 00234 // Define max. number system mutexes that are used to protect 00235 // the arm standard runtime library. For microlib they are not used. 00236 #ifndef OS_MUTEXCNT 00237 #define OS_MUTEXCNT 12 00238 #endif 00239 00240 /*---------------------------------------------------------------------------- 00241 * RTX User configuration part END 00242 *---------------------------------------------------------------------------*/ 00243 00244 #define OS_TRV ((uint32_t)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1) 00245 00246 00247 /*---------------------------------------------------------------------------- 00248 * OS Idle daemon 00249 *---------------------------------------------------------------------------*/ 00250 void os_idle_demon (void) { 00251 /* The idle demon is a system thread, running when no other thread is */ 00252 /* ready to run. */ 00253 00254 /* Sleep: ideally, we should put the chip to sleep. 00255 Unfortunately, this usually requires disconnecting the interface chip (debugger). 00256 This can be done, but it would break the local file system. 00257 */ 00258 for (;;) { 00259 // sleep(); 00260 } 00261 } 00262 00263 /*---------------------------------------------------------------------------- 00264 * RTX Errors 00265 *---------------------------------------------------------------------------*/ 00266 extern void mbed_die(void); 00267 00268 void os_error (uint32_t err_code) { 00269 /* This function is called when a runtime error is detected. Parameter */ 00270 /* 'err_code' holds the runtime error code (defined in RTX_Conf.h). */ 00271 mbed_die(); 00272 } 00273 00274 void sysThreadError(osStatus status) { 00275 if (status != osOK) { 00276 mbed_die(); 00277 } 00278 } 00279 00280 /*---------------------------------------------------------------------------- 00281 * RTX Configuration Functions 00282 *---------------------------------------------------------------------------*/ 00283 00284 #include "RTX_CM_lib.h" 00285 00286 /*---------------------------------------------------------------------------- 00287 * end of file 00288 *---------------------------------------------------------------------------*/ 00289
Generated on Tue Jul 12 2022 21:45:15 by
1.7.2
