board.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2006-2018, 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. * 2018-08-17 whj add to new rt_console_set_device
  10. */
  11. #include <rthw.h>
  12. #include <rtthread.h>
  13. #include "board.h"
  14. #include "usart.h"
  15. /**
  16. * @addtogroup STM32
  17. */
  18. /*@{*/
  19. /*******************************************************************************
  20. * Function Name : NVIC_Configuration
  21. * Description : Configures Vector Table base location.
  22. * Input : None
  23. * Output : None
  24. * Return : None
  25. *******************************************************************************/
  26. void NVIC_Configuration(void)
  27. {
  28. #ifdef VECT_TAB_RAM
  29. /* Set the Vector Table base location at 0x20000000 */
  30. NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
  31. #else /* VECT_TAB_FLASH */
  32. /* Set the Vector Table base location at 0x08000000 */
  33. NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
  34. #endif
  35. }
  36. /**
  37. * This is the timer interrupt service routine.
  38. *
  39. */
  40. void SysTick_Handler(void)
  41. {
  42. /* enter interrupt */
  43. rt_interrupt_enter();
  44. rt_tick_increase();
  45. /* leave interrupt */
  46. rt_interrupt_leave();
  47. }
  48. /**
  49. * This function will initial STM32 board.
  50. */
  51. void rt_hw_board_init(void)
  52. {
  53. /* NVIC Configuration */
  54. NVIC_Configuration();
  55. /* Configure the SysTick */
  56. SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND );
  57. rt_components_board_init();
  58. rt_hw_usart_init();
  59. #ifdef RT_USING_CONSOLE
  60. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  61. #endif
  62. }
  63. /*@}*/