board.c 1.5 KB

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