2024-09-11 07:35 AM
Hello, I encountered such an error while working on my software and I cannot solve this error. Can you help me with this issue?
Solved! Go to Solution.
2024-09-12 02:49 AM - edited 2024-09-12 02:50 AM
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"
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:
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
2024-09-11 07:52 AM
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
2024-09-11 07:53 AM - edited 2024-09-11 07:56 AM
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:
The messages in the 'Console' tab should give a better indication of where the actual error is - please also post that source code.
2024-09-11 10:03 PM
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.
2024-09-12 02:49 AM - edited 2024-09-12 02:50 AM
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"
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:
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
2024-09-12 03:11 AM
Thank you, it really worked.
2024-09-12 03:19 AM
You're welcome - please mark the solution: