cancel
Showing results for 
Search instead for 
Did you mean: 

Type missing binary operator before token "("

kadirsrht
Associate II

Hello, I encountered such an error while working on my software and I cannot solve this error. Can you help me with this issue?

kadirsrht_0-1726065297609.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Right. So it tells you where the actual error occurs:

 

 

../Core/Src/system_stm32f4xx.c:170:52: note: in expansion of macro 'SCB'
  170 |   #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */
      |                                                    ^~~

 

 

In the notation "../Core/Src/system_stm32f4xx.c:170:52"

  • ../Core/Src/system_stm32f4xx.c is the full path name of the file where the error was found;
  • 170 is the line number within that file;
  • 52 is the character position (or "column") along that line (counting from the left).

The message then quotes that line from the source file;

Note how the " ^~~" in the following line of the message points at the error position.

The error is that the  SCB->CPACR cannot simply follow the (__FPU_USED == 1) as it does in that line:

AndrewNeil_0-1726134507068.png

 

It looks like you have "lost" a line break, and the code should be:

 

 

 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */

 

#HowToReadGccErrorMessage

 

View solution in original post

6 REPLIES 6
KnarfB
Principal III

Seems to be a side effect of other code. Check if SCB, SCB_Type, or SCB_BASE are defined elsewhere in your code.

hth

KnarfB

Andrew Neil
Evangelist III

The error is not in the code you've shown, which is just the definition of SCB macro - that is fine.

The error will be in somewhere where you have used that macro.

Probably, there is a syntax error before the use of the macro, which means that the expansion of the macro does not make sense at that point.

You need to post the output from the 'Console' tab - copy & paste the text (not an image) - as for source code:

https://community.st.com/t5/stm32-mcus-boards-and-hardware/nucleo-f767zi-ethernet-problem/m-p/703634/highlight/true#M20574:~:text=please%20select%2Dall%20from%C2%A0the%20%27Console%27%20window%2C%20then%20copy%20and%20paste%20the%20text%20here%2C%20using%20the%20%3C/%3E%20button%20as%20for%20source%...

The messages in the  'Console' tab should give a better indication of where the actual error is - please also post that source code.

make -j16 all 
arm-none-eabi-gcc "../Core/Src/system_stm32f4xx.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F429xx -c -I../Core/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -I"D:/Ofis-Pc/Firmware_List/DAP_SC_AC_22KW_SIMPLE _HVB_TYPE _ACS37800/cpkontrol/Inc" -I"D:/Ofis-Pc/Firmware_List/DAP_SC_AC_22KW_SIMPLE _HVB_TYPE _ACS37800/RC522/Inc" -I"D:/Ofis-Pc/Firmware_List/DAP_SC_AC_22KW_SIMPLE _HVB_TYPE _ACS37800/ACS37800/Inc" -I"D:/Ofis-Pc/Firmware_List/DAP_SC_AC_22KW_SIMPLE _HVB_TYPE _ACS37800/SH1106/Inc" -I"D:/Ofis-Pc/Firmware_List/DAP_SC_AC_22KW_SIMPLE _HVB_TYPE _ACS37800/RFID_CONTROL/Inc" -I"D:/Ofis-Pc/Firmware_List/DAP_SC_AC_22KW_SIMPLE _HVB_TYPE _ACS37800/MENU/Inc" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/system_stm32f4xx.d" -MT"Core/Src/system_stm32f4xx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/system_stm32f4xx.o"
In file included from ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h:173,
                 from ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:140,
                 from ../Core/Src/system_stm32f4xx.c:48:
../Core/Src/system_stm32f4xx.c: In function 'SystemInit':
../Drivers/CMSIS/Include/core_cm4.h:1560:29: error: missing binary operator before token "("
 1560 | #define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct */
      |                             ^
../Core/Src/system_stm32f4xx.c:170:52: note: in expansion of macro 'SCB'
  170 |   #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */
      |                                                    ^~~
make[1]: *** [Core/Src/subdir.mk:34: Core/Src/system_stm32f4xx.o] Error 1
make: *** [makefile:67: all] Error 2
"make -j16 all" terminated with exit code 2. Build might be incomplete.

Right. So it tells you where the actual error occurs:

 

 

../Core/Src/system_stm32f4xx.c:170:52: note: in expansion of macro 'SCB'
  170 |   #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */
      |                                                    ^~~

 

 

In the notation "../Core/Src/system_stm32f4xx.c:170:52"

  • ../Core/Src/system_stm32f4xx.c is the full path name of the file where the error was found;
  • 170 is the line number within that file;
  • 52 is the character position (or "column") along that line (counting from the left).

The message then quotes that line from the source file;

Note how the " ^~~" in the following line of the message points at the error position.

The error is that the  SCB->CPACR cannot simply follow the (__FPU_USED == 1) as it does in that line:

AndrewNeil_0-1726134507068.png

 

It looks like you have "lost" a line break, and the code should be:

 

 

 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */

 

#HowToReadGccErrorMessage

 

Thank you, it really worked.