Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

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:

2017 06 20 (9)

So what’s going on ??

confused


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

EDIT

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

2017 06 20 (10)


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?


 

Newest Forum Posts

  1. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  2. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  3. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  5. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  6. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  8. Build a project in "release" mode by tang, 2025-02-20 10:36
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35
  10. Fail to debug in Win 11 C/C++ by mortenlund, 2024-12-26 20:27

Last-Modified Blogs