Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于定义在shell.c文件外的命令不识别的问题 #1

Open
elecfunwb opened this issue Aug 26, 2018 · 3 comments
Open

关于定义在shell.c文件外的命令不识别的问题 #1

elecfunwb opened this issue Aug 26, 2018 · 3 comments

Comments

@elecfunwb
Copy link

Hi NevermindZZT,
我使用的是1.8的版本,为了使文件结构看起来更舒服,我把新增加的命令从shell.c文件移到了单独的一个.c文件,但发现使用help命令无法识别这些命令,直接执行也提示找不到命令。
由于我没能理解SHELL_EXPORT_CMD命令是怎么运作的,不知道如何修改,还请帮忙指导,多谢!

@NevermindZZT
Copy link
Owner

在keil的options for target的linker选项卡的misc control中,增加--keep shellCommand*,再编译就行了

@huangjingdaisy
Copy link

我也遇到了这个情况,我使用的是gcc编译,也在链接脚本添加了对应的段,只有定义在shell.c的文件才能识别,不知道什么原因

@NevermindZZT
Copy link
Owner

我也遇到了这个情况,我使用的是gcc编译,也在链接脚本添加了对应的段,只有定义在shell.c的文件才能识别,不知道什么原因

具体是什么平台,目前发现再 esp-idf 中有这个问题,情况是编译系统会将每个模块单独编译成一个 so,最后去做链接,然后会导致没有显式引用的变量定义被编译器优化掉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants