Skip to main content
January 29, 2024
Solved

A problem with '-fcyclomatic-complexity'

  • January 29, 2024
  • 2 replies
  • 6025 views

I'm using kali linux and the latest version of arm gcc available on arm website and the latest CubeIDE. When I first set everything up everything was working fine, but then I created an empty project for another MCU(STM32 G030F6P6) and got the following issue:

"arm-none-eabi-gcc: error: unrecognized command-line option '-fcyclomatic-complexity"

I've looked almost all available info up, I tried to turn off this flag in properties, but that didn't help at all.

Moreover, this log comes outta HAL dependencies

([Drivers/STM32G0xx_HAL_Driver/Src/subdir.mk:31: Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_gpio.o] Error 1)

but the thing is tho, I'm using LL, not HAL, so I'm completely confused why'd I get this.

Also, after I got this, i can't even run the previous projects that worked fine...

I've been searching information about this plugin or whatever that thing is for 2-3 hours, and i couldn't find even what this is, not saying about any ways of fixing this issue.

 

P.S: I tried re-installing CubeIDE, didn't help at all.

Thanks.

    Best answer by

    UPD: After a break I've decided to read the traceback properly. Turns out I only turned off fcyclomatic-complexity only for main.c, not for the whole project.

    The problem is solved.

    (for anyone else like me, you need to click on the project name and only then go to File, Properties, C/C++ build, Miscellaneous)

    2 replies

    Best answer
    January 29, 2024

    UPD: After a break I've decided to read the traceback properly. Turns out I only turned off fcyclomatic-complexity only for main.c, not for the whole project.

    The problem is solved.

    (for anyone else like me, you need to click on the project name and only then go to File, Properties, C/C++ build, Miscellaneous)

    Visitor II
    November 24, 2024

    Hi rambo,

    I got the same problem. Is there a setting within the STM32CubeIDE with which I can set the fcyclomatic complexity for the whole project or to disable it?

    Best regards, Leon

    AMacd.1
    Senior
    May 28, 2025

    Nevermind, I think I've been able to answer my own question.  The question LeonBoe asked is pretty simple in Cube 1.18.0.  In the project explorer, right-click on top level project icon and click Properties (way down the bottom of the context menu) and expand C/C++ Build and click Settings.  Then under the tool settings tab, expand MCU/MPU GCC Compiler, click Miscellaneous and the "Cyclomatic Complexity" option should appear.  Since I started with the overall project instead of one of the component files, the setting applies to the entire project.

    As far as the compiler is concerned, the location of the compiler appears in another place in the settings:  In the Environment properties for C/C++ Build, the path to the custom version of arm-none-eabi-gcc appears there.  I should be able to set the path at the command line when invoking the makefile and the option should be accepted by the version of compiler contained in the path.

     

    AScha.3
    Super User
    May 28, 2025

    > Is there an advantage to having "cyclomatic complexity" turned on?

    If you want to see it: yes.   If not: no.

    Just maybe you should read about it...then you know, need or not want it.

    -> https://www.ibm.com/docs/en/raa/6.1.0?topic=metrics-cyclomatic-complexity

     

    +

    >What about the version of arm-none-eabi-gcc?

    Set it in IDE...if you know,what you do. Otherwise leave the installed version.

    You can adjust a lot in : menu: -> project -> properties... settings..

    AScha3_0-1748463583078.png

    Read the manual, see tutorial + videos....

     

    "If you feel a post has answered your question, please click ""Accept as Solution""."