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

关于--keep shellCommand的问题 #11

Open
mojinpan opened this issue Mar 1, 2019 · 3 comments
Open

关于--keep shellCommand的问题 #11

mojinpan opened this issue Mar 1, 2019 · 3 comments

Comments

@mojinpan
Copy link

mojinpan commented Mar 1, 2019

大神,您好,请教一个问题:
在这个shell中建议用keil编译的时候加入--keep shellCommand的选项,我在keil5.26上测试,没有加这个选项,但依然能正常编译(代码优化从0~3都测试过),但给同事使用的时候就必须加上这个选项,请问在什么情况下会出现数据被优化掉?
另外在网上看到一篇文章(https://blog.csdn.net/sinat_33611142/article/details/52761220)说,将__arrtibute__((unused, secition("arm_cmd")))改为__arrtibute__((used, secition("arm_cmd"))),可以避免这个声明,不知道是否有效。

@NevermindZZT
Copy link
Owner

就我自己使用的情况来看,不加选项的话,在shell.c这个文件中定义的不会被优化掉,其他文件可能会被优化,具体keil是怎么判断优化的,我也不是很清楚

@mojinpan
Copy link
Author

mojinpan commented Mar 4, 2019

经测试将__attribute__(section(x)),改成__attribute__((used,section(x)))后,不需要在keil上添加编译选项

@lwFlyFish
Copy link

请问在哪里加这条语句?

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