1 /* 2 * Copyright (c) 2006-2022, Synwit Technology Co.,Ltd. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2018-05-31 ZYH first version 9 * 2018-12-10 Zohar_Lee format file 10 */ 11 12 #include "board.h" 13 bsp_clock_config(void)14static void bsp_clock_config(void) 15 { 16 SystemInit(); 17 SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); 18 SysTick->CTRL |= 0x00000004UL; 19 } 20 SysTick_Handler(void)21void SysTick_Handler(void) 22 { 23 /* enter interrupt */ 24 rt_interrupt_enter(); 25 26 rt_tick_increase(); 27 28 /* leave interrupt */ 29 rt_interrupt_leave(); 30 } 31 rt_hw_board_init()32void rt_hw_board_init() 33 { 34 bsp_clock_config(); 35 /* Heap initialization */ 36 #ifdef RT_USING_HEAP 37 rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); 38 #endif 39 /* Pin driver initialization is open by default */ 40 #ifdef RT_USING_PIN 41 swm_pin_init(); 42 #endif 43 /* USART driver initialization is open by default */ 44 #ifdef RT_USING_SERIAL 45 swm_uart_init(); 46 #endif 47 /* Set the shell console output device */ 48 #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) 49 rt_console_set_device(RT_CONSOLE_DEVICE_NAME); 50 #endif 51 /* Board underlying hardware initialization */ 52 #ifdef RT_USING_COMPONENTS_INIT 53 rt_components_board_init(); 54 #endif 55 56 } 57