Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails after updating to 3.2.8 version #205

Open
BlazejKrysztofiak opened this issue Sep 6, 2024 · 3 comments
Open

Build fails after updating to 3.2.8 version #205

BlazejKrysztofiak opened this issue Sep 6, 2024 · 3 comments

Comments

@BlazejKrysztofiak
Copy link

BlazejKrysztofiak commented Sep 6, 2024

Hi
My extension automatically updated to version 3.2.8 and my build started to fails:
Here is my STM32Make.make file:

##########################################################################################################################
# File automatically-generated by STM32forVSCode
##########################################################################################################################

# ------------------------------------------------
# Generic Makefile (based on gcc)
#
# ChangeLog :
#   2024-04-27 - Added env file inclusion. 
#                Added way to overide: build directory, target name and optimisation.
#                Added GCC_PATH by env file to not make the makefile machine dependent.
#                Currently folder structure in build directory is preserved
#                Switching of debug/release build output folder now happens based on debug flag
#   2017-02-10 - Several enhancements + project update mode
#   2015-07-22 - first version
# ------------------------------------------------

######################################
# Environment Variables
######################################
# Imports the environment file in which the compiler and other tooling is set
# for the build machine.
# This can also be used to overwrite some makefile variables
file_exists = $(or $(and $(wildcard $(1)),1),0)
ifeq ($(call file_exists,.stm32env),1)
  include .stm32env
endif

######################################
# Target
######################################
# This is the name of the embedded target which will be build
# The final file name will also have debug or release appended to it.
TARGET ?= ComApp

#######################################
# Build directories
#######################################
# Build path can be overwritten when calling make or setting the environment variable
# in .stm32env

BUILD_DIRECTORY ?= build


######################################
# Optimization
######################################
# Optimization is switched based upon the DEBUG variable. If set to 1
# it will be build in debug mode with the Og optimization flag (optimized for debugging).
# If set to 0 (false) then by default the variable is used in the configuration yaml
# This can also be overwritten using the environment variable or by overwriting it
# by calling make with the OPTIMIZATION variable e.g.:
# make -f STM32Make.make -j 16  OPTIMIZATION=Os

# variable which determines if it is a debug build
DEBUG ?= 1

# debug flags when debug is defined
OPTIMIZATION ?= -O0

RELEASE_DIRECTORY = $(BUILD_DIRECTORY)/debug
ifeq ($(DEBUG),1)
  # Sets debugging optimization -Og and the debug information output
  OPTIMIZATION_FLAGS += -Og -g -gdwarf -ggdb
  $(TARGET) := $(TARGET)-debug
  RELEASE_DIRECTORY := $(BUILD_DIRECTORY)/debug
else
  OPTIMIZATION_FLAGS += $(OPTIMIZATION)
  $(TARGET) := $(TARGET)-release
  RELEASE_DIRECTORY := $(BUILD_DIRECTORY)/release
endif

######################################
# source
######################################
# C sources
C_SOURCES =  \
../../Shared/Api/Api.c \
../../Shared/CircularBuffer/CircularBuffer.c \
../../Shared/CmdParser/CmdParser.c \
../../Shared/Crc/CrcSw.c \
../../Shared/ExternalFlash/ExternalFlash.c \
../../Shared/FileSystem/FileSystem.c \
../../Shared/FileSystem/FileSystemUtils.c \
../../Shared/LittleFs/lfs.c \
../../Shared/Log/Log.c \
../../Shared/Log/LogCmdParser.c \
../../Shared/Modem/Http.c \
../../Shared/Modem/Modem.c \
../../Shared/Modem/ModemCmdParser.c \
../../Shared/Modem/TcpIp.c \
../../Shared/Spi/SpiDma.c \
../../Shared/SwTimer/SwTimer.c \
../../Shared/Uart/Uart.c \
../../Shared/Utils/Utils.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_cortex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_crc.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_crc_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_dma.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_dma_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_exti.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash_ramfunc.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_gpio.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pwr.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pwr_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_rcc.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_rcc_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_spi.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_spi_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_tim.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_tim_ex.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_uart.c \
Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_uart_ex.c \
Src/crc.c \
Src/dma.c \
Src/gpio.c \
Src/main.c \
Src/spi.c \
Src/stm32g4xx_hal_msp.c \
Src/stm32g4xx_it.c \
Src/syscalls.c \
Src/sysmem.c \
Src/system_stm32g4xx.c \
Src/usart.c


