Static code analyze tools for NRF Connect SDK

Hello,

I'm doing reasearch in static code analyze tools for my projects. At link below I saw that since version ncs 2.1.0 there is possible to use "Sparse" tool to static code analyze but some configs are required... I can't find what kind of configs...

 nrf Connect 1.6.1 SDK : Static Code Analysis 

 I also saw this:

https://docs.zephyrproject.org/3.1.0/develop/test/sparse.html

I've tried to build some example with "-- -DSPARSE=y".

west build -p always -b nrf52dk_nrf52832 samples/basic/blinky -- -DSPARSE=y

As a result I've got...

es2@es2-hpprobook450g1:~/ncs/zephyr$ west build -p always -b nrf52dk_nrf52832 samples/basic/blinky -- -DSPARSE=y
-- west build: making build dir /home/es2/ncs/zephyr/build pristine
-- west build: generating a build system                                                                                                                                                      
Loading Zephyr default modules (Zephyr base).                                                                                                                                                 
-- Application: /home/es2/ncs/zephyr/samples/basic/blinky
-- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.6") found components: Interpreter
-- Cache files will be written to: /home/es2/.cache//zephyr
-- Zephyr version: 3.1.99 (/home/es2/ncs/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf52dk_nrf52832
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.14.1 (/home/es2/zephyr-sdk-0.14.1)
-- Found dtc: /home/es2/zephyr-sdk-0.14.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.1 (/home/es2/zephyr-sdk-0.14.1)
-- Found BOARD.dts: /home/es2/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
-- Generated zephyr.dts: /home/es2/ncs/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/es2/ncs/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/es2/ncs/zephyr/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /home/es2/ncs/zephyr/build/zephyr/dts.cmake
Parsing /home/es2/ncs/zephyr/Kconfig
Loaded configuration '/home/es2/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
Merged configuration '/home/es2/ncs/zephyr/samples/basic/blinky/prj.conf'
Configuration saved to '/home/es2/ncs/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/es2/ncs/zephyr/build/zephyr/include/generated/autoconf.h'
CMake Error at /home/es2/ncs/zephyr/cmake/compiler/gcc/target.cmake:17 (message):
  C compiler                                                                                                                                                                                  
  /home/es2/zephyr-sdk-0.14.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc not                                                                                                                     
  found - Please check your toolchain installation                                                                                                                                            
Call Stack (most recent call first):                                                                                                                                                          
  /home/es2/ncs/zephyr/cmake/modules/target_toolchain.cmake:63 (include)                                                                                                                      
  /home/es2/ncs/zephyr/cmake/modules/zephyr_default.cmake:121 (include)                                                                                                                       
  /home/es2/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)                                                                                                             
  /home/es2/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)                                                                                                 
  CMakeLists.txt:4 (find_package)                                                                                                                                                             


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/es2/ncs/zephyr/build -GNinja -DBOARD=nrf52dk_nrf52832 -DSPARSE=y -S/home/es2/ncs/zephyr/samples/basic/blinky

If this is still in progress or something, what kind of tool You recommend for static code analyzing...?

Best regards,

Kamil

