board.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * File : board.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2013 RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-01-05 Bernard first implementation
  13. */
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #include "board.h"
  17. /**
  18. * @addtogroup STM32
  19. */
  20. /*@{*/
  21. /*******************************************************************************
  22. * Function Name : NVIC_Configuration
  23. * Description : Configures Vector Table base location.
  24. * Input : None
  25. * Output : None
  26. * Return : None
  27. *******************************************************************************/
  28. void NVIC_Configuration(void)
  29. {
  30. #ifdef VECT_TAB_RAM
  31. /* Set the Vector Table base location at 0x20000000 */
  32. NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
  33. #else /* VECT_TAB_FLASH */
  34. /* Set the Vector Table base location at 0x08000000 */
  35. NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
  36. #endif
  37. }
  38. /**
  39. * This is the timer interrupt service routine.
  40. *
  41. */
  42. void SysTick_Handler(void)
  43. {
  44. /* enter interrupt */
  45. rt_interrupt_enter();
  46. rt_tick_increase();
  47. /* leave interrupt */
  48. rt_interrupt_leave();
  49. }
  50. /**
  51. * This function will initial STM32 board.
  52. */
  53. void rt_hw_board_init(void)
  54. {
  55. /* NVIC Configuration */
  56. NVIC_Configuration();
  57. /* Configure the SysTick */
  58. SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND );
  59. rt_hw_usart_init();
  60. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  61. }
  62. /*@}*/