Issue analysing code using atmelstudio ( microchip studio ) SonarQube developer edition. ARM Atmel chip

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

SonarQube version:

sonarqube-8.1.0.31237 Developer edition and licensed.

SonarQube Scanner version:

SonarQube Scanner 4.2.0.1873

What I try to achive

As team we try to Analyse the source code created in Microchip studio. The cpu used is a atmel arm chip. The program gets compiled using the following command.

What I achieve so far:

Command clean:

C:\Program Files (x86)\Atmel\Studio\7.0 DCU.atsln  /clean debug /out clean_output.txt

Command build:

C:\Program Files (x86)\Atmel\Studio\7.0 DCU.atsln  /build debug /out clean_output.txt

This is executed from within a jenkins workspace folder.
The running command on the Jenkins server

 bat "build-wrapper-win-x86-64.exe --out-dir analyse clean.bat"
 bat "build-wrapper-win-x86-64.exe --out-dir analyse build.bat"

It generates the folder
image

The output of the SonarQube analyzer is:

Its to big to paste, can I upload a file for this?

The problem is

16:50:17.985 ERROR: Error during SonarQube Scanner execution

java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:

In the other project we use the xc8 compiler using GCC and this works.

The only big diffrence is now that we use the build / clean using atmelstudio exe
Where should we look to solve this problem?build_sonarqube_log_anaylzer.txt (40.2 KB)

Updated the post:

Added the output log.

Hi @ralphvbair ,

we currently don’t support Microchip compilers, see the related ticket: CPP-2569. I added your request to the ticket.

@mpaladin
The compiler used in this project is arm-none-eabi-g++.exe. Only its build from within microchip and atmel studio.
This project isnt compiled with XC8.

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe" -mthumb -D__SAME51N19A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAME51_DFP\1.1.129\include" -I"../BSP" -I"../CMSIS" -I"../HAL" -I"../PeripheralDrivers" -I"../HAL/SercomMethods" -I"../Other" -I"../Utilities" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAME51_DFP\1.1.139\include" -I"../Algorithm"  -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -Wextra -Wundef -mcpu=cortex-m4 -c -MD -MP -MF "PeripheralDrivers/VBrsc.d" -MT"PeripheralDrivers/VBrsc.d" -MT"PeripheralDrivers/VBrsc.o"   -o "PeripheralDrivers/VBrsc.o" "../PeripheralDrivers/VBrsc.cpp" 
		Finished building: ../PeripheralDrivers/VBrsc.cpp

and

		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe" -mthumb -D__SAME51N19A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAME51_DFP\1.1.129\include" -I"../BSP" -I"../CMSIS" -I"../HAL" -I"../PeripheralDrivers" -I"../HAL/SercomMethods" -I"../Other" -I"../Utilities" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAME51_DFP\1.1.139\include" -I"../Algorithm"  -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -Wextra -Wundef -mcpu=cortex-m4 -c -MD -MP -MF "PeripheralDrivers/RS232.d" -MT"PeripheralDrivers/RS232.d" -MT"PeripheralDrivers/RS232.o"   -o "PeripheralDrivers/RS232.o" "../PeripheralDrivers/RS232.cpp" 
		Finished building: ../PeripheralDrivers/RS232.cpp

The command we use is:

atmelstudio.exe solution file /build

and I also see in the build log:

		COLLECT_GCC=C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe
		Target: arm-none-eabi
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAME51N19A__ -DDEBUG  -I"../Device_Startup" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAME51_DFP\1.1.129\include" -I"../BSP" -I"../CMSIS" -I"../HAL" -I"../PeripheralDrivers" -I"../HAL/SercomMethods" -I"../Other" -I"../Utilities" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAME51_DFP\1.1.139\include" -I"../Algorithm"  -O0 -ffunction-sections -mlong-calls -g3 -Wall -Wextra -Wundef -mcpu=cortex-m4 -c -std=gnu99 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -v -MD -MP -MF "Other/syscalls.d" -MT"Other/syscalls.d" -MT"Other/syscalls.o"   -o "Other/syscalls.o" "../Other/syscalls.c" 
		Finished building: ../Other/syscalls.c
		Configured with: /home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/src/gcc/configure --build=x86_64-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw --libexecdir=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw/lib --infodir=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-mingw-wildcard --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/install-mingw/arm-none-eabi --with-libiconv-prefix=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/build-mingw/host-libs/usr --with-gmp=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/build-mingw/host-libs/usr --with-mpfr=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/build-mingw/host-libs/usr --with-mpc=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/build-mingw/host-libs/usr --with-isl=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/build-mingw/host-libs/usr --with-libelf=/home/toolsbuild/workspace/arm-gnu-toolchain/gcc-arm-none-eabi-6-2017-q2-update/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='Atmel build: 508' --with-multilib-list=rmprofile,aprofile
		Thread model: single
		gcc version 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437] (Atmel build: 508) 