CPP_SOURCES = \


# ASM sources
ASM_SOURCES =  \
startup_stm32g474xx.s


#######################################
# Tools
#######################################
ARM_PREFIX = arm-none-eabi-
POSTFIX = "
PREFIX = "
# The gcc compiler bin path can be defined in the make command via ARM_GCC_PATH variable (e.g.: make ARM_GCC_PATH=xxx)
# or it can be added to the PATH environment variable.
# By default the variable be used from the environment file: .stm32env.
# if it is not defined

ifdef ARM_GCC_PATH
    CC = $(PREFIX)$(ARM_GCC_PATH)/$(ARM_PREFIX)gcc$(POSTFIX)
    CXX = $(PREFIX)$(ARM_GCC_PATH)/$(ARM_PREFIX)g++$(POSTFIX)
    AS = $(PREFIX)$(ARM_GCC_PATH)/$(ARM_PREFIX)gcc$(POSTFIX) -x assembler-with-cpp
    CP = $(PREFIX)$(ARM_GCC_PATH)/$(ARM_PREFIX)objcopy$(POSTFIX)
    SZ = $(PREFIX)$(ARM_GCC_PATH)/$(ARM_PREFIX)size$(POSTFIX)
    DP = $(PREFIX)$(ARM_GCC_PATH)/$(ARM_PREFIX)objdump$(POSTFIX)
else
  CC ?= $(ARM_PREFIX)gcc
  CXX ?= $(ARM_PREFIX)g++$
  AS ?= $(ARM_PREFIX)gcc -x assembler-with-cpp
  CP ?= $(ARM_PREFIX)objcopy
  SZ ?= $(ARM_PREFIX)size
  DP ?= $(ARM_PREFIX)objdump
endif

HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
LSS = $(DP) -h -S

# Flash and debug tools
# Default is openocd however will be gotten from the env file when existing
OPENOCD ?= openocd


#######################################
# CFLAGS
#######################################
# cpu
CPU = -mcpu=cortex-m4

# fpu
FPU = -mfpu=fpv4-sp-d16

# float-abi
FLOAT-ABI = -mfloat-abi=hard

# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)

# macros for gcc
# AS defines
AS_DEFS = 

# C defines
C_DEFS =  \
-DLFS_CONFIG=FileSystemUtils.h \
-DSTM32G474xx \
-DUSE_HAL_DRIVER


# CXX defines
CXX_DEFS =  \
-DLFS_CONFIG=FileSystemUtils.h \
-DSTM32G474xx \
-DUSE_HAL_DRIVER


# AS includes
AS_INCLUDES = \

# C includes
C_INCLUDES =  \
-I../../Shared/Api \
-I../../Shared/CircularBuffer \
-I../../Shared/CmdParser \
-I../../Shared/Crc \
-I../../Shared/ExternalFlash \
-I../../Shared/FileSystem \
-I../../Shared/LittleFs \
-I../../Shared/Log \
-I../../Shared/Modem \
-I../../Shared/ModuleId \
-I../../Shared/Spi \
-I../../Shared/SwTimer \
-I../../Shared/Uart \
-I../../Shared/Utils \
-IConfig \
-IDrivers/CMSIS/Device/ST/STM32G4xx/Include \
-IDrivers/CMSIS/Include \
-IDrivers/STM32G4xx_HAL_Driver/Inc \
-IDrivers/STM32G4xx_HAL_Driver/Inc/Legacy \
-IInc



# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(C_INCLUDES) $(C_DEFS) $(OPTIMIZATION_FLAGS) 

CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPTIMIZATION_FLAGS)

CXXFLAGS = $(MCU) $(CXX_DEFS) $(C_INCLUDES) $(OPTIMIZATION_FLAGS)

# Add additional flags
CFLAGS += -Wall -fdata-sections -ffunction-sections 
ASFLAGS += -Wall -fdata-sections -ffunction-sections 
CXXFLAGS += 

# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
CXXFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"

