board.c 1.6 KB

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