1
0

board.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef VECT_TAB_RAM
  36. /* Set the Vector Table base location at 0x10000000 */
  37. SCB->VTOR = 0x10000000;
  38. #else /* VECT_TAB_FLASH */
  39. /* Set the Vector Table base location at 0x00000000 */
  40. SCB->VTOR = 0x1A000000;
  41. #endif
  42. #endif
  43. /* update the core clock */
  44. SystemCoreClockUpdate();
  45. /* init systick */
  46. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  47. /* set pend exception priority */
  48. NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
  49. /* init uart device */
  50. rt_hw_uart_init();
  51. /* setup the console device */
  52. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  53. #if LPC_EXT_SDRAM == 1
  54. lpc_sdram_hw_init();
  55. mpu_init();
  56. #endif
  57. }