edit:
Can I upload / send the build-wrapper-dump.jsson and the build-wrapper.log somewhere safe?
@mpaladin

@Abbas_Sabra
I remember u helped me in the past with GCC and XC8
Is this issue the same as in the past with XC8 or is the arm compiler supported?
Cause I seen a topic here on the forum that a man in 2018 compiled successfully with SonarScanner and the build wrapper for atmel studio but he had a short path in his folder name.

What do you suggest?

Currently I do this

     //////////////////////////////////////SONARQUBE SETTINGS FOR SONARQUBE DEVELOPER EDITON
                        def sonar_analyse_string = " -X "
                        sonar_analyse_string += " -Dsonar.host.url=http://10.10.20.211:9001 "
                        sonar_analyse_string += " -Dsonar.verbose=true "
                        sonar_analyse_string += " -Dsonar.projectKey=DCU "
                        sonar_analyse_string += " -Dsonar.login=privat "
                        sonar_analyse_string += " -Dsonar.sourceEncoding=UTF-8 "
                        sonar_analyse_string += " -Dsonar.sources=DCU "
                        sonar_analyse_string += " -Dsonar.working.directory=sonarWD "
                        sonar_analyse_string += " -Dsonar.branch.name=$env.BRANCH_NAME "
                        sonar_analyse_string += " -Dsonar.import_unknown_files=true "
                        sonar_analyse_string += " -Dsonar.cfamily.build-wrapper-output=analyse "
                        sonar_analyse_string += " -Dsonar.cfamily.cache.enabled=false "
                        sonar_analyse_string += " -Dsonar.cppcheck.reportPath=cppcheck-report.xml "


                        echo "SonarQube anaylse settings: ${sonar_analyse_string}" 

                        withSonarQubeEnv('SonarQube') 
                        {
                        
                            bat "misra.bat"
                            bat "build-wrapper-win-x86-64.exe --out-dir analyse clean.bat"
                            bat "build-wrapper-win-x86-64.exe --out-dir analyse build.bat"
 //////////////////////////////////////EXECUTE SONARQUBE SCANNER PUBLISHER FOR SONARQUBE DEVELOPER EDITON
                            echo "sonar_analyse_string:  ${sonar_analyse_string}"
                            bat "${scannerHome}/bin/sonar-scanner.bat ${sonar_analyse_string}"    

Hi @ralphvbair ,

I am sending you a pm.

there should be only one build-wrapper call, the last one is enough and anyway it overwrites the previous output.

I solved the issue.

The build wrapper didnt like

atmel studio project file / build

I needed to change the path in a script that make sure I can access the makedep.mk file

makedep.mk

image

if I then executed:

build-wrapper-win-x86-64.exe --out-dir analyse make -k clean all

Then it succeeded but then the license was expiered the web ui told me.
I forgot to renew the license but we already purchased one in janury only forgot to activate.

only there is something else going on. We have another misra analyser and this tool finds a lot more misra c++ faults

We only find 98 bugs:

while the other tools finds 318 as example. What can go wrong here?

The value:

As you can see the bugs are related to misra cert bugs.
So I think bugs are equal to the misra detections notice the 4.1K code smells does they contain misra too?

Hi @ralphvbair ,

I am not sure what you are trying to achieve. If you browse the issues do you get what you expect? You should not expect to compare 2 tools by simply looking at the top issues numbers.