Loading...
 
Skip to main content

System Workbench for STM32


SW4STM32 v2.0 fails to build imported project from v1.13.1

So I installed v2.0, and then imported a project which successfully built in v1.13.1.

The v2.0 build fails at the first compile:

12:47:27 **** Build of configuration Debug for project L4_DAC_ADC ****
make -j4 all 
'Building file: ../startup/startup_stm32l476xx.s'
'Building file: ../Src/main.c'
'Building file: ../Src/stm32l4xx_hal_msp.c'
'Building file: ../Src/stm32l4xx_it.c'
'Invoking: MCU GCC Assembler'
'Invoking: MCU GCC Compiler'
'Invoking: MCU GCC Compiler'
'Invoking: MCU GCC Compiler'
C:\bin\Ac6\SW4STM32_200\wksp\L4_DAC_ADC\Debug
arm-none-eabi-as -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -o "startup/startup_stm32l476xx.o" "../startup/startup_stm32l476xx.s"
C:\bin\Ac6\SW4STM32_200\wksp\L4_DAC_ADC\Debug
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32L476xx -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Inc" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/STM32L4xx_HAL_Driver/Inc" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/CMSIS/Device/ST/STM32L4xx/Include" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/CMSIS/Include"  -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Src/stm32l4xx_it.d" -MT"Src/stm32l4xx_it.o" -o "Src/stm32l4xx_it.o" "../Src/stm32l4xx_it.c"
C:\bin\Ac6\SW4STM32_200\wksp\L4_DAC_ADC\Debug
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32L476xx -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Inc" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/STM32L4xx_HAL_Driver/Inc" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/CMSIS/Device/ST/STM32L4xx/Include" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/CMSIS/Include"  -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Src/stm32l4xx_hal_msp.d" -MT"Src/stm32l4xx_hal_msp.o" -o "Src/stm32l4xx_hal_msp.o" "../Src/stm32l4xx_hal_msp.c"
C:\bin\Ac6\SW4STM32_200\wksp\L4_DAC_ADC\Debug
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32L476xx -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Inc" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/STM32L4xx_HAL_Driver/Inc" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/CMSIS/Device/ST/STM32L4xx/Include" -I"C:/bin/Ac6/SW4STM32_200/wksp/L4_DAC_ADC/Drivers/CMSIS/Include"  -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Src/main.d" -MT"Src/main.o" -o "Src/main.o" "../Src/main.c"
arm-none-eabi-gcc: error: '-D__weak=__attribute__((weak))': No such file or directory
arm-none-eabi-gcc: error: '-D__packed=__attribute__((__packed__))': No such file or directory
arm-none-eabi-gcc: error: '-D__weak=__attribute__((weak))': No such file or directory
arm-none-eabi-gcc: error: '-D__packed=__attribute__((__packed__))': No such file or directory
make: *** [Src/stm32l4xx_it.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Src/main.o] Error 1
arm-none-eabi-gcc: error: '-D__weak=__attribute__((weak))': No such file or directory
arm-none-eabi-gcc: error: '-D__packed=__attribute__((__packed__))': No such file or directory
make: *** [Src/stm32l4xx_hal_msp.o] Error 1
'Finished building: ../startup/startup_stm32l476xx.s'
' '

12:47:28 Build Finished (took 922ms)


The problem seems to be the single quotes around the weak & packed definitions - where are they coming from?

They aren't being added to USE_HAL_DRIVER or STM32L476xx - and the settings seem identical:

Image

So what's going on ??

😕


EDIT

If I remove the __weak and __packed definitions from the Project Properties, then their -D entries no longer appear on the compiler command lines, and everything builds fine.

If I modify the USE_HAL_DRIVER definition to USE_HAL_DRIVER=1 then it, too, gets corrupted with spurious single-quotes on the command line:

 arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 '-D__weak=__attribute__((weak))' '-DUSE_HAL_DRIVER=1' -DSTM32L476xx ... 


So the bug appears to be in the handling of the -D name=definition form of the option

https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Preprocessor-Options.html

EDIT

Note that the spurious single-quotes do not appear in the GUI display of the command-line options in the Properties view

Image


Could you try by replacing MSYS1 stuff from the make folder by some other from MSYS2 ?


Sure - but what "MSYS1 stuff", exactly, would I be removing - and what "other from MSYS2" stuff, exactly, would I be replacing it with? And from where?