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.

CODECOMPOSER: Illegal state exception when running CDT Codan with CCS project

Part Number: CODECOMPOSER
Other Parts Discussed in Thread: CCSTUDIO

I'm working on setting up the code analyzer (CDT Codan) on a CCS project, which works as expected within the CCS GUI. However, I encounter the following errors when attempting to run Codan from the command line:

${CCS_INSTALL_DIR}/ccs/eclipse/eclipse -noSplash -data ${CCS_WORKSPACE_DIR} -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import ${CI_PROJECT_DIR}

Create.

Opening 'H60-MCU-POC'.

$ ${CCS_INSTALL_DIR}/ccs/eclipse/eclipse -noSplash -data ${CCS_WORKSPACE_DIR} -application org.eclipse.cdt.codan.core.application H60-MCU-POC -consoleLog

!SESSION 2022-03-14 19:22:26.214 -----------------------------------------------

eclipse.buildId=4.19.0.I20210303-1800

java.version=11.0.13

java.vendor=Eclipse Adoptium

BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US

Framework arguments: -application org.eclipse.cdt.codan.core.application H60-MCU-POC

Command-line arguments: -os linux -ws gtk -arch x86_64 -data /ti/ccs/workspace -application org.eclipse.cdt.codan.core.application H60-MCU-POC -consoleLog

!ENTRY com.ti.common.core 1 0 2022-03-14 19:22:27.399

!MESSAGE path=ccs_base/DebugServer

!ENTRY com.ti.common.core 1 0 2022-03-14 19:22:27.401

!MESSAGE debugServerDir=/ti/ccs/ccs_base/DebugServer

!ENTRY org.eclipse.core.jobs 4 2 2022-03-14 19:22:30.017

!MESSAGE An internal error occurred during: "Extracting executable file checksum".

!STACK 0

java.lang.IllegalStateException: Workbench has not been created yet.

at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:102)

at com.ti.ccstudio.project.ui.internal.navigator.CRCLabelDecorator$1.run(CRCLabelDecorator.java:146)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.core.jobs 4 2 2022-03-14 19:22:30.336

!MESSAGE An internal error occurred during: "Refreshing built-in compiler settings".

!STACK 0

java.lang.NullPointerException

at com.ti.ccstudio.project.core.internal.ProjectCorePlugin.log(ProjectCorePlugin.java:270)

at com.ti.ccstudio.project.core.internal.build.CCSLanguageSettingsProvider$CompilerSettings.loadCoreSymbols(CCSLanguageSettingsProvider.java:710)

at com.ti.ccstudio.project.core.internal.build.CCSLanguageSettingsProvider$CompilerSettings.updateSymbols(CCSLanguageSettingsProvider.java:557)

at com.ti.ccstudio.project.core.internal.build.CCSLanguageSettingsProvider$CompilerSettings.update(CCSLanguageSettingsProvider.java:413)

at com.ti.ccstudio.project.core.internal.build.CCSLanguageSettingsProvider$CompilerSettings$UpdateJob.runInWorkspace(CCSLanguageSettingsProvider.java:346)

at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.core.resources 2 10035 2022-03-14 19:22:30.361

!MESSAGE The workspace will exit with unsaved changes in this session.

This occurs both on a Linux machine (from which the log above is taken) and on a separate machine running Windows 11. I'm able to compile the project on both machines using either the GUI or command line without issues, so I know that CCS is installed correctly.

This appears to be an issue that exists in the grey area between CCS and Eclipse, as I realise that there is no CCS-specific headless command to run the CDT Codan tool. To get around this, I'm attempting to first import the CCS project as a regular Eclipse project before running the Codan application, but nonetheless the errors I am encountering are related to com.ti.ccstudio.project.core.internal.

Any help would be appreciated!

  • Hello,

    What processor are you programming with CCS?

    Regards,

    Nick

  • Hi Nick,

    I'm programming a TM320F28379D.

  • Hello Felix,

    I am sending your thread over to the C2000 team. Please ping the thread if you do not get a response within a day or so.

    Regards,

    Nick

  • Hello Felix

    This appears to be an issue that exists in the grey area between CCS and Eclipse, as I realise that there is no CCS-specific headless command to run the CDT Codan tool. To get around this, I'm attempting to first import the CCS project as a regular Eclipse project before running the Codan application, but nonetheless the errors I am encountering are related to com.ti.ccstudio.project.core.internal.

    This is indeed a bit of a grey area. This type of usage is not something that we have tested with. To be honest, Codan is something that we tend not to encourage (I believe we turn it off by default) due to the numerous false positives it generates with many of our example projects. Hence I'm not sure how much support we can provide for this.

    Have you tried running the headless command using a stock Eclipse/CDT installation? 

    Thanks

    ki

  • Hi Ki,

    I tried running the commands using stock Eclipse just now, with mixed success. It does eventually run Codan this way, but Codan seems to ignore the configuration file in my project (i.e. it runs checks I turned off and doesn't respect the directories I set up to be ignored). Predictably there are still lots of exceptions in the console log where it doesn't know what to do with all the CCS-specific features.

    I was hoping that Codan would be a quick way to implement a minimal set of code checks, but I think this is a sign for me to look at some independent 3rd-party static analysis tools instead (which would have been required later anyway). Sweat smile

    Thanks for the insight and fast response, I appreciate it!

    Felix

  • I was hoping that Codan would be a quick way to implement a minimal set of code checks, but I think this is a sign for me to look at some independent 3rd-party static analysis tools instead (which would have been required later anyway).

    To be honest, I have had mixed results with Codan. There are several outstanding issues and support for Codan itself from the Eclipse/CDT community seems to have gone down in recent years. Hence I think it is best to look for a 3rd party solution. 

    Parasoft is one such 3rd party:

    https://dev.ti.com/tirex/explore/node?node=APLF-8O8vzUtFUfEGij.8Q__FUz-xrs__LATEST

    LDRA and Vectorcast are others which also have a good reputation.

    Good luck

    ki

  • Thanks for this!