board.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-04-22 hqfang first version
  9. *
  10. */
  11. #include <rtthread.h>
  12. #include <rtdevice.h>
  13. #include "board.h"
  14. #include "cpuport.h"
  15. #ifdef RT_USING_SERIAL
  16. #include <drv_uart.h>
  17. #endif
  18. /** _end symbol defined in linker script of Nuclei SDK */
  19. extern void *_end;
  20. /** _heap_end symbol defined in linker script of Nuclei SDK */
  21. extern void *_heap_end;
  22. #define HEAP_BEGIN &_end
  23. #define HEAP_END &_heap_end
  24. /*
  25. * - Implemented and defined in Nuclei SDK system_<Device>.c file
  26. * - Required macro NUCLEI_BANNER set to 0
  27. */
  28. extern void _init(void);
  29. /**
  30. * @brief Setup hardware board for rt-thread
  31. *
  32. */
  33. void rt_hw_board_init(void)
  34. {
  35. /* OS Tick Configuration */
  36. rt_hw_ticksetup();
  37. #ifdef RT_USING_HEAP
  38. rt_system_heap_init((void *) HEAP_BEGIN, (void *) HEAP_END);
  39. #endif
  40. _init(); // __libc_init_array is not used in RT-Thread
  41. /* UART driver initialization is open by default */
  42. #ifdef RT_USING_SERIAL
  43. rt_hw_uart_init();
  44. #endif
  45. /* Set the shell console output device */
  46. #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
  47. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  48. #endif
  49. /* Board underlying hardware initialization */
  50. #ifdef RT_USING_COMPONENTS_INIT
  51. rt_components_board_init();
  52. #endif
  53. }
  54. /******************** end of file *******************/