application.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. * 2011-05-24 Bernard the first version
  9. */
  10. /**
  11. * @addtogroup FM3
  12. */
  13. /*@{*/
  14. #include <rtthread.h>
  15. #include "board.h"
  16. #include "led.h"
  17. #ifdef RT_USING_DFS
  18. /* dfs init */
  19. #include <dfs.h>
  20. /* dfs filesystem:ELM filesystem init */
  21. #include <dfs_elm.h>
  22. /* dfs Filesystem APIs */
  23. #include <dfs_fs.h>
  24. #endif
  25. void rt_init_thread_entry(void *parameter)
  26. {
  27. /* LED Initialization */
  28. rt_hw_led_init();
  29. #ifdef RT_USING_COMPONENTS_INIT
  30. /* initialization RT-Thread Components */
  31. rt_components_init();
  32. #endif
  33. /* Filesystem Initialization */
  34. #ifdef RT_USING_DFS
  35. /* mount nand fat partition 1 as root directory */
  36. if (dfs_mount("nand", "/", "elm", 0, 0) == 0)
  37. rt_kprintf("File System initialized!\n");
  38. else
  39. rt_kprintf("File System init failed!\n");
  40. #endif
  41. }
  42. int rt_application_init(void)
  43. {
  44. rt_thread_t tid;
  45. tid = rt_thread_create("init",
  46. rt_init_thread_entry, RT_NULL,
  47. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  48. if (tid != RT_NULL)
  49. rt_thread_startup(tid);
  50. return 0;
  51. }
  52. /*@}*/