Sorting out asm(); in KDS: How to change your compiler language to GNU ISO90

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Sorting out asm(); in KDS: How to change your compiler language to GNU ISO90

3,397 次查看
raels-r
Contributor IV

Problems with asm(); calls in KDS coming back as "undefined reference"?

as the FAQ says: KDS Frequently Asked Questions (FAQ)
"By default the compiler settings are for C99, and there the 'asm' keyword is not recognized. Either change it to __asm (with two underscores) or change the compiler settings to use GNU ISO 90"

 

so you can either add '__' in front of  all asm() calls (a simple search and replace should do), or you can edit the compiler options. If you're using a framework, you might prefer the compiler options route, so here's how to do that:

 

1) Access the Project options by right clicking your project and selecting 'Properties'

2)Navigate through to "C/C++ Build>Settings>Tool Settings>Cross ARM C Compiler > Optimization > Langauge Standard"

13104_13104.pngCompilerLanguageSettings.png

3) Select "Tool Chain Default (GNU ISO C90)" from the drop down menu

 

4) Your project should now build fine and "undefined reference: asm" should be a thing of the past!

 

Hope this is helpful for anyone like me who had asm issues and didn't know how to change these settings

 

If anyone knows how to set this as the default for all new KDS projects, please let me know!

标签 (1)
0 项奖励
回复
1 回复

1,367 次查看
radiptacandra
Contributor I

I am facing this problem and just try your method, but it still not recognize the asm function. any other solution?

0 项奖励
回复