board.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. * 2021-08-25 AisinoChip first implementation
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include "rtconfig.h"
  13. #include "board.h"
  14. #include <rtdevice.h>
  15. #define SOC_SRAM_END_ADDR (SOC_SRAM_START_ADDR+SOC_SRAM_SIZE*1024)
  16. extern int rt_application_init(void);
  17. #if defined(__CC_ARM) || defined(__CLANG_ARM)
  18. extern int Image$$RW_IRAM1$$ZI$$Limit;
  19. #elif __ICCARM__
  20. #pragma section="HEAP"
  21. #else
  22. extern int __bss_end;
  23. #endif
  24. extern void rt_hw_uart_init(void);
  25. /**
  26. * This is the timer interrupt service routine.
  27. *
  28. */
  29. void SysTick_Handler(void)
  30. {
  31. /* enter interrupt */
  32. rt_interrupt_enter();
  33. rt_tick_increase();
  34. /* leave interrupt */
  35. rt_interrupt_leave();
  36. }
  37. /**
  38. * This function will initial EVB board.
  39. */
  40. void rt_hw_board_init(void)
  41. {
  42. /* system init, clock, NVIC */
  43. System_Init();
  44. /* Configure the SysTick */
  45. SysTick_Config(System_Get_SystemClock() / RT_TICK_PER_SECOND);
  46. rt_hw_uart_init();
  47. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  48. #ifdef RT_USING_HEAP
  49. #if defined(__CC_ARM) || defined(__CLANG_ARM)
  50. rt_system_heap_init((void *)&Image$$RW_IRAM1$$ZI$$Limit, (void *)SOC_SRAM_END_ADDR);
  51. #elif __ICCARM__
  52. rt_system_heap_init(__segment_end("HEAP"), (void *)SOC_SRAM_END_ADDR);
  53. #else
  54. /* init memory system */
  55. rt_system_heap_init((void *)&__bss_end, (void *)SOC_SRAM_END_ADDR);
  56. #endif
  57. #endif /* RT_USING_HEAP */
  58. #ifdef RT_USING_COMPONENTS_INIT
  59. rt_components_board_init();
  60. #endif
  61. }