* @brief This function will call all levels of initialization functions to complete * the initialization of the system, and finally start the scheduler. * * @return Normally never returns. If 0 is returned, the scheduler failed. */
| 236 | * @return Normally never returns. If 0 is returned, the scheduler failed. |
| 237 | */ |
| 238 | int rtthread_startup(void) |
| 239 | { |
| 240 | #ifdef RT_USING_SMP |
| 241 | rt_hw_spin_lock_init(&_cpus_lock); |
| 242 | #endif |
| 243 | rt_hw_local_irq_disable(); |
| 244 | |
| 245 | /* board level initialization |
| 246 | * NOTE: please initialize heap inside board initialization. |
| 247 | */ |
| 248 | rt_hw_board_init(); |
| 249 | |
| 250 | /* show RT-Thread version */ |
| 251 | rt_show_version(); |
| 252 | |
| 253 | /* timer system initialization */ |
| 254 | rt_system_timer_init(); |
| 255 | |
| 256 | /* scheduler system initialization */ |
| 257 | rt_system_scheduler_init(); |
| 258 | |
| 259 | #ifdef RT_USING_SIGNALS |
| 260 | /* signal system initialization */ |
| 261 | rt_system_signal_init(); |
| 262 | #endif /* RT_USING_SIGNALS */ |
| 263 | |
| 264 | /* create init_thread */ |
| 265 | rt_application_init(); |
| 266 | |
| 267 | /* timer thread initialization */ |
| 268 | rt_system_timer_thread_init(); |
| 269 | |
| 270 | /* idle thread initialization */ |
| 271 | rt_thread_idle_init(); |
| 272 | |
| 273 | /* defunct thread initialization */ |
| 274 | rt_thread_defunct_init(); |
| 275 | |
| 276 | #ifdef RT_USING_SMP |
| 277 | rt_hw_spin_lock(&_cpus_lock); |
| 278 | #endif /* RT_USING_SMP */ |
| 279 | |
| 280 | /* start scheduler */ |
| 281 | rt_system_scheduler_start(); |
| 282 | |
| 283 | /* never reach here */ |
| 284 | return 0; |
| 285 | } |
| 286 | #endif /* RT_USING_USER_MAIN */ |
no test coverage detected