main.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * 2022-12-08 WangShun first version
  9. */
  10. #include "rtthread.h"
  11. #include "hal_fc_event.h"
  12. #include <stdio.h>
  13. #include <stdint.h>
  14. #include "rtconfig.h"
  15. #include "udma_uart_driver.h"
  16. #include "stdlib.h"
  17. /*Note:Bsp shell switch flag,do not modify*/
  18. int irq_cli_flag = 1;
  19. /*If add CorevMCU_CLI package,please put the code in example.c here*/
  20. #define rtthread_task
  21. static struct rt_thread test1_thread;
  22. static rt_thread_t test2_thread = RT_NULL;
  23. rt_align(RT_ALIGN_SIZE)
  24. static rt_uint8_t rt_test1_thread_stack[1024];
  25. static void test1_thread_entry(void* parameter);
  26. static void test2_thread_entry(void* parameter);
  27. void test_init(void)
  28. {
  29. rt_kprintf("Hello RT-Thread!\r\n");
  30. }
  31. INIT_APP_EXPORT(test_init);
  32. int main(void)
  33. {
  34. #ifndef rtthread_task
  35. rt_thread_init(&test1_thread,
  36. "test1",
  37. test1_thread_entry,
  38. RT_NULL,
  39. &rt_test1_thread_stack[0],
  40. sizeof(rt_test1_thread_stack),
  41. 6,
  42. 20);
  43. rt_thread_startup(&test1_thread);
  44. test2_thread = rt_thread_create( "test2",
  45. test2_thread_entry,
  46. RT_NULL,
  47. 512,
  48. 5,
  49. 20);
  50. rt_thread_startup(test2_thread);
  51. #endif
  52. }
  53. static void test1_thread_entry(void* parameter)
  54. {
  55. while (1)
  56. {
  57. rt_kprintf("test1\r\n");
  58. rt_thread_delay(500);
  59. }
  60. }
  61. static void test2_thread_entry(void* parameter)
  62. {
  63. while (1)
  64. {
  65. rt_kprintf("test2\r\n");
  66. rt_thread_delay(500);
  67. }
  68. }