board.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2006-2018, 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. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include "board.h"
  13. #include "drv_uart.h"
  14. #ifdef LPC_EXT_SDRAM
  15. #include "drv_sdram.h"
  16. #endif
  17. /**
  18. * This is the timer interrupt service routine.
  19. *
  20. */
  21. void SysTick_Handler(void)
  22. {
  23. /* enter interrupt */
  24. rt_interrupt_enter();
  25. rt_tick_increase();
  26. /* leave interrupt */
  27. rt_interrupt_leave();
  28. }
  29. /**
  30. * This function will initial LPC40xx board.
  31. */
  32. void rt_hw_board_init()
  33. {
  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. /* init systick */
  44. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND - 1);
  45. /* set pend exception priority */
  46. NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
  47. /*init uart device*/
  48. rt_hw_uart_init();
  49. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  50. #ifdef LPC_EXT_SDRAM
  51. rt_kprintf("Initialize SDRAM ...");
  52. lpc_sdram_hw_init();
  53. rt_kprintf("done!\n");
  54. #endif
  55. // rt_components_board_init();
  56. }