📄 startup.c
字号:
/* * File : startup.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006, RT-Thread Develop Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://openlab.rt-thread.com/license/LICENSE * * Change Logs: * Date Author Notes * 2006-08-31 Bernard first implementation */#include <rtthread.h>#include <rthw.h>#include <AT91SAM7S.h>#include "board.h"extern void rt_hw_interrupt_init(void);extern void rt_hw_board_init(void);extern void rt_serial_init(void);extern void rt_system_timer_init(void);extern void rt_system_scheduler_init(void);extern void rt_thread_idle_init(void);extern void rt_hw_cpu_icache_enable(void);/** * @addtogroup sam7x256 *//*@{*/extern unsigned char __bss_start;extern unsigned char __bss_end;/* clear .bss */void rt_hw_clear_bss(void){ rt_uint32_t *dst; dst = (rt_uint32_t*)&__bss_start; while (dst < (rt_uint32_t*)&__bss_end) *dst++ = 0;}static int j = 0;void led_flash(){ int i; rt_hw_board_led_off(j); for (i = 0; i < 2000000; i ++); if (j > 4) j = 0; else j ++; rt_hw_board_led_on(j); for (i = 0; i < 2000000; i ++);}#ifdef RT_USING_FINSHextern void finsh_system_init(void);#endifextern int rt_application_init(void);extern void rt_show_version();/** * This function will startup RT-Thread RTOS. */void rtthread_startup(void){ /* clear .bss */ rt_hw_clear_bss(); /* init hardware interrupt */ rt_hw_interrupt_init(); /* init board */ rt_hw_board_init(); /* init hardware serial */ rt_serial_init(); rt_show_version(); /* init tick */ rt_system_tick_init(); /* init kernel object */ rt_system_object_init(); /* init timer system */ rt_system_timer_init();#ifdef RT_USING_HEAP/* if the heap memory is used */ /* init memory system */ rt_system_heap_init(&__bss_end, 0x203000);#endif /* init scheduler system */ rt_system_scheduler_init();#ifdef RT_USING_HOOK /* if the hook is used */ /* set idle thread hook */ rt_thread_idle_sethook(led_flash);#endif /* init application */ rt_application_init();#ifdef RT_USING_FINSH /* if finsh is used */ /* init the finsh input */ rt_hw_finsh_init(); /* init finsh */ finsh_system_init();#endif /* init idle thread */ rt_thread_idle_init(); /* start scheduler */ rt_system_scheduler_start(); /* never reach here */ return ;}/*@}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -