I need your hel for making an analysis of a STM32 C project

I need to run here the analysis the problem it is that it has a specific compiler for embedded

Hi Simone,

Can you elaborate on the problem you have?
For instance can you provide logs?

Thanks.

Best.

Hello @Simone_Gasparella,

Why are you calling make if you don’t have any rule to make the target?

The argument of the build wrapper should be the actual build command that you use to build your project.
It should build your project from scratch if you call it without build-wrapper. in your case make clean all is obviously not your build command since it fails. please replace it with your build command.

Thanks,

Hi Abbas…

Thanks for helping in this topic…

STM32CubeIDe that i am using right now, it is generating in an autonomous way the make file … (auto generated)

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include Drivers/STM32F7xx_HAL_Driver/Src/subdir.mk
-include Core/Startup/subdir.mk
-include Core/Src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(S_DEPS)),)
-include $(S_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

BUILD_ARTIFACT_NAME := Devops
BUILD_ARTIFACT_EXTENSION := elf
BUILD_ARTIFACT_PREFIX := 
BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME).$(BUILD_ARTIFACT_EXTENSION)

# Add inputs and outputs from these tool invocations to the build variables 
EXECUTABLES += \
Devops.elf \

SIZE_OUTPUT += \
default.size.stdout \

OBJDUMP_LIST += \
Devops.list \

OBJCOPY_BIN += \
Devops.bin \


# All Target
all: main-build

# Main-build Target
main-build: Devops.elf secondary-outputs

# Tool invocations
Devops.elf: $(OBJS) $(USER_OBJS) C:\Users\simone.gasparella\STM32CubeIDE\workspace_1.5.1\Devops\STM32F746ZGTX_FLASH.ld
	arm-none-eabi-gcc -o "Devops.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m7 -T"C:\Users\simone.gasparella\STM32CubeIDE\workspace_1.5.1\Devops\STM32F746ZGTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="Devops.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
	@echo 'Finished building target: $@'
	@echo ' '

default.size.stdout: $(EXECUTABLES)
	arm-none-eabi-size  $(EXECUTABLES)
	@echo 'Finished building: $@'
	@echo ' '

Devops.list: $(EXECUTABLES)
	arm-none-eabi-objdump -h -S $(EXECUTABLES) > "Devops.list"
	@echo 'Finished building: $@'
	@echo ' '

Devops.bin: $(EXECUTABLES)
	arm-none-eabi-objcopy  -O binary $(EXECUTABLES) "Devops.bin"
	@echo 'Finished building: $@'
	@echo ' '

# Other Targets
clean:
	-$(RM) *
	-@echo ' '

secondary-outputs: $(SIZE_OUTPUT) $(OBJDUMP_LIST) $(OBJCOPY_BIN)

fail-specified-linker-script-missing:
	@echo 'Error: Cannot find the specified linker script. Check the linker settings in the build configuration.'
	@exit 2

warn-no-linker-script-specified:
	@echo 'Warning: No linker script specified. Check the linker settings in the build configuration.'

.PHONY: all clean dependents fail-specified-linker-script-missing warn-no-linker-script-specified
.SECONDARY:

-include ../makefile.targets

From the ide pushing the build button launch this command

Maybe it is missing the path to the generated makefile?

Thannks

@Simone_Gasparella,

  • The first step is to try to figure out how to fully build your project from the command line(without build-wrapper). I cannot help with that because it is project-specific.
  • Once you succeed in doing it, you can pass this command to build-wrapper and it should work. If the command doesn’t work without build-wrapper it will not work with it.

Thanks,

Hi Abbas…

I was able to create a bitbucket pipeline yml file for building the project for STM32

# This is an example Starter pipeline configuration
# Use a skeleton to build, test and deploy using manual and parallel steps
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: 
  name: lpodkalicki/stm32-toolchain
  username: simogaspa84
  password: **********
  email: simogaspa84@gmail.com

pipelines:
  default:
    - parallel:
      - step:
          name: 'Build and Test'
          script:
            - sed -i -E 's/[A-Z]:\\.*\\workspace_[^\\]+\\[^\\]+\\/..\//' Debug/makefile
            - make -C Debug all
      - step:
          name: 'Lint'
          script:
            - echo "Your linting"
      - step:
          name: 'Security scan'
          script:
            - echo "Your security scan goes here..."

    # The following deployment steps will be executed for each pipeline run. To configure your steps and conditionally deploy see https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/
    - step:
        name: 'Deployment to Staging'
        deployment: staging
        script:
          - echo "Your deployment to staging script goes here..."
    - step:
        name: 'Deployment to Production'
        deployment: production
        trigger: 'manual'
        script:
          - echo "Your deployment to production script goes here..."

Now what I want it is to add the sonarcloud integration… I made 2 tests…

the first one

image: gcc:6.5

clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - sonar
        script:
          - export SONAR_SCANNER_VERSION=4.4.0.2170
          - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
          - export BW_OUTPUT=$HOME/.sonar/bw-output
          - mkdir -p $BW_OUTPUT
          - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
          - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
          - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
          - curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
          - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
          - export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
          - sed -i -E 's/[A-Z]:\\.*\\workspace_[^\\]+\\[^\\]+\\/..\//' Debug/makefile
          - build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT make -C Debug all
          - sonar-scanner -Dsonar.cfamily.build-wrapper-output=$BW_OUTPUT

pipelines:                 # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
  branches:
    feature/DEVOPS-17-modify-confi-file-of-pipeline-:
      - step: *build-test-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud

But I got this one

it seems the arm specific compiler is missing…
The docker image is different… it doesn’t have the arm compiler…

The second test i made is the following …

image: 
  name: lpodkalicki/stm32-toolchain
  username: simogaspa84
  password: ***********
  email: simogaspa84@gmail.com

clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - sonar
        script:
          - export SONAR_SCANNER_VERSION=4.4.0.2170
          - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
          - export BW_OUTPUT=$HOME/.sonar/bw-output
          - mkdir -p $BW_OUTPUT
          - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
          - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
          - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
          - curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
          - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
          - export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
          - sed -i -E 's/[A-Z]:\\.*\\workspace_[^\\]+\\[^\\]+\\/..\//' Debug/makefile
          - build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT make -C Debug all
          - sonar-scanner -Dsonar.cfamily.build-wrapper-output=$BW_OUTPUT

pipelines:                 # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
  branches:
    feature/DEVOPS-17-modify-confi-file-of-pipeline-:
      - step: *build-test-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud

But I got …

Any idea about different docker images ?

Thanks a lot

I used a different docker image…
Not it is failing the last step…
It is not clear why…
Can you help me ?