board.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * File : board.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2014 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. * 2014-06-20 xiaonong ported to LPC43xx
  14. */
  15. #include <rthw.h>
  16. #include <rtthread.h>
  17. #include "board.h"
  18. #include "drv_uart.h"
  19. /**
  20. * This is the timer interrupt service routine.
  21. *
  22. */
  23. void SysTick_Handler(void)
  24. {
  25. /* enter interrupt */
  26. rt_interrupt_enter();
  27. rt_tick_increase();
  28. /* leave interrupt */
  29. rt_interrupt_leave();
  30. }
  31. extern void SystemCoreClockUpdate(void);
  32. /**
  33. * This function will initial LPC43xx board.
  34. */
  35. void rt_hw_board_init()
  36. {
  37. #ifdef CORE_M4
  38. /* NVIC Configuration */
  39. #ifdef VECT_TAB_RAM
  40. /* Set the Vector Table base location at 0x10000000 */
  41. SCB->VTOR = 0x10000000;
  42. #else /* VECT_TAB_FLASH */
  43. /* Set the Vector Table base location at 0x00000000 */
  44. SCB->VTOR = 0x1A000000;
  45. #endif
  46. #endif
  47. /* update the core clock */
  48. SystemCoreClockUpdate();
  49. /* init systick */
  50. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  51. /* set pend exception priority */
  52. NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
  53. /* init uart device */
  54. rt_hw_uart_init();
  55. /* setup the console device */
  56. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  57. #if LPC_EXT_SDRAM == 1
  58. lpc_sdram_hw_init();
  59. mpu_init();
  60. #endif
  61. }