rust_cmd.c 837 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2006-2025, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2025-09-20 foxglove First version
  9. * 2025-10-10 foxglove Clear Rust component MSH command registration
  10. *
  11. * Description: Rust component MSH command registration
  12. * Provides access interface to Rust modular APIs
  13. */
  14. #include <rtthread.h>
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <rtdbg.h>
  18. extern int rust_init(void);
  19. /* ============== Rust function declarations ============== */
  20. /* Component initialization */
  21. static int rust_component_init(void)
  22. {
  23. int ret = rust_init();
  24. if (ret == 0)
  25. {
  26. printf("Hello RT-Thread Rust!\n");
  27. }
  28. return ret;
  29. }
  30. #ifdef RUST_INIT_COMPONENT
  31. INIT_APP_EXPORT(rust_component_init);
  32. #endif