This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
So running CCS v8.3.0.00009 with the following compilers installed:
I get the following error:
Function '__delay_cycles' could not be resolved
In projects being compiled with GNU v7.3.2.154.
I found this forum post (https://e2e.ti.com/support/tools/ccs/f/81/t/680225?tisearch=e2e-sitesearch&keymatch=__delay_cycles
but it left me confused, and I don't think it actually resolved any problems.
I have this minimal example that shows the problem on my projects:
#include <msp430f5529.h> int main () { P1DIR |= BIT0; P1OUT |= BIT0; while (1) { P1OUT ^= BIT0; __delay_cycles(1000000); // @suppress("Function cannot be resolved") } return 0; }
Note that this code does work, the delay DOES work, but without the comment with the '@suppress' compilation will error.
Edit: Formatting, and somehow a sentence got left out
JohnS said:Could you share the project that you see this with? I have not been able to reproduce an error. I am wondering if it is coming from a static code analysis checker not recognizing the intrinsic.
John
Sorry for the late reply, I've been very busy. I've attached a zip folder containing the minimal project example.7043.test.zip
If I import this project into CCS I do not see the error.
However if I go into the project properties. Select show advanced settings and change the static code analysis options to use project instead of workspace level settings I then see this:
Assuming this is what you are seeing then this means that you have enabled the static source code analysis tool and it is not recognizing __delay_cycles as it is an intrinsic.
Typically static code analysis is off by default. In my case I enabled it for the project, however for in your case it must be enabled at the workspace level.
If you go to the preferences dialog. Then click on show advanced settings at the bottom. Then navigate to here:
Uncheck the box for "Function cannot be resolved". Then click Apply and Close.
Regards,
John
It appears that I do not have the "C/C++" submenu in my preferences dialog.
I'm on Windows.
Is there some way to turn off static code analysis for my workspace? Not sure how it would have turned on if you said it's off by default. I would rather not turn off the error message in case I actually need it.
You need to click on "Show advanced settings" at the bottom left to get to the "C/C++" options.
"Is there some way to turn off static code analysis for my workspace? Not sure how it would have turned on if you said it's off by default. I would rather not turn off the error message in case I actually need it."
Please note that this has nothing to do with building. The errors and warnings generated by the compiler have nothing to do with the code analysis feature. Static code analysis is a feature that is part of Eclipse but it often has issues when it comes to embedded C and C++ code. There are commercial vendors that provide much better tools for that if it is something you are interested in.
Turning off code analysis will turn off that specific rule and all other rules. I would suggest just turning off that turn as it is giving false positives and leave the rest. The only way I have found to turn off analysis once it is enabled is to uncheck the rules.
Regards,
John