Parents Reply Children
  • I tried to reinstall all on other user and situation is exactly the same...

    krakku@es2-hpprobook450g1:~/ncs/zephyr$ west build -p always -b nrf52dk_nrf52832 samples/basic/blinky -- -DSPARSE=y
    -- west build: making build dir /home/krakku/ncs/zephyr/build pristine
    -- west build: generating a build system                                                                                                                                 
    Loading Zephyr default modules (Zephyr base).                                                                                                                            
    -- Application: /home/krakku/ncs/zephyr/samples/basic/blinky
    -- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.6") found components: Interpreter 
    -- Cache files will be written to: /home/krakku/.cache//zephyr
    -- Zephyr version: 3.1.99 (/home/krakku/ncs/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52dk_nrf52832
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.14.1 (/home/krakku/ncs/toolchain/zephyr-sdk-0.14.1)
    -- Found dtc: /home/krakku/ncs/toolchain/zephyr-sdk-0.14.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found toolchain: zephyr 0.14.1 (/home/krakku/ncs/toolchain/zephyr-sdk-0.14.1)
    -- Found BOARD.dts: /home/krakku/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
    -- Generated zephyr.dts: /home/krakku/ncs/zephyr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/krakku/ncs/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/krakku/ncs/zephyr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/krakku/ncs/zephyr/build/zephyr/dts.cmake
    Parsing /home/krakku/ncs/zephyr/Kconfig
    Loaded configuration '/home/krakku/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
    Merged configuration '/home/krakku/ncs/zephyr/samples/basic/blinky/prj.conf'
    Configuration saved to '/home/krakku/ncs/zephyr/build/zephyr/.config'
    Kconfig header saved to '/home/krakku/ncs/zephyr/build/zephyr/include/generated/autoconf.h'
    CMake Error at /home/krakku/ncs/zephyr/cmake/compiler/gcc/target.cmake:17 (message):
      C compiler                                                                                                                                                             
      /home/krakku/ncs/toolchain/zephyr-sdk-0.14.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc                                                                                   
      not found - Please check your toolchain installation                                                                                                                   
    Call Stack (most recent call first):                                                                                                                                     
      /home/krakku/ncs/zephyr/cmake/modules/target_toolchain.cmake:63 (include)                                                                                              
      /home/krakku/ncs/zephyr/cmake/modules/zephyr_default.cmake:121 (include)                                                                                               
      /home/krakku/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)                                                                                     
      /home/krakku/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)                                                                         
      CMakeLists.txt:4 (find_package)                                                                                                                                        
                                                                                                                                                                             
                                                                                                                                                                             
    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/krakku/ncs/zephyr/build -GNinja -DBOARD=nrf52dk_nrf52832 -DSPARSE=y -S/home/krakku/ncs/zephyr/samples/basic/blinky

    Below contents of the folder of interest

    krakku@es2-hpprobook450g1:~/ncs/zephyr$ cd /home/krakku/ncs/toolchain/zephyr-sdk-0.14.1/arm-zephyr-eabi/bin/                                                             
    krakku@es2-hpprobook450g1:~/ncs/toolchain/zephyr-sdk-0.14.1/arm-zephyr-eabi/bin$ ls -l
    total 67688
    -rwxr-xr-x 1 krakku krakku  1023184 kwi 11  2022 arm-zephyr-eabi-addr2line
    -rwxr-xr-x 2 krakku krakku  1051608 kwi 11  2022 arm-zephyr-eabi-ar
    -rwxr-xr-x 2 krakku krakku  2035264 kwi 11  2022 arm-zephyr-eabi-as
    -rwxr-xr-x 2 krakku krakku  1297216 kwi 11  2022 arm-zephyr-eabi-c++
    lrwxrwxrwx 1 krakku krakku       19 kwi 11  2022 arm-zephyr-eabi-cc -> arm-zephyr-eabi-gcc
    -rwxr-xr-x 1 krakku krakku  1018576 kwi 11  2022 arm-zephyr-eabi-c++filt
    -rwxr-xr-x 1 krakku krakku  1293120 kwi 11  2022 arm-zephyr-eabi-cpp
    -rwxr-xr-x 1 krakku krakku     5439 kwi 11  2022 arm-zephyr-eabi-ct-ng.config
    -rwxr-xr-x 1 krakku krakku    35288 kwi 11  2022 arm-zephyr-eabi-elfedit
    -rwxr-xr-x 2 krakku krakku  1297216 kwi 11  2022 arm-zephyr-eabi-g++
    -rwxr-xr-x 2 krakku krakku  1293120 kwi 11  2022 arm-zephyr-eabi-gcc
    -rwxr-xr-x 2 krakku krakku  1293120 kwi 11  2022 arm-zephyr-eabi-gcc-10.3.0
    -rwxr-xr-x 1 krakku krakku    31208 kwi 11  2022 arm-zephyr-eabi-gcc-ar
    -rwxr-xr-x 1 krakku krakku    31208 kwi 11  2022 arm-zephyr-eabi-gcc-nm
    -rwxr-xr-x 1 krakku krakku    31208 kwi 11  2022 arm-zephyr-eabi-gcc-ranlib
    -rwxr-xr-x 1 krakku krakku   741408 kwi 11  2022 arm-zephyr-eabi-gcov
    -rwxr-xr-x 1 krakku krakku   536504 kwi 11  2022 arm-zephyr-eabi-gcov-dump
    -rwxr-xr-x 1 krakku krakku   557048 kwi 11  2022 arm-zephyr-eabi-gcov-tool
    -rwxr-xr-x 1 krakku krakku  8203952 kwi 11  2022 arm-zephyr-eabi-gdb
    -rwxr-xr-x 1 krakku krakku     4045 kwi 11  2022 arm-zephyr-eabi-gdb-add-index
    -rwxr-xr-x 1 krakku krakku     4045 kwi 11  2022 arm-zephyr-eabi-gdb-add-index-no-py
    -rwxr-xr-x 1 krakku krakku  7781040 kwi 11  2022 arm-zephyr-eabi-gdb-no-py
    -rwxr-xr-x 1 krakku krakku  1076608 kwi 11  2022 arm-zephyr-eabi-gprof
    -rwxr-xr-x 1 krakku krakku  1076608 kwi 11  2022 arm-zephyr-eabi-gprof-no-py
    -rwxr-xr-x 4 krakku krakku  1605408 kwi 11  2022 arm-zephyr-eabi-ld
    -rwxr-xr-x 4 krakku krakku  1605408 kwi 11  2022 arm-zephyr-eabi-ld.bfd
    -rwxr-xr-x 1 krakku krakku 25375440 kwi 11  2022 arm-zephyr-eabi-lto-dump
    -rwxr-xr-x 2 krakku krakku  1036144 kwi 11  2022 arm-zephyr-eabi-nm
    -rwxr-xr-x 2 krakku krakku  1162160 kwi 11  2022 arm-zephyr-eabi-objcopy
    -rwxr-xr-x 2 krakku krakku  1721648 kwi 11  2022 arm-zephyr-eabi-objdump
    -rwxr-xr-x 2 krakku krakku  1051640 kwi 11  2022 arm-zephyr-eabi-ranlib
    -rwxr-xr-x 2 krakku krakku   789336 kwi 11  2022 arm-zephyr-eabi-readelf
    -rwxr-xr-x 1 krakku krakku  1022960 kwi 11  2022 arm-zephyr-eabi-size
    -rwxr-xr-x 1 krakku krakku  1023056 kwi 11  2022 arm-zephyr-eabi-strings
    -rwxr-xr-x 2 krakku krakku  1162160 kwi 11  2022 arm-zephyr-eabi-strip

Related