Rael Sasiak-Rushby

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

Discussion created by Rael Sasiak-Rushby on Jul 4, 2014
Latest reply on Nov 9, 2017 by radipta candra

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"

CompilerLanguageSettings.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!

Outcomes