board.c 1.5 KB

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