Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.

Dependents:   denki-yohou_b TestY201 Network-RTOS NTPClient_HelloWorld ... more

Deprecated

This is the mbed 2 rtos library. mbed OS 5 integrates the mbed library with mbed-rtos. With this, we have provided thread safety for all mbed APIs. If you'd like to learn about using mbed OS 5, please see the docs.

Committer:
mbed_official
Date:
Mon May 23 10:00:41 2016 +0100
Revision:
116:0788b1a76461
Parent:
112:53ace74b190c
Child:
118:6635230e06ba
Synchronized with git revision 99fb83ae2190e05b964e33257cb710c9a300f006

Full URL: https://github.com/mbedmicro/mbed/commit/99fb83ae2190e05b964e33257cb710c9a300f006/

RTX - init sequence (C++ array init)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 49:77c8e4604045 1 /*----------------------------------------------------------------------------
mbed_official 112:53ace74b190c 2 * CMSIS-RTOS - RTX
mbed_official 49:77c8e4604045 3 *----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 4 * Name: RTX_CM_LIB.H
mbed_official 49:77c8e4604045 5 * Purpose: RTX Kernel System Configuration
mbed_official 112:53ace74b190c 6 * Rev.: V4.79
mbed_official 49:77c8e4604045 7 *----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 8 *
mbed_official 112:53ace74b190c 9 * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH
mbed_official 49:77c8e4604045 10 * All rights reserved.
mbed_official 49:77c8e4604045 11 * Redistribution and use in source and binary forms, with or without
mbed_official 49:77c8e4604045 12 * modification, are permitted provided that the following conditions are met:
mbed_official 49:77c8e4604045 13 * - Redistributions of source code must retain the above copyright
mbed_official 49:77c8e4604045 14 * notice, this list of conditions and the following disclaimer.
mbed_official 49:77c8e4604045 15 * - Redistributions in binary form must reproduce the above copyright
mbed_official 49:77c8e4604045 16 * notice, this list of conditions and the following disclaimer in the
mbed_official 49:77c8e4604045 17 * documentation and/or other materials provided with the distribution.
mbed_official 49:77c8e4604045 18 * - Neither the name of ARM nor the names of its contributors may be used
mbed_official 49:77c8e4604045 19 * to endorse or promote products derived from this software without
mbed_official 49:77c8e4604045 20 * specific prior written permission.
mbed_official 49:77c8e4604045 21 *
mbed_official 49:77c8e4604045 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 49:77c8e4604045 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 49:77c8e4604045 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
mbed_official 49:77c8e4604045 25 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
mbed_official 49:77c8e4604045 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
mbed_official 49:77c8e4604045 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
mbed_official 49:77c8e4604045 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 49:77c8e4604045 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 49:77c8e4604045 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
mbed_official 49:77c8e4604045 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 49:77c8e4604045 32 * POSSIBILITY OF SUCH DAMAGE.
mbed_official 49:77c8e4604045 33 *---------------------------------------------------------------------------*/
mbed_official 49:77c8e4604045 34 #include "mbed_error.h"
mbed_official 49:77c8e4604045 35
mbed_official 49:77c8e4604045 36 #if defined (__CC_ARM)
mbed_official 49:77c8e4604045 37 #pragma O3
mbed_official 49:77c8e4604045 38 #define __USED __attribute__((used))
mbed_official 49:77c8e4604045 39 #elif defined (__GNUC__)
mbed_official 49:77c8e4604045 40 #pragma GCC optimize ("O3")
mbed_official 49:77c8e4604045 41 #define __USED __attribute__((used))
mbed_official 49:77c8e4604045 42 #elif defined (__ICCARM__)
mbed_official 49:77c8e4604045 43 #define __USED __root
mbed_official 49:77c8e4604045 44 #endif
mbed_official 49:77c8e4604045 45
mbed_official 49:77c8e4604045 46
mbed_official 49:77c8e4604045 47 /*----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 48 * Definitions
mbed_official 49:77c8e4604045 49 *---------------------------------------------------------------------------*/
mbed_official 49:77c8e4604045 50
mbed_official 49:77c8e4604045 51 #define _declare_box(pool,size,cnt) uint32_t pool[(((size)+3)/4)*(cnt) + 3]
mbed_official 49:77c8e4604045 52 #define _declare_box8(pool,size,cnt) uint64_t pool[(((size)+7)/8)*(cnt) + 2]
mbed_official 49:77c8e4604045 53
mbed_official 112:53ace74b190c 54 #define OS_TCB_SIZE 52
mbed_official 49:77c8e4604045 55 #define OS_TMR_SIZE 8
mbed_official 49:77c8e4604045 56
mbed_official 49:77c8e4604045 57 #if defined (__CC_ARM) && !defined (__MICROLIB)
mbed_official 49:77c8e4604045 58
mbed_official 49:77c8e4604045 59 typedef void *OS_ID;
mbed_official 49:77c8e4604045 60 typedef uint32_t OS_TID;
mbed_official 112:53ace74b190c 61 typedef uint32_t OS_MUT[4];
mbed_official 49:77c8e4604045 62 typedef uint32_t OS_RESULT;
mbed_official 49:77c8e4604045 63
mbed_official 49:77c8e4604045 64 #define runtask_id() rt_tsk_self()
mbed_official 49:77c8e4604045 65 #define mutex_init(m) rt_mut_init(m)
mbed_official 112:53ace74b190c 66 #define mutex_wait(m) os_mut_wait(m,0xFFFFU)
mbed_official 49:77c8e4604045 67 #define mutex_rel(m) os_mut_release(m)
mbed_official 49:77c8e4604045 68
mbed_official 112:53ace74b190c 69 extern uint8_t os_running;
mbed_official 49:77c8e4604045 70 extern OS_TID rt_tsk_self (void);
mbed_official 49:77c8e4604045 71 extern void rt_mut_init (OS_ID mutex);
mbed_official 49:77c8e4604045 72 extern OS_RESULT rt_mut_release (OS_ID mutex);
mbed_official 49:77c8e4604045 73 extern OS_RESULT rt_mut_wait (OS_ID mutex, uint16_t timeout);
mbed_official 49:77c8e4604045 74
mbed_official 49:77c8e4604045 75 #define os_mut_wait(mutex,timeout) _os_mut_wait((uint32_t)rt_mut_wait,mutex,timeout)
mbed_official 49:77c8e4604045 76 #define os_mut_release(mutex) _os_mut_release((uint32_t)rt_mut_release,mutex)
mbed_official 49:77c8e4604045 77
mbed_official 49:77c8e4604045 78 OS_RESULT _os_mut_release (uint32_t p, OS_ID mutex) __svc_indirect(0);
mbed_official 49:77c8e4604045 79 OS_RESULT _os_mut_wait (uint32_t p, OS_ID mutex, uint16_t timeout) __svc_indirect(0);
mbed_official 49:77c8e4604045 80
mbed_official 49:77c8e4604045 81 #endif
mbed_official 49:77c8e4604045 82
mbed_official 49:77c8e4604045 83
mbed_official 49:77c8e4604045 84 /*----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 85 * Global Variables
mbed_official 49:77c8e4604045 86 *---------------------------------------------------------------------------*/
mbed_official 49:77c8e4604045 87
mbed_official 112:53ace74b190c 88 #if (OS_TASKCNT == 0)
mbed_official 112:53ace74b190c 89 #error "Invalid number of concurrent running threads!"
mbed_official 112:53ace74b190c 90 #endif
mbed_official 112:53ace74b190c 91
mbed_official 112:53ace74b190c 92 #if (OS_PRIVCNT >= OS_TASKCNT)
mbed_official 112:53ace74b190c 93 #error "Too many threads with user-provided stack size!"
mbed_official 112:53ace74b190c 94 #endif
mbed_official 112:53ace74b190c 95
mbed_official 49:77c8e4604045 96 #if (OS_TIMERS != 0)
mbed_official 49:77c8e4604045 97 #define OS_TASK_CNT (OS_TASKCNT + 1)
mbed_official 112:53ace74b190c 98 #ifndef __MBED_CMSIS_RTOS_CM
mbed_official 112:53ace74b190c 99 #define OS_PRIV_CNT (OS_PRIVCNT + 2)
mbed_official 112:53ace74b190c 100 #define OS_STACK_SZ (4*(OS_PRIVSTKSIZE+OS_MAINSTKSIZE+OS_TIMERSTKSZ))
mbed_official 112:53ace74b190c 101 #endif
mbed_official 49:77c8e4604045 102 #else
mbed_official 49:77c8e4604045 103 #define OS_TASK_CNT OS_TASKCNT
mbed_official 112:53ace74b190c 104 #ifndef __MBED_CMSIS_RTOS_CM
mbed_official 112:53ace74b190c 105 #define OS_PRIV_CNT (OS_PRIVCNT + 1)
mbed_official 112:53ace74b190c 106 #define OS_STACK_SZ (4*(OS_PRIVSTKSIZE+OS_MAINSTKSIZE))
mbed_official 112:53ace74b190c 107 #endif
mbed_official 112:53ace74b190c 108 #endif
mbed_official 112:53ace74b190c 109
mbed_official 112:53ace74b190c 110 #ifndef OS_STKINIT
mbed_official 112:53ace74b190c 111 #define OS_STKINIT 0
mbed_official 49:77c8e4604045 112 #endif
mbed_official 49:77c8e4604045 113
mbed_official 49:77c8e4604045 114 uint16_t const os_maxtaskrun = OS_TASK_CNT;
mbed_official 112:53ace74b190c 115 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 112:53ace74b190c 116 uint32_t const os_stackinfo = (OS_STKINIT<<28) | (OS_STKCHECK<<24) | (OS_IDLESTKSIZE*4);
mbed_official 112:53ace74b190c 117 #else
mbed_official 112:53ace74b190c 118 uint32_t const os_stackinfo = (OS_STKINIT<<28) | (OS_STKCHECK<<24) | (OS_PRIV_CNT<<16) | (OS_STKSIZE*4);
mbed_official 112:53ace74b190c 119 #endif
mbed_official 49:77c8e4604045 120 uint32_t const os_rrobin = (OS_ROBIN << 16) | OS_ROBINTOUT;
mbed_official 112:53ace74b190c 121 uint32_t const os_tickfreq = OS_CLOCK;
mbed_official 112:53ace74b190c 122 uint16_t const os_tickus_i = OS_CLOCK/1000000;
mbed_official 112:53ace74b190c 123 uint16_t const os_tickus_f = (((uint64_t)(OS_CLOCK-1000000*(OS_CLOCK/1000000)))<<16)/1000000;
mbed_official 49:77c8e4604045 124 uint32_t const os_trv = OS_TRV;
mbed_official 49:77c8e4604045 125 uint8_t const os_flags = OS_RUNPRIV;
mbed_official 49:77c8e4604045 126
mbed_official 49:77c8e4604045 127 /* Export following defines to uVision debugger. */
mbed_official 112:53ace74b190c 128 __USED uint32_t const CMSIS_RTOS_API_Version = osCMSIS;
mbed_official 112:53ace74b190c 129 __USED uint32_t const CMSIS_RTOS_RTX_Version = osCMSIS_RTX;
mbed_official 49:77c8e4604045 130 __USED uint32_t const os_clockrate = OS_TICK;
mbed_official 112:53ace74b190c 131 __USED uint32_t const os_timernum = 0U;
mbed_official 112:53ace74b190c 132
mbed_official 112:53ace74b190c 133 /* Memory pool for TCB allocation */
mbed_official 112:53ace74b190c 134 _declare_box (mp_tcb, OS_TCB_SIZE, OS_TASK_CNT);
mbed_official 112:53ace74b190c 135 uint16_t const mp_tcb_size = sizeof(mp_tcb);
mbed_official 49:77c8e4604045 136
mbed_official 112:53ace74b190c 137 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 112:53ace74b190c 138 /* Memory pool for os_idle_demon stack allocation. */
mbed_official 112:53ace74b190c 139 _declare_box8 (mp_stk, OS_IDLESTKSIZE*4, 1);
mbed_official 112:53ace74b190c 140 uint32_t const mp_stk_size = sizeof(mp_stk);
mbed_official 112:53ace74b190c 141 #else
mbed_official 112:53ace74b190c 142 /* Memory pool for System stack allocation (+os_idle_demon). */
mbed_official 112:53ace74b190c 143 _declare_box8 (mp_stk, OS_STKSIZE*4, OS_TASK_CNT-OS_PRIV_CNT+1);
mbed_official 112:53ace74b190c 144 uint32_t const mp_stk_size = sizeof(mp_stk);
mbed_official 112:53ace74b190c 145
mbed_official 112:53ace74b190c 146 /* Memory pool for user specified stack allocation (+main, +timer) */
mbed_official 112:53ace74b190c 147 uint64_t os_stack_mem[2+OS_PRIV_CNT+(OS_STACK_SZ/8)];
mbed_official 112:53ace74b190c 148 uint32_t const os_stack_sz = sizeof(os_stack_mem);
mbed_official 112:53ace74b190c 149 #endif
mbed_official 49:77c8e4604045 150
mbed_official 49:77c8e4604045 151 #ifndef OS_FIFOSZ
mbed_official 49:77c8e4604045 152 #define OS_FIFOSZ 16
mbed_official 49:77c8e4604045 153 #endif
mbed_official 49:77c8e4604045 154
mbed_official 49:77c8e4604045 155 /* Fifo Queue buffer for ISR requests.*/
mbed_official 49:77c8e4604045 156 uint32_t os_fifo[OS_FIFOSZ*2+1];
mbed_official 49:77c8e4604045 157 uint8_t const os_fifo_size = OS_FIFOSZ;
mbed_official 49:77c8e4604045 158
mbed_official 49:77c8e4604045 159 /* An array of Active task pointers. */
mbed_official 49:77c8e4604045 160 void *os_active_TCB[OS_TASK_CNT];
mbed_official 49:77c8e4604045 161
mbed_official 49:77c8e4604045 162 /* User Timers Resources */
mbed_official 49:77c8e4604045 163 #if (OS_TIMERS != 0)
mbed_official 49:77c8e4604045 164 extern void osTimerThread (void const *argument);
mbed_official 112:53ace74b190c 165 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 49:77c8e4604045 166 osThreadDef(osTimerThread, (osPriority)(OS_TIMERPRIO-3), 4*OS_TIMERSTKSZ);
mbed_official 112:53ace74b190c 167 #else
mbed_official 112:53ace74b190c 168 osThreadDef(osTimerThread, (osPriority)(OS_TIMERPRIO-3), 1, 4*OS_TIMERSTKSZ);
mbed_official 112:53ace74b190c 169 #endif
mbed_official 49:77c8e4604045 170 osThreadId osThreadId_osTimerThread;
mbed_official 49:77c8e4604045 171 osMessageQDef(osTimerMessageQ, OS_TIMERCBQS, void *);
mbed_official 49:77c8e4604045 172 osMessageQId osMessageQId_osTimerMessageQ;
mbed_official 49:77c8e4604045 173 #else
mbed_official 49:77c8e4604045 174 osThreadDef_t os_thread_def_osTimerThread = { NULL };
mbed_official 49:77c8e4604045 175 osThreadId osThreadId_osTimerThread;
mbed_official 112:53ace74b190c 176 osMessageQDef(osTimerMessageQ, 0U, void *);
mbed_official 49:77c8e4604045 177 osMessageQId osMessageQId_osTimerMessageQ;
mbed_official 49:77c8e4604045 178 #endif
mbed_official 49:77c8e4604045 179
mbed_official 112:53ace74b190c 180 /* Legacy RTX User Timers not used */
mbed_official 112:53ace74b190c 181 uint32_t os_tmr = 0U;
mbed_official 112:53ace74b190c 182 uint32_t const *m_tmr = NULL;
mbed_official 112:53ace74b190c 183 uint16_t const mp_tmr_size = 0U;
mbed_official 112:53ace74b190c 184
mbed_official 112:53ace74b190c 185 #if defined (__CC_ARM) && !defined (__MICROLIB)
mbed_official 112:53ace74b190c 186 /* A memory space for arm standard library. */
mbed_official 112:53ace74b190c 187 static uint32_t std_libspace[OS_TASK_CNT][96/4];
mbed_official 112:53ace74b190c 188 static OS_MUT std_libmutex[OS_MUTEXCNT];
mbed_official 112:53ace74b190c 189 static uint32_t nr_mutex;
mbed_official 112:53ace74b190c 190 extern void *__libspace_start;
mbed_official 112:53ace74b190c 191 #endif
mbed_official 112:53ace74b190c 192
mbed_official 49:77c8e4604045 193
mbed_official 49:77c8e4604045 194 /*----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 195 * RTX Optimizations (empty functions)
mbed_official 49:77c8e4604045 196 *---------------------------------------------------------------------------*/
mbed_official 49:77c8e4604045 197
mbed_official 49:77c8e4604045 198 #if OS_ROBIN == 0
mbed_official 49:77c8e4604045 199 void rt_init_robin (void) {;}
mbed_official 49:77c8e4604045 200 void rt_chk_robin (void) {;}
mbed_official 49:77c8e4604045 201 #endif
mbed_official 49:77c8e4604045 202
mbed_official 49:77c8e4604045 203 #if OS_STKCHECK == 0
mbed_official 49:77c8e4604045 204 void rt_stk_check (void) {;}
mbed_official 49:77c8e4604045 205 #endif
mbed_official 49:77c8e4604045 206
mbed_official 49:77c8e4604045 207
mbed_official 49:77c8e4604045 208 /*----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 209 * Standard Library multithreading interface
mbed_official 49:77c8e4604045 210 *---------------------------------------------------------------------------*/
mbed_official 49:77c8e4604045 211
mbed_official 49:77c8e4604045 212 #if defined (__CC_ARM) && !defined (__MICROLIB)
mbed_official 112:53ace74b190c 213
mbed_official 112:53ace74b190c 214 /*--------------------------- __user_perthread_libspace ---------------------*/
mbed_official 112:53ace74b190c 215
mbed_official 112:53ace74b190c 216 void *__user_perthread_libspace (void) {
mbed_official 112:53ace74b190c 217 /* Provide a separate libspace for each task. */
mbed_official 112:53ace74b190c 218 uint32_t idx;
mbed_official 49:77c8e4604045 219
mbed_official 112:53ace74b190c 220 idx = (os_running != 0U) ? runtask_id () : 0U;
mbed_official 112:53ace74b190c 221 if (idx == 0U) {
mbed_official 112:53ace74b190c 222 /* RTX not running yet. */
mbed_official 112:53ace74b190c 223 return (&__libspace_start);
mbed_official 112:53ace74b190c 224 }
mbed_official 112:53ace74b190c 225 return ((void *)&std_libspace[idx-1]);
mbed_official 112:53ace74b190c 226 }
mbed_official 112:53ace74b190c 227
mbed_official 112:53ace74b190c 228 /*--------------------------- _mutex_initialize -----------------------------*/
mbed_official 49:77c8e4604045 229
mbed_official 49:77c8e4604045 230 int _mutex_initialize (OS_ID *mutex) {
mbed_official 49:77c8e4604045 231 /* Allocate and initialize a system mutex. */
mbed_official 49:77c8e4604045 232
mbed_official 49:77c8e4604045 233 if (nr_mutex >= OS_MUTEXCNT) {
mbed_official 49:77c8e4604045 234 /* If you are here, you need to increase the number OS_MUTEXCNT. */
mbed_official 49:77c8e4604045 235 error("Not enough stdlib mutexes\n");
mbed_official 49:77c8e4604045 236 }
mbed_official 49:77c8e4604045 237 *mutex = &std_libmutex[nr_mutex++];
mbed_official 49:77c8e4604045 238 mutex_init (*mutex);
mbed_official 49:77c8e4604045 239 return (1);
mbed_official 49:77c8e4604045 240 }
mbed_official 49:77c8e4604045 241
mbed_official 49:77c8e4604045 242
mbed_official 49:77c8e4604045 243 /*--------------------------- _mutex_acquire --------------------------------*/
mbed_official 49:77c8e4604045 244
mbed_official 49:77c8e4604045 245 __attribute__((used)) void _mutex_acquire (OS_ID *mutex) {
mbed_official 49:77c8e4604045 246 /* Acquire a system mutex, lock stdlib resources. */
mbed_official 112:53ace74b190c 247 if (os_running) {
mbed_official 49:77c8e4604045 248 /* RTX running, acquire a mutex. */
mbed_official 49:77c8e4604045 249 mutex_wait (*mutex);
mbed_official 49:77c8e4604045 250 }
mbed_official 49:77c8e4604045 251 }
mbed_official 49:77c8e4604045 252
mbed_official 49:77c8e4604045 253
mbed_official 49:77c8e4604045 254 /*--------------------------- _mutex_release --------------------------------*/
mbed_official 49:77c8e4604045 255
mbed_official 49:77c8e4604045 256 __attribute__((used)) void _mutex_release (OS_ID *mutex) {
mbed_official 49:77c8e4604045 257 /* Release a system mutex, unlock stdlib resources. */
mbed_official 112:53ace74b190c 258 if (os_running) {
mbed_official 49:77c8e4604045 259 /* RTX running, release a mutex. */
mbed_official 49:77c8e4604045 260 mutex_rel (*mutex);
mbed_official 49:77c8e4604045 261 }
mbed_official 49:77c8e4604045 262 }
mbed_official 49:77c8e4604045 263
mbed_official 49:77c8e4604045 264 #endif
mbed_official 49:77c8e4604045 265
mbed_official 49:77c8e4604045 266
mbed_official 49:77c8e4604045 267 /*----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 268 * RTX Startup
mbed_official 49:77c8e4604045 269 *---------------------------------------------------------------------------*/
mbed_official 49:77c8e4604045 270
mbed_official 49:77c8e4604045 271 /* Main Thread definition */
mbed_official 116:0788b1a76461 272 extern void pre_main (void);
mbed_official 116:0788b1a76461 273 osThreadDef_t os_thread_def_main = {(os_pthread)pre_main, osPriorityNormal, 1U, 0U, NULL};
mbed_official 49:77c8e4604045 274
mbed_official 49:77c8e4604045 275 // This define should be probably moved to the CMSIS layer
mbed_official 49:77c8e4604045 276 #if defined(TARGET_LPC1768)
mbed_official 49:77c8e4604045 277 #define INITIAL_SP (0x10008000UL)
mbed_official 49:77c8e4604045 278
mbed_official 49:77c8e4604045 279 #elif defined(TARGET_LPC11U24)
mbed_official 49:77c8e4604045 280 #define INITIAL_SP (0x10002000UL)
mbed_official 49:77c8e4604045 281
mbed_official 49:77c8e4604045 282 #elif defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO)
mbed_official 49:77c8e4604045 283 #define INITIAL_SP (0x10002000UL)
mbed_official 49:77c8e4604045 284
mbed_official 49:77c8e4604045 285 #elif defined(TARGET_LPC1114)
mbed_official 49:77c8e4604045 286 #define INITIAL_SP (0x10001000UL)
mbed_official 49:77c8e4604045 287
mbed_official 49:77c8e4604045 288 #elif defined(TARGET_LPC812)
mbed_official 49:77c8e4604045 289 #define INITIAL_SP (0x10001000UL)
mbed_official 49:77c8e4604045 290
mbed_official 81:e45e4ac7c3c8 291 #elif defined(TARGET_LPC824) || defined(TARGET_SSCI824)
mbed_official 49:77c8e4604045 292 #define INITIAL_SP (0x10002000UL)
mbed_official 49:77c8e4604045 293
mbed_official 49:77c8e4604045 294 #elif defined(TARGET_KL25Z)
mbed_official 49:77c8e4604045 295 #define INITIAL_SP (0x20003000UL)
mbed_official 49:77c8e4604045 296
mbed_official 88:a21475017ae2 297 #elif defined(TARGET_KL26Z)
mbed_official 88:a21475017ae2 298 #define INITIAL_SP (0x20003000UL)
mbed_official 88:a21475017ae2 299
mbed_official 111:162b12aea5f2 300 #elif defined(TARGET_KL27Z)
mbed_official 111:162b12aea5f2 301 #define INITIAL_SP (0x20003000UL)
mbed_official 111:162b12aea5f2 302
mbed_official 49:77c8e4604045 303 #elif defined(TARGET_K64F)
mbed_official 49:77c8e4604045 304 #define INITIAL_SP (0x20030000UL)
mbed_official 49:77c8e4604045 305
mbed_official 52:02f5cf381388 306 #elif defined(TARGET_K22F)
mbed_official 52:02f5cf381388 307 #define INITIAL_SP (0x20010000UL)
mbed_official 52:02f5cf381388 308
mbed_official 49:77c8e4604045 309 #elif defined(TARGET_KL46Z)
mbed_official 49:77c8e4604045 310 #define INITIAL_SP (0x20006000UL)
mbed_official 49:77c8e4604045 311
mbed_official 49:77c8e4604045 312 #elif defined(TARGET_KL43Z)
mbed_official 49:77c8e4604045 313 #define INITIAL_SP (0x20006000UL)
mbed_official 49:77c8e4604045 314
mbed_official 49:77c8e4604045 315 #elif defined(TARGET_KL05Z)
mbed_official 49:77c8e4604045 316 #define INITIAL_SP (0x20000C00UL)
mbed_official 49:77c8e4604045 317
mbed_official 64:ab4200083b07 318 #elif defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM)
mbed_official 49:77c8e4604045 319 #define INITIAL_SP (0x10010000UL)
mbed_official 49:77c8e4604045 320
mbed_official 63:5448826aa700 321 #elif defined(TARGET_LPC4330)
mbed_official 63:5448826aa700 322 #define INITIAL_SP (0x10008000UL)
mbed_official 63:5448826aa700 323
mbed_official 49:77c8e4604045 324 #elif defined(TARGET_LPC4337)
mbed_official 49:77c8e4604045 325 #define INITIAL_SP (0x10008000UL)
mbed_official 49:77c8e4604045 326
mbed_official 49:77c8e4604045 327 #elif defined(TARGET_LPC1347)
mbed_official 49:77c8e4604045 328 #define INITIAL_SP (0x10002000UL)
mbed_official 49:77c8e4604045 329
mbed_official 49:77c8e4604045 330 #elif defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8)
mbed_official 49:77c8e4604045 331 #define INITIAL_SP (0x20002000UL)
mbed_official 49:77c8e4604045 332
mbed_official 49:77c8e4604045 333 #elif defined(TARGET_DISCO_F303VC)
mbed_official 49:77c8e4604045 334 #define INITIAL_SP (0x2000A000UL)
mbed_official 49:77c8e4604045 335
mbed_official 49:77c8e4604045 336 #elif defined(TARGET_STM32F407) || defined(TARGET_F407VG)
mbed_official 49:77c8e4604045 337 #define INITIAL_SP (0x20020000UL)
mbed_official 49:77c8e4604045 338
mbed_official 49:77c8e4604045 339 #elif defined(TARGET_STM32F401RE)
mbed_official 49:77c8e4604045 340 #define INITIAL_SP (0x20018000UL)
mbed_official 49:77c8e4604045 341
mbed_official 49:77c8e4604045 342 #elif defined(TARGET_LPC1549)
mbed_official 49:77c8e4604045 343 #define INITIAL_SP (0x02009000UL)
mbed_official 49:77c8e4604045 344
mbed_official 49:77c8e4604045 345 #elif defined(TARGET_LPC11U68)
mbed_official 89:5aed8bae1001 346 #define INITIAL_SP (0x10008000UL)
mbed_official 49:77c8e4604045 347
mbed_official 49:77c8e4604045 348 #elif defined(TARGET_STM32F411RE)
mbed_official 49:77c8e4604045 349 #define INITIAL_SP (0x20020000UL)
mbed_official 49:77c8e4604045 350
mbed_official 97:6c35e082773a 351 #elif defined(TARGET_STM32F410RB)
mbed_official 97:6c35e082773a 352 #define INITIAL_SP (0x20008000UL)
mbed_official 97:6c35e082773a 353
mbed_official 106:dfc27975e193 354 #elif defined(TARGET_STM32F103RB) || defined(TARGET_STM32L073RZ)
mbed_official 49:77c8e4604045 355 #define INITIAL_SP (0x20005000UL)
mbed_official 49:77c8e4604045 356
mbed_official 49:77c8e4604045 357 #elif defined(TARGET_STM32F302R8)
mbed_official 49:77c8e4604045 358 #define INITIAL_SP (0x20004000UL)
mbed_official 49:77c8e4604045 359
mbed_official 49:77c8e4604045 360 #elif defined(TARGET_STM32F334R8)
mbed_official 49:77c8e4604045 361 #define INITIAL_SP (0x20003000UL)
mbed_official 49:77c8e4604045 362
mbed_official 49:77c8e4604045 363 #elif defined(TARGET_STM32F334C8)
mbed_official 49:77c8e4604045 364 #define INITIAL_SP (0x20003000UL)
mbed_official 49:77c8e4604045 365
mbed_official 50:64a5202c3676 366 #elif defined(TARGET_STM32F405RG)
mbed_official 50:64a5202c3676 367 #define INITIAL_SP (0x20020000UL)
mbed_official 50:64a5202c3676 368
mbed_official 57:430de2831ec7 369 #elif defined(TARGET_STM32F429ZI)
mbed_official 57:430de2831ec7 370 #define INITIAL_SP (0x20030000UL)
mbed_official 57:430de2831ec7 371
mbed_official 108:ac4f3830f9ff 372 #elif defined(TARGET_STM32L031K6) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
mbed_official 59:28712e303960 373 #define INITIAL_SP (0x20002000UL)
mbed_official 59:28712e303960 374
mbed_official 59:28712e303960 375 #elif defined(TARGET_STM32F072RB)
mbed_official 59:28712e303960 376 #define INITIAL_SP (0x20004000UL)
mbed_official 59:28712e303960 377
mbed_official 59:28712e303960 378 #elif defined(TARGET_STM32F091RC)
mbed_official 59:28712e303960 379 #define INITIAL_SP (0x20008000UL)
mbed_official 59:28712e303960 380
mbed_official 60:f4d3d8971bc3 381 #elif defined(TARGET_STM32F401VC)
mbed_official 60:f4d3d8971bc3 382 #define INITIAL_SP (0x20010000UL)
mbed_official 60:f4d3d8971bc3 383
mbed_official 68:d3d0e710b443 384 #elif defined(TARGET_STM32F303RE)
mbed_official 68:d3d0e710b443 385 #define INITIAL_SP (0x20010000UL)
mbed_official 68:d3d0e710b443 386
mbed_official 95:12552ef4e980 387 #elif defined(TARGET_STM32F303K8)
mbed_official 95:12552ef4e980 388 #define INITIAL_SP (0x20003000UL)
mbed_official 95:12552ef4e980 389
mbed_official 105:b4c5542476ba 390 #elif (defined(TARGET_STM32F746NG) || defined(TARGET_STM32F746ZG))
mbed_official 98:c825593ece39 391 #define INITIAL_SP (0x20050000UL)
mbed_official 98:c825593ece39 392
mbed_official 73:34292fba723c 393 #elif defined(TARGET_MAX32610) || defined(TARGET_MAX32600)
mbed_official 71:570e569a5b59 394 #define INITIAL_SP (0x20008000UL)
mbed_official 71:570e569a5b59 395
mbed_official 74:899aee34da6a 396 #elif defined(TARGET_TEENSY3_1)
mbed_official 74:899aee34da6a 397 #define INITIAL_SP (0x20008000UL)
mbed_official 74:899aee34da6a 398
mbed_official 77:3516160e016b 399 #elif defined(TARGET_STM32L152RE)
mbed_official 77:3516160e016b 400 #define INITIAL_SP (0x20014000UL)
mbed_official 77:3516160e016b 401
mbed_official 104:07314541bd12 402 #elif defined(TARGET_NZ32_SC151)
mbed_official 78:2db19f47c2ba 403 #define INITIAL_SP (0x20008000UL)
mbed_official 78:2db19f47c2ba 404
mbed_official 108:ac4f3830f9ff 405 #elif (defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446VE))
mbed_official 79:c586ffeebfb4 406 #define INITIAL_SP (0x20020000UL)
mbed_official 79:c586ffeebfb4 407
mbed_official 87:e695cd34556b 408 #elif defined(TARGET_STM32F070RB) || defined(TARGET_STM32F030R8)
mbed_official 87:e695cd34556b 409 #define INITIAL_SP (0x20002000UL)
mbed_official 87:e695cd34556b 410
mbed_official 91:9d001ed5feec 411 #elif defined(TARGET_STM32L476VG)
mbed_official 91:9d001ed5feec 412 #define INITIAL_SP (0x20018000UL)
mbed_official 91:9d001ed5feec 413
mbed_official 91:9d001ed5feec 414 #elif defined(TARGET_STM32L476RG)
mbed_official 91:9d001ed5feec 415 #define INITIAL_SP (0x20018000UL)
mbed_official 91:9d001ed5feec 416
mbed_official 96:6d90423c236e 417 #elif defined(TARGET_STM32F469NI)
mbed_official 96:6d90423c236e 418 #define INITIAL_SP (0x20050000UL)
mbed_official 96:6d90423c236e 419
mbed_official 99:79d2f32f753f 420 #elif defined(TARGET_STM32L152RC)
mbed_official 99:79d2f32f753f 421 #define INITIAL_SP (0x20008000UL)
mbed_official 99:79d2f32f753f 422
mbed_official 99:79d2f32f753f 423
mbed_official 49:77c8e4604045 424 #else
mbed_official 49:77c8e4604045 425 #error "no target defined"
mbed_official 49:77c8e4604045 426
mbed_official 49:77c8e4604045 427 #endif
mbed_official 49:77c8e4604045 428
mbed_official 49:77c8e4604045 429 #ifdef __CC_ARM
mbed_official 62:444020d511f5 430 extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
mbed_official 49:77c8e4604045 431 #define HEAP_START (Image$$RW_IRAM1$$ZI$$Limit)
mbed_official 49:77c8e4604045 432 #elif defined(__GNUC__)
mbed_official 62:444020d511f5 433 extern uint32_t __end__[];
mbed_official 49:77c8e4604045 434 #define HEAP_START (__end__)
mbed_official 53:c35dab33c427 435 #elif defined(__ICCARM__)
mbed_official 53:c35dab33c427 436 #pragma section="HEAP"
mbed_official 53:c35dab33c427 437 #define HEAP_START (void *)__section_begin("HEAP")
mbed_official 49:77c8e4604045 438 #endif
mbed_official 49:77c8e4604045 439
mbed_official 49:77c8e4604045 440 void set_main_stack(void) {
mbed_official 49:77c8e4604045 441 // That is the bottom of the main stack block: no collision detection
mbed_official 49:77c8e4604045 442 os_thread_def_main.stack_pointer = HEAP_START;
mbed_official 49:77c8e4604045 443
mbed_official 112:53ace74b190c 444 // Leave OS_MAINSTKSIZE words for the scheduler and interrupts
mbed_official 112:53ace74b190c 445 os_thread_def_main.stacksize = (INITIAL_SP - (unsigned int)HEAP_START) - (OS_MAINSTKSIZE * 4);
mbed_official 49:77c8e4604045 446 }
mbed_official 49:77c8e4604045 447
mbed_official 49:77c8e4604045 448 #if defined (__CC_ARM)
mbed_official 112:53ace74b190c 449
mbed_official 49:77c8e4604045 450 #ifdef __MICROLIB
mbed_official 116:0788b1a76461 451
mbed_official 116:0788b1a76461 452 int main(void);
mbed_official 49:77c8e4604045 453 void _main_init (void) __attribute__((section(".ARM.Collect$$$$000000FF")));
mbed_official 116:0788b1a76461 454 void $Super$$__cpp_initialize__aeabi_(void);
mbed_official 116:0788b1a76461 455
mbed_official 49:77c8e4604045 456 void _main_init (void) {
mbed_official 49:77c8e4604045 457 osKernelInitialize();
mbed_official 112:53ace74b190c 458 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 49:77c8e4604045 459 set_main_stack();
mbed_official 112:53ace74b190c 460 #endif
mbed_official 49:77c8e4604045 461 osThreadCreate(&os_thread_def_main, NULL);
mbed_official 49:77c8e4604045 462 osKernelStart();
mbed_official 49:77c8e4604045 463 for (;;);
mbed_official 49:77c8e4604045 464 }
mbed_official 116:0788b1a76461 465
mbed_official 116:0788b1a76461 466 void $Sub$$__cpp_initialize__aeabi_(void)
mbed_official 116:0788b1a76461 467 {
mbed_official 116:0788b1a76461 468 // this should invoke C++ initializers prior _main_init, we keep this empty and
mbed_official 116:0788b1a76461 469 // invoke them after _main_init (=starts RTX kernel)
mbed_official 116:0788b1a76461 470 }
mbed_official 116:0788b1a76461 471
mbed_official 116:0788b1a76461 472 void pre_main()
mbed_official 116:0788b1a76461 473 {
mbed_official 116:0788b1a76461 474 $Super$$__cpp_initialize__aeabi_();
mbed_official 116:0788b1a76461 475 main();
mbed_official 116:0788b1a76461 476 }
mbed_official 116:0788b1a76461 477
mbed_official 49:77c8e4604045 478 #else
mbed_official 49:77c8e4604045 479
mbed_official 116:0788b1a76461 480 void * armcc_heap_base;
mbed_official 116:0788b1a76461 481 void * armcc_heap_top;
mbed_official 116:0788b1a76461 482
mbed_official 116:0788b1a76461 483 __asm void pre_main (void)
mbed_official 116:0788b1a76461 484 {
mbed_official 116:0788b1a76461 485 IMPORT __rt_lib_init
mbed_official 116:0788b1a76461 486 IMPORT main
mbed_official 116:0788b1a76461 487 IMPORT armcc_heap_base
mbed_official 116:0788b1a76461 488 IMPORT armcc_heap_top
mbed_official 116:0788b1a76461 489
mbed_official 116:0788b1a76461 490 LDR R0,=armcc_heap_base
mbed_official 116:0788b1a76461 491 LDR R1,=armcc_heap_top
mbed_official 116:0788b1a76461 492 LDR R0,[R0]
mbed_official 116:0788b1a76461 493 LDR R1,[R1]
mbed_official 116:0788b1a76461 494 /* Save link register (keep 8 byte alignment with dummy R4) */
mbed_official 116:0788b1a76461 495 PUSH {R4, LR}
mbed_official 116:0788b1a76461 496 BL __rt_lib_init
mbed_official 116:0788b1a76461 497 BL main
mbed_official 116:0788b1a76461 498 /* Return to the thread destroy function.
mbed_official 116:0788b1a76461 499 */
mbed_official 116:0788b1a76461 500 POP {R4, PC}
mbed_official 116:0788b1a76461 501 ALIGN
mbed_official 116:0788b1a76461 502 }
mbed_official 116:0788b1a76461 503
mbed_official 49:77c8e4604045 504 /* The single memory model is checking for stack collision at run time, verifing
mbed_official 49:77c8e4604045 505 that the heap pointer is underneath the stack pointer.
mbed_official 49:77c8e4604045 506
mbed_official 49:77c8e4604045 507 With the RTOS there is not only one stack above the heap, there are multiple
mbed_official 49:77c8e4604045 508 stacks and some of them are underneath the heap pointer.
mbed_official 49:77c8e4604045 509 */
mbed_official 49:77c8e4604045 510 #pragma import(__use_two_region_memory)
mbed_official 49:77c8e4604045 511
mbed_official 49:77c8e4604045 512 __asm void __rt_entry (void) {
mbed_official 49:77c8e4604045 513
mbed_official 49:77c8e4604045 514 IMPORT __user_setup_stackheap
mbed_official 116:0788b1a76461 515 IMPORT armcc_heap_base
mbed_official 116:0788b1a76461 516 IMPORT armcc_heap_top
mbed_official 49:77c8e4604045 517 IMPORT os_thread_def_main
mbed_official 49:77c8e4604045 518 IMPORT osKernelInitialize
mbed_official 112:53ace74b190c 519 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 49:77c8e4604045 520 IMPORT set_main_stack
mbed_official 112:53ace74b190c 521 #endif
mbed_official 49:77c8e4604045 522 IMPORT osKernelStart
mbed_official 49:77c8e4604045 523 IMPORT osThreadCreate
mbed_official 49:77c8e4604045 524
mbed_official 116:0788b1a76461 525 /* __user_setup_stackheap returns:
mbed_official 116:0788b1a76461 526 * - Heap base in r0 (if the program uses the heap).
mbed_official 116:0788b1a76461 527 * - Stack base in sp.
mbed_official 116:0788b1a76461 528 * - Heap limit in r2 (if the program uses the heap and uses two-region memory).
mbed_official 116:0788b1a76461 529 *
mbed_official 116:0788b1a76461 530 * More info can be found in:
mbed_official 116:0788b1a76461 531 * ARM Compiler ARM C and C++ Libraries and Floating-Point Support User Guide
mbed_official 116:0788b1a76461 532 */
mbed_official 49:77c8e4604045 533 BL __user_setup_stackheap
mbed_official 116:0788b1a76461 534 LDR R3,=armcc_heap_base
mbed_official 116:0788b1a76461 535 LDR R4,=armcc_heap_top
mbed_official 116:0788b1a76461 536 STR R0,[R3]
mbed_official 116:0788b1a76461 537 STR R2,[R4]
mbed_official 49:77c8e4604045 538 BL osKernelInitialize
mbed_official 112:53ace74b190c 539 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 49:77c8e4604045 540 BL set_main_stack
mbed_official 112:53ace74b190c 541 #endif
mbed_official 49:77c8e4604045 542 LDR R0,=os_thread_def_main
mbed_official 49:77c8e4604045 543 MOVS R1,#0
mbed_official 49:77c8e4604045 544 BL osThreadCreate
mbed_official 49:77c8e4604045 545 BL osKernelStart
mbed_official 116:0788b1a76461 546 /* osKernelStart should not return */
mbed_official 116:0788b1a76461 547 B .
mbed_official 49:77c8e4604045 548
mbed_official 49:77c8e4604045 549 ALIGN
mbed_official 49:77c8e4604045 550 }
mbed_official 112:53ace74b190c 551
mbed_official 49:77c8e4604045 552 #endif
mbed_official 49:77c8e4604045 553
mbed_official 49:77c8e4604045 554 #elif defined (__GNUC__)
mbed_official 49:77c8e4604045 555
mbed_official 116:0788b1a76461 556 extern void __libc_fini_array(void);
mbed_official 49:77c8e4604045 557 extern void __libc_init_array (void);
mbed_official 116:0788b1a76461 558 extern int main(int argc, char **argv);
mbed_official 49:77c8e4604045 559
mbed_official 116:0788b1a76461 560 void pre_main(void) {
mbed_official 116:0788b1a76461 561 atexit(__libc_fini_array);
mbed_official 116:0788b1a76461 562 __libc_init_array();
mbed_official 116:0788b1a76461 563 main(0, NULL);
mbed_official 49:77c8e4604045 564 }
mbed_official 49:77c8e4604045 565
mbed_official 49:77c8e4604045 566 __attribute__((naked)) void software_init_hook (void) {
mbed_official 49:77c8e4604045 567 __asm (
mbed_official 49:77c8e4604045 568 ".syntax unified\n"
mbed_official 49:77c8e4604045 569 ".thumb\n"
mbed_official 49:77c8e4604045 570 "bl osKernelInitialize\n"
mbed_official 112:53ace74b190c 571 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 49:77c8e4604045 572 "bl set_main_stack\n"
mbed_official 112:53ace74b190c 573 #endif
mbed_official 49:77c8e4604045 574 "ldr r0,=os_thread_def_main\n"
mbed_official 49:77c8e4604045 575 "movs r1,#0\n"
mbed_official 49:77c8e4604045 576 "bl osThreadCreate\n"
mbed_official 49:77c8e4604045 577 "bl osKernelStart\n"
mbed_official 116:0788b1a76461 578 /* osKernelStart should not return */
mbed_official 116:0788b1a76461 579 "B .\n"
mbed_official 49:77c8e4604045 580 );
mbed_official 49:77c8e4604045 581 }
mbed_official 49:77c8e4604045 582
mbed_official 49:77c8e4604045 583 #elif defined (__ICCARM__)
mbed_official 49:77c8e4604045 584
mbed_official 56:2b2a7cc13e28 585 extern void* __vector_table;
mbed_official 49:77c8e4604045 586 extern int __low_level_init(void);
mbed_official 49:77c8e4604045 587 extern void __iar_data_init3(void);
mbed_official 56:2b2a7cc13e28 588 extern __weak void __iar_init_core( void );
mbed_official 56:2b2a7cc13e28 589 extern __weak void __iar_init_vfp( void );
mbed_official 56:2b2a7cc13e28 590 extern void __iar_dynamic_initialization(void);
mbed_official 56:2b2a7cc13e28 591 extern void mbed_sdk_init(void);
mbed_official 49:77c8e4604045 592 extern void exit(int arg);
mbed_official 49:77c8e4604045 593
mbed_official 116:0788b1a76461 594 static uint8_t low_level_init_needed;
mbed_official 116:0788b1a76461 595
mbed_official 116:0788b1a76461 596 void pre_main(void) {
mbed_official 116:0788b1a76461 597 if (low_level_init_needed) {
mbed_official 116:0788b1a76461 598 __iar_dynamic_initialization();
mbed_official 116:0788b1a76461 599 }
mbed_official 116:0788b1a76461 600 main();
mbed_official 116:0788b1a76461 601 }
mbed_official 116:0788b1a76461 602
mbed_official 56:2b2a7cc13e28 603 #pragma required=__vector_table
mbed_official 56:2b2a7cc13e28 604 void __iar_program_start( void )
mbed_official 56:2b2a7cc13e28 605 {
mbed_official 112:53ace74b190c 606 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 56:2b2a7cc13e28 607 __iar_init_core();
mbed_official 56:2b2a7cc13e28 608 __iar_init_vfp();
mbed_official 56:2b2a7cc13e28 609
mbed_official 116:0788b1a76461 610 uint8_t low_level_init_needed_local;
mbed_official 49:77c8e4604045 611
mbed_official 116:0788b1a76461 612 low_level_init_needed_local = __low_level_init();
mbed_official 116:0788b1a76461 613 if (low_level_init_needed_local) {
mbed_official 49:77c8e4604045 614 __iar_data_init3();
mbed_official 56:2b2a7cc13e28 615 mbed_sdk_init();
mbed_official 68:d3d0e710b443 616 }
mbed_official 116:0788b1a76461 617 /* Store in a global variable after RAM has been initialized */
mbed_official 116:0788b1a76461 618 low_level_init_needed = low_level_init_needed_local;
mbed_official 112:53ace74b190c 619 #endif
mbed_official 49:77c8e4604045 620 osKernelInitialize();
mbed_official 112:53ace74b190c 621 #ifdef __MBED_CMSIS_RTOS_CM
mbed_official 53:c35dab33c427 622 set_main_stack();
mbed_official 112:53ace74b190c 623 #endif
mbed_official 49:77c8e4604045 624 osThreadCreate(&os_thread_def_main, NULL);
mbed_official 116:0788b1a76461 625 osKernelStart();
mbed_official 116:0788b1a76461 626 /* osKernelStart should not return */
mbed_official 116:0788b1a76461 627 while (1);
mbed_official 49:77c8e4604045 628 }
mbed_official 49:77c8e4604045 629
mbed_official 49:77c8e4604045 630 #endif
mbed_official 49:77c8e4604045 631
mbed_official 49:77c8e4604045 632
mbed_official 49:77c8e4604045 633 /*----------------------------------------------------------------------------
mbed_official 49:77c8e4604045 634 * end of file
mbed_official 49:77c8e4604045 635 *---------------------------------------------------------------------------*/