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

Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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"


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!

Labels (1)
0 Kudos
1 Reply

Contributor I

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

0 Kudos