board.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2018 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #include <stdint.h>
  9. #include "board.h"
  10. #include "pin_mux.h"
  11. #include "fsl_common.h"
  12. void rt_hw_board_init()
  13. {
  14. CLOCK_EnableClock(kCLOCK_PortA);
  15. CLOCK_EnableClock(kCLOCK_PortB);
  16. CLOCK_EnableClock(kCLOCK_PortC);
  17. CLOCK_EnableClock(kCLOCK_PortD);
  18. CLOCK_EnableClock(kCLOCK_PortE);
  19. BOARD_InitBootClocks();
  20. BOARD_InitPins();
  21. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  22. /* set pend exception priority */
  23. NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
  24. #ifdef RT_USING_COMPONENTS_INIT
  25. /* initialization board with RT-Thread Components */
  26. rt_components_board_init();
  27. #endif
  28. #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
  29. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  30. #endif
  31. #ifdef RT_USING_HEAP
  32. rt_kprintf("sram heap, begin: %p, end: %p\n", HEAP_BEGIN, HEAP_END);
  33. rt_system_heap_init((void *)HEAP_BEGIN, (void *)(HEAP_END));
  34. #endif
  35. }
  36. /**
  37. * This is the timer interrupt service routine.
  38. *
  39. */
  40. void SysTick_Handler(void)
  41. {
  42. /* enter interrupt */
  43. rt_interrupt_enter();
  44. rt_tick_increase();
  45. /* leave interrupt */
  46. rt_interrupt_leave();
  47. }