1 /*
2  * Copyright (c) 2006-2021, YICHIP Technology Co.,Ltd.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021-09-09     WSY          first version
9  */
10 
11 #include <board.h>
12 #if defined(BSP_USING_EXT_SRAM) && defined(RT_USING_MEMHEAP_AS_HEAP)
13     static struct rt_memheap system_heap;
14 #endif
15 #define SystemCoreClock (48000000)
16 
bsp_clock_config(void)17 static void bsp_clock_config(void)
18 {
19     SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
20 }
21 
SysTick_Handler(void)22 void SysTick_Handler(void)
23 {
24     /* enter interrupt */
25     rt_interrupt_enter();
26 
27     rt_tick_increase();
28 
29     /* leave interrupt */
30     rt_interrupt_leave();
31 }
32 
33 #ifdef RT_USING_SERIAL
34 extern int rt_hw_uart_init(void);
35 #endif
36 
rt_hw_board_init()37 void rt_hw_board_init()
38 {
39     bsp_clock_config();
40 
41 #if defined(RT_USING_HEAP)
42     rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
43 #endif
44 
45     /* UART driver initialization is open by default */
46 #ifdef RT_USING_SERIAL
47     rt_hw_uart_init();
48 #endif
49 
50 #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
51     rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
52 #endif
53 
54 #ifdef RT_USING_COMPONENTS_INIT
55     rt_components_board_init();
56 #endif
57 }
58