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:
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.