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
  •   , please "cherry-pick" the commit linked to below as it was not included in SDK 2.1.0. This should fix the "toolchain not found" error you encountered. 

    https://github.com/nrfconnect/sdk-zephyr/commit/3ebb18b882634be29955a52ea70cd59f634492c1 

      , I was not able to reproduce this here. Below is from my terminal when I tried to build the blinky sample with sparse. Could you try to repeat these steps on your end to see if you get the same result? Notice I had to make a symlink for cgcc as cgcc is not included in the ARM toolchain.

    user@user-OptiPlex-7070:~/ncs/v2.2.0/zephyr/samples/basic/blinky$ ln -s /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/cgcc
    user@user-OptiPlex-7070:~/ncs/v2.2.0/zephyr/samples/basic/blinky$ ls -la /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/cgcc
    lrwxrwxrwx 1 user user 90 des.  14 14:02 /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/cgcc -> /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    user@user-OptiPlex-7070:~/ncs/v2.2.0/zephyr/samples/basic/blinky$ export $REAL_CC=/home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    bash: export: `=/home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc': not a valid identifier
    user@user-OptiPlex-7070:~/ncs/v2.2.0/zephyr/samples/basic/blinky$ export REAL_CC=/home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    user@user-OptiPlex-7070:~/ncs/v2.2.0/zephyr/samples/basic/blinky$ west build -b nrf52dk_nrf52832 -p -- -DSPARSE=y
    -- west build: making build dir /home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build pristine
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /home/user/ncs/v2.2.0/zephyr/samples/basic/blinky
    -- Using NCS Toolchain 2.2.0 for building. (/home/user/ncs/toolchains/v2.2.0/cmake)
    -- Found Python3: /home/user/ncs/toolchains/v2.2.0/usr/local/bin/python3 (found suitable exact version "3.8.2") found components: Interpreter 
    -- Cache files will be written to: /home/user/.cache/zephyr
    -- Zephyr version: 3.2.99 (/home/user/ncs/v2.2.0/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52dk_nrf52832
    -- Found host-tools: zephyr 0.15.1 (/home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.1 (/home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk)
    -- Found Dtc: /home/user/ncs/toolchains/v2.2.0/usr/local/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: /home/user/ncs/v2.2.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
    -- Generated zephyr.dts: /home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build/zephyr/dts.cmake
    Parsing /home/user/ncs/v2.2.0/zephyr/Kconfig
    Loaded configuration '/home/user/ncs/v2.2.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
    Merged configuration '/home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/prj.conf'
    Configuration saved to '/home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build/zephyr/.config'
    Kconfig header saved to '/home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build/zephyr/include/generated/autoconf.h'
    -- Found sparse: /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/cgcc
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/user/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/cgcc
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/user/ncs/v2.2.0/zephyr/samples/basic/blinky/build
    -- west build: building application
    [1/166] Preparing syscall dependency handling
    
    [2/166] Generating include/generated/version.h
    -- Zephyr version: 3.2.99 (/home/user/ncs/v2.2.0/zephyr), build: v3.2.99-ncs1
    [21/166] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
    /home/user/ncs/v2.2.0/zephyr/lib/os/printk.c: In function 'vsnprintk':
    /home/user/ncs/v2.2.0/zephyr/lib/os/printk.c:255:19: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
      255 |         cbvprintf(str_out, &ctx, fmt, ap);
          |                   ^~~~~~~
          |                   |
          |                   int (*)(int,  struct str_context *)
    In file included from ../../../../include/zephyr/logging/log_msg.h:11,
                     from ../../../../include/zephyr/logging/log_core.h:9,
                     from ../../../../include/zephyr/logging/log.h:11,
                     from /home/user/ncs/v2.2.0/zephyr/lib/os/printk.c:21:
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  struct str_context *)'
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    [99/166] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdout/sprintf.c.obj
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c: In function 'snprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c:45:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       45 |         r = cbvprintf(sprintf_out, (void *) (&p), format, vargs);
          |                       ^~~~~~~~~~~
          |                       |
          |                       int (*)(int,  struct emitter *)
    In file included from /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c:11:
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  struct emitter *)'
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c: In function 'sprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c:63:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       63 |         r = cbvprintf(sprintf_out, (void *) (&p), format, vargs);
          |                       ^~~~~~~~~~~
          |                       |
          |                       int (*)(int,  struct emitter *)
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  struct emitter *)'
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c: In function 'vsnprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c:84:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       84 |         r = cbvprintf(sprintf_out, (void *) (&p), format, vargs);
          |                       ^~~~~~~~~~~
          |                       |
          |                       int (*)(int,  struct emitter *)
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  struct emitter *)'
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c: In function 'vsprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/sprintf.c:99:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       99 |         r = cbvprintf(sprintf_out, (void *) (&p), format, vargs);
          |                       ^~~~~~~~~~~
          |                       |
          |                       int (*)(int,  struct emitter *)
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  struct emitter *)'
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    [101/166] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdout/fprintf.c.obj
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c: In function 'fprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c:21:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       21 |         r = cbvprintf(fputc, DESC(stream), format, vargs);
          |                       ^~~~~
          |                       |
          |                       int (*)(int,  FILE *) {aka int (*)(int,  int *)}
    In file included from /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c:11:
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  FILE *)' {aka 'int (*)(int,  int *)'}
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c: In function 'vfprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c:32:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       32 |         r = cbvprintf(fputc, DESC(stream), format, vargs);
          |                       ^~~~~
          |                       |
          |                       int (*)(int,  FILE *) {aka int (*)(int,  int *)}
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  FILE *)' {aka 'int (*)(int,  int *)'}
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c: In function 'printf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c:43:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       43 |         r = cbvprintf(fputc, DESC(stdout), format, vargs);
          |                       ^~~~~
          |                       |
          |                       int (*)(int,  FILE *) {aka int (*)(int,  int *)}
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  FILE *)' {aka 'int (*)(int,  int *)'}
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c: In function 'vprintf':
    /home/user/ncs/v2.2.0/zephyr/lib/libc/minimal/source/stdout/fprintf.c:53:23: warning: passing argument 1 of 'cbvprintf' from incompatible pointer type [-Wincompatible-pointer-types]
       53 |         r = cbvprintf(fputc, DESC(stdout), format, vargs);
          |                       ^~~~~
          |                       |
          |                       int (*)(int,  FILE *) {aka int (*)(int,  int *)}
    ../../../../include/zephyr/sys/cbprintf.h:715:27: note: expected 'cbprintf_cb' {aka 'int (*)(int,  void *)'} but argument is of type 'int (*)(int,  FILE *)' {aka 'int (*)(int,  int *)'}
      715 | int cbvprintf(cbprintf_cb out, void *ctx, const char *format, va_list ap)
          |               ~~~~~~~~~~~~^~~
    [156/166] Linking C executable zephyr/zephyr_pre0.elf
    
    [160/166] Linking C executable zephyr/zephyr_pre1.elf
    
    [166/166] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       19390 B       512 KB      3.70%
                 RAM:        5504 B        64 KB      8.40%
            IDT_LIST:          0 GB         2 KB      0.00%

  • It works now on my end, my system had some unrelated issues.

    Sparse works with ncs v2.2.0 out of the box, no need to cherry-pick the specified commit.

  • Thanks for confirming that it worked. But when you say it worked out of the box, do you mean that you did not have to make a symlink for cgcc either? 

  • This was the only command that I've had to run (no symlink):

    export REAL_CC=/home/aleksa/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc



    A bit off-topic:
    I use manual installation instructions for the NCS since the toolchain manager didn't use to work for Linux. However, I was unable to set build up manually for v2.2.0, without getting the tools from the toolchain manager.

    Now I'm a bit confused with all the tools since I have both the zephyr v0.15.1 toolchain and the NCS toolchain. Not sure how all of it works together.

    This is my output when I run the same build command as yours:
     
    aleksa@aleksa:~/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world$ west build -b nrf52dk_nrf52832 -p -- -DSPARSE=y
    
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world
    -- Using NCS Toolchain 2.2.0 for building. (/home/aleksa/ncs/toolchains/v2.2.0/cmake)
    -- Found Python3: /home/aleksa/ncs/toolchains/v2.2.0/usr/local/bin/python3 (found suitable exact version "3.8.10") found components: Interpreter 
    -- Cache files will be written to: /home/aleksa/.cache/zephyr
    -- Zephyr version: 3.2.99 (/home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52dk_nrf52832
    -- Found host-tools: zephyr 0.15.1 (/home/aleksa/zephyr-sdk-0.15.1)
    -- Found toolchain: zephyr 0.15.1 (/home/aleksa/zephyr-sdk-0.15.1)
    -- Found Dtc: /home/aleksa/ncs/toolchains/v2.2.0/usr/local/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
    -- Generated zephyr.dts: /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/build/zephyr/dts.cmake
    Parsing /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/Kconfig
    Loaded configuration '/home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
    Merged configuration '/home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/prj.conf'
    Configuration saved to '/home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/build/zephyr/.config'
    Kconfig header saved to '/home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/build/zephyr/include/generated/autoconf.h'
    -- Found sparse: /usr/bin/cgcc
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /usr/bin/cgcc
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/samples/hello_world/build
    -- west build: building application
    [1/166] Preparing syscall dependency handling
    
    [2/166] Generating include/generated/version.h
    -- Zephyr version: 3.2.99 (/home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr), build: v3.2.99-ncs1
    [8/166] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:78:9: warning: '__INT_FAST8_TYPE__' has implicit type
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:78:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:78:33: error: got int_fast8_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:79:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:79:33: error: got int_fast16_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:83:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:83:33: error: got int_least8_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:84:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:84:33: error: got int_least16_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:94:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:94:33: error: got uint_fast8_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:95:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:95:33: error: got uint_fast16_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:99:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:99:33: error: got uint_least8_t
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:100:33: error: Expected ; at end of declaration
    /home/aleksa/Desktop/01_POSAO/02_PENNY/04_NCS_V211/mg105-nrf9160-root/lib/nordic/ncs/zephyr/lib/libc/minimal/include/stdint.h:100:33: error: got uint_least16_t
    
    .....

  • I think that there is still some problem. I've installed clear ubuntu 22.04 installation using podman.

    And below are all actions that I've proceeded. Result is still the same... Files that are modified in commit that You mention are with proper content... as I compared...

    apt-get update
    apt install --no-install-recommends git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1
    mkdir ${HOME}/gn && cd ${HOME}/gn
    wget -O gn.zip https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest
    apt-get install unzip
    unzip gn.zip
    rm gn.zip
    echo 'export PATH=${HOME}/gn:"$PATH"' >> ${HOME}/.bashrc
    source ${HOME}/.bashrc
    pip3 install --user west
    echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
    source ~/.bashrc
    mkdir ncs
    cd ncs/
    west init -m https://github.com/nrfconnect/sdk-nrf --mr main
    west update
    west zephyr-export
    pip3 install --user -r zephyr/scripts/requirements.txt
    pip3 install --user -r nrf/scripts/requirements.txt
    pip3 install --user -r bootloader/mcuboot/scripts/requirements.txt
    cd ~
    wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.1/zephyr-sdk-0.15.1_linux-x86_64.tar.gz
    wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.1/sha256.sum | shasum --check --ignore-missing
    tar xvf zephyr-sdk-0.15.1_linux-x86_64.tar.gz
    cd zephyr-sdk-0.15.1
    ./setup.sh
    cd ../ncs/
    source zephyr/zephyr-env.sh
    ln -s ~/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc ~/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/cgcc
    ls -la ~/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/cgcc
    export REAL_CC=~/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    cd zephyr/
    cd samples/basic/blinky
    west build -b nrf52dk_nrf52832 -p -- -DSPARSE=y

    root@ca30ef32b4ea:~/ncs/zephyr/samples/basic/blinky# ls -la ~/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/cgcc
    lrwxrwxrwx 1 root root 63 Dec 15 12:29 /root/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/cgcc -> /root/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    root@ca30ef32b4ea:~/ncs/zephyr/samples/basic/blinky# 

    There is output of build request

    root@ca30ef32b4ea:~/ncs/zephyr/samples/basic/blinky# west build -b nrf52dk_nrf52832 -p -- -DSPARSE=y
    -- west build: making build dir /root/ncs/zephyr/samples/basic/blinky/build pristine
    -- west build: generating a build system                                                                                                                                 
    Loading Zephyr default modules (Zephyr base).                                                                                                                            
    -- Application: /root/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: /root/.cache/zephyr
    -- Zephyr version: 3.2.99 (/root/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.15.1 (/root/zephyr-sdk-0.15.1)
    -- Found toolchain: zephyr 0.15.1 (/root/zephyr-sdk-0.15.1)
    -- Found Dtc: /root/zephyr-sdk-0.15.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
    -- Found BOARD.dts: /root/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
    -- Generated zephyr.dts: /root/ncs/zephyr/samples/basic/blinky/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /root/ncs/zephyr/samples/basic/blinky/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /root/ncs/zephyr/samples/basic/blinky/build/zephyr/dts.cmake
    Parsing /root/ncs/zephyr/Kconfig
    Loaded configuration '/root/ncs/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
    Merged configuration '/root/ncs/zephyr/samples/basic/blinky/prj.conf'
    Configuration saved to '/root/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
    Kconfig header saved to '/root/ncs/zephyr/samples/basic/blinky/build/zephyr/include/generated/autoconf.h'
    CMake Error at /root/ncs/zephyr/cmake/compiler/gcc/target.cmake:10 (find_program):
      Could not find CMAKE_C_COMPILER using the following names: cgcc                                                                                                        
    Call Stack (most recent call first):                                                                                                                                     
      /root/ncs/zephyr/cmake/modules/FindTargetTools.cmake:102 (include)                                                                                                     
      /root/ncs/zephyr/cmake/modules/kernel.cmake:25 (find_package)                                                                                                          
      /root/ncs/zephyr/cmake/modules/zephyr_default.cmake:117 (include)                                                                                                      
      /root/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)                                                                                            
      /root/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/root/ncs/zephyr/samples/basic/blinky/build -GNinja -DBOARD=nrf52dk_nrf52832 -DSPARSE=y -S/root/ncs/zephyr/samples/basic/blinky                                                                                                                        
    root@ca30ef32b4ea:~/ncs/zephyr/samples/basic/blinky#

     Any suggestions?

Related