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


"expected identifier before '(' token" error during build

I am building a project which is a slightly modified version of BLE_Sample_App provided by ST. Before my last modifications, the IDE was succesfully building it. However, when I added some new functionality to the main code and added a couple of new source&header files, the IDE started complaining about line104 of stm32l4xx_hal_gpio.h, which is the definition of GPIO_PIN_2. The corresponding code part is below:

/* Exported constants --------------------*/
/** @defgroup GPIO_Exported_Constants GPIO Exported Constants
* @{
*/
/** @defgroup GPIO_pins GPIO pins
* @{
*/

  1. define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */
  2. define GPIO_PIN_1 ((uint16_t)0x0002) /* Pin 1 selected */
  3. define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */
  4. define GPIO_PIN_3 ((uint16_t)0x0008) /* Pin 3 selected */
  5. define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */
  6. define GPIO_PIN_5 ((uint16_t)0x0020) /* Pin 5 selected */
  7. define GPIO_PIN_6 ((uint16_t)0x0040) /* Pin 6 selected */
  8. define GPIO_PIN_7 ((uint16_t)0x0080) /* Pin 7 selected */
  9. define GPIO_PIN_8 ((uint16_t)0x0100) /* Pin 8 selected */
  10. define GPIO_PIN_9 ((uint16_t)0x0200) /* Pin 9 selected */
  11. define GPIO_PIN_10 ((uint16_t)0x0400) /* Pin 10 selected */
  12. define GPIO_PIN_11 ((uint16_t)0x0800) /* Pin 11 selected */
  13. define GPIO_PIN_12 ((uint16_t)0x1000) /* Pin 12 selected */
  14. define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */
  15. define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */
  16. define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */
  17. define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */

  1. define GPIO_PIN_MASK ((uint32_t)0x0000FFFF) /* PIN mask for assert test */


What I don’t get is, why it is giving an error only for GPIO_PIN_2? I checked the other places this definition is used, but in those two other places, the new definitions are also legit. Finally, below is the console output when I try to build my project:

11:20:35 **** Incremental Build of configuration Release for project STM32L4xx-SensorTile ****
make all
Building file: /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/TargetPlatform.c
Invoking: MCU GCC Compiler
/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/SW4STM32/STM32L4xx-SensorTile/Release
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 -DUSE_HAL_DRIVER -DSTM32_SENSORTILE -DSTM32L476xx -DUSE_STM32L4XX_NUCLEO -I”/home/msrl/Magnes/stm32/Drivers/CMSIS/Device/ST/STM32L4xx/Include” -I”/home/msrl/Magnes/stm32/Drivers/STM32L4xx_HAL_Driver/Inc” -I”/home/msrl/Magnes/stm32/Drivers/BSP/SensorTile” -I”/home/msrl/Magnes/stm32/Drivers/CMSIS/Include” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/Common” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_BlueNRG/SimpleBlueNRG_HCI/includes” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lsm6dsm” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/hts221” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lps22hb” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lsm303agr” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/stc3115” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_USB_Device_Library/Core/Inc” -I”/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc” -I/home/msrl/Magnes/stm32/Drivers/BSP/SensorTile -Os -Wall -fmessage-length=0 -ffunction-sections -c -MMD -MP -MF”MotEnv1_ST/User/TargetPlatform.d” -MT”MotEnv1_ST/User/TargetPlatform.o” -o “MotEnv1_ST/User/TargetPlatform.o” “/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/TargetPlatform.c”
In file included from /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/TargetPlatform.c:45:0:
/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc/main.h:111:16: warning: ‘HeelStrike’ declared ‘static’ but never defined -Wunused-function
static uint8_t HeelStrike(void);

~~~~~~~112:16: warning: ‘ToeOff’ declared ‘static’ but never defined -Wunused-function

static uint8_t ToeOff(void);

~113:16: warning: ‘ToeOffDiabetes’ declared ‘static’ but never defined -Wunused-function

static uint8_t ToeOffDiabetes(void);

~~~~~<span style="color”> /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc/main.h”>114:16: warning: ‘NoMotion’ declared ‘static’ but never defined -Wunused-function

static uint8_t NoMotion( void );

~

Finished building: /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/TargetPlatform.c

Building file: /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/clock.c
Invoking: MCU GCC Compiler
/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/SW4STM32/STM32L4xx-SensorTile/Release
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 -DUSE_HAL_DRIVER -DSTM32_SENSORTILE -DSTM32L476xx -DUSE_STM32L4XX_NUCLEO -I”/home/msrl/Magnes/stm32/Drivers/CMSIS/Device/ST/STM32L4xx/Include” -I”/home/msrl/Magnes/stm32/Drivers/STM32L4xx_HAL_Driver/Inc” -I”/home/msrl/Magnes/stm32/Drivers/BSP/SensorTile” -I”/home/msrl/Magnes/stm32/Drivers/CMSIS/Include” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/Common” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_BlueNRG/SimpleBlueNRG_HCI/includes” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lsm6dsm” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/hts221” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lps22hb” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lsm303agr” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/stc3115” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_USB_Device_Library/Core/Inc” -I”/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc” -I/home/msrl/Magnes/stm32/Drivers/BSP/SensorTile -Os -Wall -fmessage-length=0 -ffunction-sections -c -MMD -MP -MF”MotEnv1_ST/User/clock.d” -MT”MotEnv1_ST/User/clock.o” -o “MotEnv1_ST/User/clock.o” “/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/clock.c”
Finished building: /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/clock.c

Building file: /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/main.c
Invoking: MCU GCC Compiler
/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/SW4STM32/STM32L4xx-SensorTile/Release
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 -DUSE_HAL_DRIVER -DSTM32_SENSORTILE -DSTM32L476xx -DUSE_STM32L4XX_NUCLEO -I”/home/msrl/Magnes/stm32/Drivers/CMSIS/Device/ST/STM32L4xx/Include” -I”/home/msrl/Magnes/stm32/Drivers/STM32L4xx_HAL_Driver/Inc” -I”/home/msrl/Magnes/stm32/Drivers/BSP/SensorTile” -I”/home/msrl/Magnes/stm32/Drivers/CMSIS/Include” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/Common” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_BlueNRG/SimpleBlueNRG_HCI/includes” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lsm6dsm” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/hts221” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lps22hb” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/lsm303agr” -I”/home/msrl/Magnes/stm32/Drivers/BSP/Components/stc3115” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc” -I”/home/msrl/Magnes/stm32/Middlewares/ST/STM32_USB_Device_Library/Core/Inc” -I”/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc” -I/home/msrl/Magnes/stm32/Drivers/BSP/SensorTile -Os -Wall -fmessage-length=0 -ffunction-sections -c -MMD -MP -MF”MotEnv1_ST/User/main.d” __-MT”MotEnv1_ST/User/main.o” -o “MotEnv1_ST/User/main.o” “/home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/main.c”
In file included from /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc/stm32l4xx_hal_conf.h:195:0,
from /home/msrl/Magnes/stm32/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:48,
from /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Inc/TargetFeatures.h:55,
from /home/msrl/Magnes/stm32/Projects/SensorTile/Applications/BLE_SampleApp/Src/main.c:48:
/home/msrl/Magnes/stm32/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h:104:36: error: expected identifier before ‘(’ token
#define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */__

MotEnv1_ST/User/subdir.mk:58: recipe for target ‘MotEnv1_ST/User/main.o’ failed
make: *** MotEnv1_ST/User/main.o Error 1

11:20:36 Build Finished (took 914ms)

It would be great if anyone could help me with this.

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs