board.c 878 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2006-2018, 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. #include "board.h"
  12. static void bsp_clock_config(void)
  13. {
  14. SystemInit();
  15. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  16. SysTick->CTRL |= 0x00000004UL;
  17. }
  18. void SysTick_Handler(void)
  19. {
  20. /* enter interrupt */
  21. rt_interrupt_enter();
  22. rt_tick_increase();
  23. /* leave interrupt */
  24. rt_interrupt_leave();
  25. }
  26. void rt_hw_board_init()
  27. {
  28. bsp_clock_config();
  29. #ifdef RT_USING_HEAP
  30. rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
  31. #endif
  32. #ifdef RT_USING_COMPONENTS_INIT
  33. rt_components_board_init();
  34. #endif
  35. #ifdef RT_USING_CONSOLE
  36. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  37. #endif
  38. }