startup.c 1.6 KB
Newer Older
P
Peng Fan 已提交
1
/*
2
 * Copyright (c) 2006-2021, RT-Thread Development Team
P
Peng Fan 已提交
3
 *
4
 * SPDX-License-Identifier: Apache-2.0
P
Peng Fan 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 *
 * Change Logs:
 * Date           Author       Notes
 * 2013-7-14      Peng Fan     Modified from mini4020
 */

#include <rthw.h>
#include <rtthread.h>

#include <board.h>
#include <serial.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif

#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <netif/ethernetif.h>
#endif

#include <sep6200.h>

rt_uint8_t _irq_stack_start[1024];
rt_uint8_t _fiq_stack_start[1024];
rt_uint8_t _undefined_stack_start[512];
rt_uint8_t _abort_stack_start[512];
31
rt_uint8_t _priv_stack_start[4096]; RT_SECTION(".nobss");
P
Peng Fan 已提交
32 33 34 35 36 37
extern unsigned char __bss_start;
extern unsigned char __bss_end;


extern void rt_hw_board_init(void);
extern void rt_application_init(void);
38
extern int finsh_system_init(void);
P
Peng Fan 已提交
39 40 41 42
extern void sd_init(void);

void rtthread_startup()
{
43 44
    /* init hardware interrupt */
    rt_hw_interrupt_init();
P
Peng Fan 已提交
45

46 47
    /* init board */
    rt_hw_board_init();
P
Peng Fan 已提交
48

49 50
    /* show version */
    rt_show_version();
P
Peng Fan 已提交
51

52 53
    /* init timer system */
    rt_system_timer_init();
P
Peng Fan 已提交
54

55 56
    /* init heap memory system */
    rt_system_heap_init(&__bss_end, (void*)0x45000000);
P
Peng Fan 已提交
57

58 59
    /* init scheduler system */
    rt_system_scheduler_init();
P
Peng Fan 已提交
60

61 62
    /* init application */
    rt_application_init();
P
Peng Fan 已提交
63 64

#ifdef RT_USING_FINSH
65 66
    /* init finsh */
    finsh_system_init();
P
Peng Fan 已提交
67
#ifdef RT_USING_DEVICE
68
    finsh_set_device("uart0");
P
Peng Fan 已提交
69 70 71 72 73
#endif
#endif

  rt_system_timer_thread_init();

74 75
    /* init idle thread */
    rt_thread_idle_init();
P
Peng Fan 已提交
76

77 78
    /* start scheduler */
    rt_system_scheduler_start();
P
Peng Fan 已提交
79

80 81
    /* never reach here */
    return ;
P
Peng Fan 已提交
82 83

}