File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1
1
all : mkdir out
2
2
3
- out : main.o shell_port.o shell.o shell_ext.o shell_cmd_list.o shell_companion.o shell_fs.o shell_cmd_group.o
3
+ out : main.o shell_port.o shell.o shell_ext.o shell_cmd_list.o shell_companion.o shell_fs.o shell_cmd_group.o shell_cpp.o
4
4
gcc -o build/out -T shell.lds build/main.o build/shell_port.o \
5
5
build/shell.o build/shell_ext.o build/shell_cmd_list.o \
6
- build/shell_companion.o build/shell_fs.o build/shell_cmd_group.o
6
+ build/shell_companion.o build/shell_fs.o build/shell_cmd_group.o \
7
+ build/shell_cpp.o
7
8
8
9
main.o : main.c shell_port.h
9
10
gcc -c main.c -I ./ -I ../../src -o build/main.o
@@ -29,6 +30,9 @@ shell_fs.o : ../../extensions/fs_support/shell_fs.c ../../extensions/fs_support/
29
30
shell_cmd_group.o : ../../extensions/shell_enhance/shell_cmd_group.c ../../extensions/shell_enhance/shell_cmd_group.h shell_cfg.h ../../src/shell.h
30
31
gcc -c ../../extensions/shell_enhance/shell_cmd_group.c -I ./ -I ../../src -I ../../extensions/shell_enhance -o build/shell_cmd_group.o
31
32
33
+ shell_cpp.o : shell_cpp.cpp ../../extensions/cpp_support/shell_cpp.h
34
+ g++ -c shell_cpp.cpp -I ./ -I ../../src -I ../../extensions/cpp_support -o build/shell_cpp.o
35
+
32
36
.PHONY : all clean mkdir
33
37
clean :
34
38
-rm -r build
Original file line number Diff line number Diff line change
1
+ /* *
2
+ * @file shell_cpp.cpp
3
+ * @author Letter
4
+ * @brief shell cpp support test
5
+ * @version 0.1
6
+ * @date 2021-01-17
7
+ *
8
+ * @copyright (c) 2021 Letter
9
+ *
10
+ */
11
+
12
+ #include < shell_cpp.h>
13
+
14
+ void cppTest (void )
15
+ {
16
+ Shell *shell = shellGetCurrent ();
17
+ shellPrint (shell, " hello world from cpp\r\n " );
18
+ }
19
+ SHELL_EXPORT_CMD (SHELL_CMD_PERMISSION(0 )|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC),
20
+ cppTest, cppTest, cpp test);
Original file line number Diff line number Diff line change
1
+ # cpp suport
2
+
3
+ ![ standard] ( https://img.shields.io/badge/standard-c99-brightgreen.svg )
4
+ ![ build] ( https://img.shields.io/badge/build-2021.01.17-brightgreen.svg )
5
+ ![ license] ( https://img.shields.io/badge/license-MIT-brightgreen.svg )
6
+
7
+ ` letter shell ` cpp支持
8
+
9
+ ## 简介
10
+
11
+ ` cpp support ` 是用于扩展` letter shell ` ,使其可以在cpp环境中生效的组件,` cpp support ` 仅仅包含一个头文件
12
+
13
+ ## 使用
14
+
15
+ ` cpp support ` 仅仅提供了一个` shell_cpp.h ` 的头文件,用于在cpp文件中使用` letter shell ` 的命令导出,在使用时,需要在` .cpp ` 文件中包含` shell_cpp.h ` ,而不是` shell.h ` ,如果一个工程同时包含` .c ` 和` .cpp ` 文件,只需要分别包含对应的头文件即可
16
+
17
+ 注意,对于cpp,` letter shell ` 也仅支持函数的导出,不适用于类的成员函数
You can’t perform that action at this time.
0 commit comments