# Output a list file for the compiled source file.
# This is a representative of the source code in assembly
ASSEMBLER_LIST_OUTPUT_FLAG = -Wa,-a,-ad,-alms=$(call add_release_directory,$<,lst)
CFLAGS += $(ASSEMBLER_LIST_OUTPUT_FLAG)
CXXFLAGS += $(ASSEMBLER_LIST_OUTPUT_FLAG)

#######################################
# LDFLAGS
#######################################
# link script
LDSCRIPT = STM32G474MBTx_FLASH.ld

# libraries
LIBS = -lc -lm -lnosys 
LIBDIR = \


# Additional LD Flags from config file
ADDITIONALLDFLAGS = -Wl,--print-memory-usage -specs=nano.specs 

LDFLAGS = $(MCU) $(ADDITIONALLDFLAGS) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIRECTORY)/$(TARGET).map,--cref -Wl,--gc-sections

#######################################
# build the application
#######################################
add_release_directory = $(sort $(addprefix $(RELEASE_DIRECTORY)/,$(addsuffix .$(2),$(basename $(subst ../,parent,$(1))))))

REMOVE_DIRECTORY_COMMAND = rm -fR
mkdir_function = mkdir -p $(1)
ifeq ($(OS),Windows_NT)
  convert_to_windows_path = $(strip $(subst /,\,$(patsubst %/,%,$(1))))
  REMOVE_DIRECTORY_COMMAND = cmd /c rd /s /q
  mkdir_function = cmd /e:on /c md $(call convert_to_windows_path,$(1))
endif



