board.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #include <board.h>
  11. #if defined(BSP_USING_EXT_SRAM) && defined(RT_USING_MEMHEAP_AS_HEAP)
  12. static struct rt_memheap system_heap;
  13. #endif
  14. #define SystemCoreClock (48000000)
  15. static void bsp_clock_config(void)
  16. {
  17. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  18. }
  19. void SysTick_Handler(void)
  20. {
  21. /* enter interrupt */
  22. rt_interrupt_enter();
  23. rt_tick_increase();
  24. /* leave interrupt */
  25. rt_interrupt_leave();
  26. }
  27. #ifdef RT_USING_SERIAL
  28. extern int rt_hw_uart_init(void);
  29. #endif
  30. void rt_hw_board_init()
  31. {
  32. bsp_clock_config();
  33. #if defined(RT_USING_HEAP)
  34. rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
  35. #endif
  36. /* UART driver initialization is open by default */
  37. #ifdef RT_USING_SERIAL
  38. rt_hw_uart_init();
  39. #endif
  40. #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
  41. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  42. #endif
  43. #ifdef RT_USING_COMPONENTS_INIT
  44. rt_components_board_init();
  45. #endif
  46. }