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


/bin/sh: -c: line 0: syntax error near unexpected token `('


On Mac OSX (latest) I am getting this error:

13:36:04 **** Build of configuration Debug for project TEST-F0 ****
make all
Building file: ../Src/gpio.c
Invoking: MCU GCC Compiler
/Users/adk/Documents/workspace.stm32/TEST-F0/Debug
arm-none-eabi-gcc -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -Dweak=attributeweak -Dpacked=attributepacked -DUSE_HAL_DRIVER -DSTM32F031x6 -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Inc” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/STM32F0xx_HAL_Driver/Inc” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/STM32F0xx_HAL_Driver/Inc/Legacy” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/CMSIS/Device/ST/STM32F0xx/Include” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/CMSIS/Include” -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF”Src/gpio.d” -MT”Src/gpio.o” -o “Src/gpio.o” “../Src/gpio.c”
/bin/sh: -c: line 0: syntax error near unexpected token `(’
/bin/sh: -c: line 0: `arm-none-eabi-gcc -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -Dweak=attributeweak -Dpacked=attributepacked -DUSE_HAL_DRIVER -DSTM32F031x6 -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Inc” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/STM32F0xx_HAL_Driver/Inc” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/STM32F0xx_HAL_Driver/Inc/Legacy” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/CMSIS/Device/ST/STM32F0xx/Include” -I”/Users/adk/Documents/workspace.stm32/TEST-F0/Drivers/CMSIS/Include” -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF”Src/gpio.d” -MT”Src/gpio.o” -o “Src/gpio.o” “../Src/gpio.c”’
make: *** Src/gpio.o Error 2

13:36:04 Build Finished (took 91ms)


Anybody else getting this error?

Hi,

I got nearly the same on my Linux64 install.

The workaround I found is to edit the .cproject xml file and replace

value=”weak=attributeweak” with value=”weak="attributeweak"”
and
value=”packed=attributepacked” with value=”packed="attributepacked"”

It seems gcc is waiting something between “...” when using atrributeblabla (?)

I’m using CubeMX, so I edited the .cproject file created by Cube, so it is OK when importing it in ac6

Hope it helps,
J.



I just found similar on Linux on a newly generated (by cubemx 4.18) project.

/bin/sh: 1: Syntax error: “(” unexpected

when building with :
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Dweak=attributeweak -Dpacked=attributepacked......

Parentheses like () means to process in a sub-shell in a posix shell, so this won’t work on Linux / OSX. The solution for me was to escape with " in the .cproject file as jea74 suggested - thanks !

I tried to post the exact changes I made for reference but the forum just truncates the post.
Anyway, just seen the post above about the bug report...

Thanks @dangermouse that worked for me

My issue poped up when I upgraded to STM32CubeMX 4.18.0
The correct values were infact in the .cproject file, however the incorrect ones with the bad syntax were also, there so I just commented them out


For me the original code was:

value="__weak=__attribute__((weak))"

and

value="__packed=__attribute__((__packed__))"


In both lines I have to put " after the second = and after the last ) to make it work.

Thanks for your help!

Edit: it is already mentioned in the link in the post of Andrei from The Great White North. I guess I should read better. redface


 

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