OBJECTS = $(call add_release_directory,$(C_SOURCES),o)
OBJECTS += $(call add_release_directory,$(CPP_SOURCES),o)
OBJECTS += $(call add_release_directory,$(ASM_SOURCES),o)
vpath %.c $(sort $(dir $(C_SOURCES)))
vpath %.cc $(sort $(dir $(CXX_SOURCES)))
vpath %.cp $(sort $(dir $(CXX_SOURCES)))
vpath %.cxx $(sort $(dir $(CXX_SOURCES)))
vpath %.cpp $(sort $(dir $(CXX_SOURCES)))
vpath %.c++ $(sort $(dir $(CXX_SOURCES)))
vpath %.C $(sort $(dir $(CXX_SOURCES)))
vpath %.CPP $(sort $(dir $(CXX_SOURCES)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
vpath %.S $(sort $(dir $(ASM_SOURCES)))

# the tree of folders which needs to be present based on the object files
BUILD_TREE = $(sort $(dir $(OBJECTS)))

# C build
$(RELEASE_DIRECTORY)/%.o: %.c STM32Make.make | $(BUILD_TREE)
	$(CC) -c $(CFLAGS) $< -o $@

# C++ build 
$(RELEASE_DIRECTORY)/%.o: %.cc STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.cp STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.cxx STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.cpp STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.c++ STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.C STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.CPP STM32Make.make | $(BUILD_TREE)
	$(CXX) -c $(CXXFLAGS) $< -o $@

#Assembly build
$(RELEASE_DIRECTORY)/%.o: %.s STM32Make.make | $(BUILD_TREE)
	$(AS) -c $(ASFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.S STM32Make.make | $(BUILD_TREE)
	$(AS) -c $(ASFLAGS) $< -o $@

$(RELEASE_DIRECTORY)/%.o: %.sx STM32Make.make | $(BUILD_TREE)
	$(AS) -c $(ASFLAGS) $< -o $@

$(BUILD_DIRECTORY)/$(TARGET).elf: $(OBJECTS) STM32Make.make | $(BUILD_DIRECTORY)
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
	$(SZ) $@

$(BUILD_DIRECTORY)/%.hex: $(BUILD_DIRECTORY)/%.elf | $(BUILD_DIRECTORY)
	$(HEX) $< $@

$(BUILD_DIRECTORY)/%.bin: $(BUILD_DIRECTORY)/%.elf | $(BUILD_DIRECTORY)
	$(BIN) $< $@

$(BUILD_DIRECTORY)/%.lss: $(BUILD_DIRECTORY)/%.elf | $(BUILD_DIRECTORY)
	$(LSS) $< > $@

$(BUILD_DIRECTORY):
	$(call mkdir_function, $@)

$(BUILD_TREE):
	$(call mkdir_function, $@)

#######################################
# all
#######################################
# default action: build all
all:
	$(BUILD_DIRECTORY)/$(TARGET).elf 
	$(BUILD_DIRECTORY)/$(TARGET).hex 
	$(BUILD_DIRECTORY)/$(TARGET).bin 
	$(BUILD_DIRECTORY)/$(TARGET).lss 


flash: $(BUILD_DIRECTORY)/$(TARGET).elf
	"$(OPENOCD)" -f ./openocd.cfg -c "program $(BUILD_DIRECTORY)/$(TARGET).elf verify reset exit"

#######################################
# erase
#######################################
erase: $(BUILD_DIRECTORY)/$(TARGET).elf
	"$(OPENOCD)" -f ./openocd.cfg -c "init; reset halt; stm32g4x mass_erase 0; exit"

#######################################
# clean up
#######################################
clean:
	$(REMOVE_DIRECTORY_COMMAND) $(BUILD_DIRECTORY)

#######################################
# custom makefile rules
#######################################

	
#######################################
# dependencies
#######################################
-include $(wildcard $(BUILD_DIRECTORY)/*.d)

# *** EOF ***

And here is my build output:

  • Executing task in folder ComApp: & 'C:\USERS\BLAKRZ\APPDATA\ROAMING\CODE\USER\GLOBALSTORAGE\BMD.STM32-FOR-VSCODE@XPACK-DEV-TOOLS\WINDOWS-BUILD-TOOLS\4.4.1-2.1.CONTENT\BIN\MAKE.EXE' -j16 -O -f STM32Make.make clean

cmd /c rd /s /q build

  • Terminal will be reused by tasks, press any key to close it.

  • Executing task in folder ComApp: & 'C:\USERS\BLAKRZ\APPDATA\ROAMING\CODE\USER\GLOBALSTORAGE\BMD.STM32-FOR-VSCODE@XPACK-DEV-TOOLS\WINDOWS-BUILD-TOOLS\4.4.1-2.1.CONTENT\BIN\MAKE.EXE' -j16 -O -f STM32Make.make

cmd /e:on /c md build\debug
cmd /e:on /c md build\debug\Drivers\STM32G4xx_HAL_Driver\Src
cmd /e:on /c md build\debug\Src
cmd /e:on /c md build\debug\parentparentShared\Api
cmd /e:on /c md build\debug\parentparentShared\CircularBuffer
cmd /e:on /c md build\debug\parentparentShared\CmdParser
cmd /e:on /c md build\debug\parentparentShared\Crc
cmd /e:on /c md build\debug\parentparentShared\ExternalFlash
cmd /e:on /c md build\debug\parentparentShared\FileSystem
cmd /e:on /c md build\debug\parentparentShared\LittleFs
cmd /e:on /c md build\debug\parentparentShared\Log
cmd /e:on /c md build\debug\parentparentShared\Modem
cmd /e:on /c md build\debug\parentparentShared\Spi
cmd /e:on /c md build\debug\parentparentShared\SwTimer
MAKE.EXE: *** No rule to make target 'build/debug/parentparentShared/Api/Api.o', needed by 'build/ComApp.elf'. Stop.
MAKE.EXE: *** Waiting for unfinished jobs....
cmd /e:on /c md build\debug\parentparentShared\Uart
cmd /e:on /c md build\debug\parentparentShared\Utils

  • The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command & 'C:\USERS\BLAKRZ\APPDATA\ROAMING\CODE\USER\GLOBALSTORAGE\BMD.STM32-FOR-VSCODE@XPACK-DEV-TOOLS\WINDOWS-BUILD-TOOLS\4.4.1-2.1.CONTENT\BIN\MAKE.EXE' -j16 -O -f STM32Make.make " terminated with exit code: 1.

I am working on Windows 11.

@BlazejKrysztofiak
Copy link
Author

I have gcc compiler installed, when I get back to older version then it works fine.

@jortbmd
Copy link
Member

jortbmd commented Sep 6, 2024

Thanks for opening up an issue for this. As far as I can tell this is due to the fact that there are parent directories in your makefile. I do not have the time to do an immediate fix however it will go on top of the priority list and will let you know when there is a fix. For now using the 3.2.7 Should work for you

@BlazejKrysztofiak
Copy link
Author

Yup, 3.2.7 is working fine. Thank you for answering :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@jortbmd @BlazejKrysztofiak and others