board.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2009-01-05 Bernard first implementation
  9. */
  10. #include <stdint.h>
  11. #include <rthw.h>
  12. #include <rtthread.h>
  13. #include "board.h"
  14. #include "board_lpc.h"
  15. #include "drv_usart.h"
  16. void _init(void)
  17. {
  18. }
  19. /**
  20. * @brief This function is executed in case of error occurrence.
  21. * @param None
  22. * @retval None
  23. */
  24. void Error_Handler(void)
  25. {
  26. /* USER CODE BEGIN Error_Handler */
  27. /* User can add his own implementation to report the HAL error return state */
  28. while(1)
  29. {
  30. }
  31. /* USER CODE END Error_Handler */
  32. }
  33. /**
  34. * This is the timer interrupt service routine.
  35. *
  36. */
  37. void SysTick_Handler(void)
  38. {
  39. /* enter interrupt */
  40. rt_interrupt_enter();
  41. rt_tick_increase();
  42. /* leave interrupt */
  43. rt_interrupt_leave();
  44. }
  45. void rt_hw_systick_init(void)
  46. {
  47. SystemCoreClockUpdate();
  48. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  49. }
  50. /**
  51. * This function will initial LPC8XX board.
  52. */
  53. rt_weak void rt_hw_board_init()
  54. {
  55. rt_hw_systick_init();
  56. #ifdef RT_USING_HEAP
  57. rt_system_heap_init((void*)HEAP_BEGIN, (void*)HEAP_END);
  58. #endif
  59. /* USART driver initialization is open by default */
  60. #ifdef RT_USING_SERIAL
  61. rt_hw_usart_init();
  62. #endif
  63. /* Set the shell console output device */
  64. #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
  65. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  66. #endif
  67. /* Board underlying hardware initialization */
  68. #ifdef RT_USING_COMPONENTS_INIT
  69. rt_components_board_init();
  70. #endif
  71. }
  72. /*@}*/