summaryrefslogtreecommitdiff
path: root/components/rust/core/rust_cmd.c
diff options
context:
space:
mode:
authorzhang san <[email protected]>2025-12-08 18:34:25 +0800
committerGitHub <[email protected]>2025-12-08 18:34:25 +0800
commit69980f8b9d29b38dbd4ddf6373b4b45f3a138409 (patch)
tree21dd9a8ce80e3d30192e9ffa56ea39a199bae309 /components/rust/core/rust_cmd.c
parentcd1d47b87c5d47e131730e5506eb3ad77d357653 (diff)
Adding Rust Language Support for RT-Thread #10910
Diffstat (limited to 'components/rust/core/rust_cmd.c')
-rw-r--r--components/rust/core/rust_cmd.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/components/rust/core/rust_cmd.c b/components/rust/core/rust_cmd.c
new file mode 100644
index 0000000000..5bc37748fc
--- /dev/null
+++ b/components/rust/core/rust_cmd.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006-2025, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2025-09-20 foxglove First version
+ * 2025-10-10 foxglove Clear Rust component MSH command registration
+ *
+ * Description: Rust component MSH command registration
+ * Provides access interface to Rust modular APIs
+ */
+
+#include <rtthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <rtdbg.h>
+
+extern int rust_init(void);
+/* ============== Rust function declarations ============== */
+
+/* Component initialization */
+static int rust_component_init(void)
+{
+ int ret = rust_init();
+ if (ret == 0)
+ {
+ printf("Hello RT-Thread Rust!\n");
+ }
+ return ret;
+}
+#ifdef RUST_INIT_COMPONENT
+INIT_APP_EXPORT(rust_component_init);
+#endif