board.c 1.5 KB

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