Sysprogs forums › Forums › VisualGDB › CMake STM32 C++
- This topic has 3 replies, 2 voices, and was last updated 3 years, 9 months ago by support.
-
AuthorPosts
-
February 11, 2021 at 15:04 #29902zhukowskiParticipant
I decided to try CMake for STM32. My project uses C ++ files. I define -frtti in the settings, but visualgdb seems to override this setting.
n cmakelist I tried to describe the parameters:
set_property(TARGET Card-SW PROPERTY CXX_STANDARD 17)
set_property(TARGET Card-SW PROPERTY C_STANDARD 11)
target_compile_options(Card-SW PRIVATE -frtti)
target_compile_options(Card-SW PRIVATE -fexceptions)set(CMAKE_C_COMPILER “arm-none-eabi-gcc.exe”)
set(CMAKE_CXX_COMPILER “arm-none-eabi-g++.exe”)SET(CMAKE_CXX_FLAGS ” -mthumb -mcpu=cortex-m4 -fno-builtin -Wall -std=gnu++0x -fdata-sections -ffunction-sections -frtti -fexceptions” CACHE INTERNAL “cxx compiler flags”)
set(CMAKE_EXE_LINKER_FLAGS “–specs=nosys.specs” CACHE INTERNAL “”)
string(REGEX REPLACE “-fno-exceptions” “” CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -fexceptions”)The result is still like this
c:\PROGRA~2\Sysprogs\VISUAL~1/ninja.exe CMakeFiles/Card-SW.dir/High-Level/Hardware/CanManager.cpp.obj
[1/1] Building CXX object CMakeFiles/Card-SW.dir/High-Level/Hardware/CanManager.cpp.obj
FAILED: CMakeFiles/Card-SW.dir/High-Level/Hardware/CanManager.cpp.obj
arm-none-eabi-g++.exe -DARM_MATH_CM4 -DDEBUG=1 -DFAST_SEMIHOSTING_BLOCKING_MODE=1 -DFAST_SEMIHOSTING_BUFFER_SIZE=4096 -DFAST_SEMIHOSTING_PROFILER_DRIVER=1 -DFAST_SEMIHOSTING_STDIO_DRIVER=1 -DPROFILER_STM32G4 -DSTM32G474VE -DSTM32G474xx -DSYSPROGS_PROFILER_DEBUGGER_CHECK_MODE=1 -DUSE_FREERTOS -DUSE_FREERTOS_IF_FOUND -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -Dflash_layout -I../../../High-Level -I../../../Low-Level/Core/Inc -I../../../Library/etl/include -I../../../. -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/FreeRTOS/Source/CMSIS_RTOS_V2 -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/FreeRTOS/Source/Include -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/FreeRTOS/Source/Portable/gcc/ARM_CM4F -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/STM32G4xxxx/STM32G4xx_HAL_Driver/Inc -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/STM32G4xxxx/STM32G4xx_HAL_Driver/Inc/Legacy -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/STM32G4xxxx/CMSIS_HAL/Core/Include -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/STM32G4xxxx/CMSIS_HAL/Device/ST/STM32G4xx/Include -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/STM32G4xxxx/CMSIS_HAL/Include -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/2021.02/STM32G4xxxx/CMSIS_HAL/RTOS2/Include -IC:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedEFPs/Profiler -mthumb -mcpu=cortex-m4 -fno-builtin -Wall -std=gnu++0x -fdata-sections -ffunction-sections -frtti -fexceptions -fexceptions -g3 -O0 -frtti -fexceptions -fno-exceptions –fno-rtti -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -include C:/Users/Andrei/AppData/Local/VisualGDB/EmbeddedEFPs/Profiler/ProfilerFreeRTOSHooks.h -std=gnu++17 -MD -MT CMakeFiles/Card-SW.dir/High-Level/Hardware/CanManager.cpp.obj -MF CMakeFiles\Card-SW.dir\High-Level\Hardware\CanManager.cpp.obj.d -o CMakeFiles/Card-SW.dir/High-Level/Hardware/CanManager.cpp.obj -c ../../../High-Level/Hardware/CanManager.cpp
In file included from ../../../High-Level/Hardware/CanManager.hpp:2,
from ../../../High-Level/Hardware/CanManager.cpp:1:
../../../High-Level/Core\Messenger.h: In member function ‘void Messenger::Register(IMessageReceiver*)’:
../../../High-Level/Core\Messenger.h:22:42: error: cannot use ‘typeid’ with ‘-fno-rtti’
22 | auto iterator = actions_.find(typeid(T));
| ^
../../../High-Level/Core\Messenger.h:31:86: error: cannot use ‘typeid’ with ‘-fno-rtti’
31 | actions_.insert(std::pair<std::type_index, std::list<IMessageReceiver*>>(typeid(T), list));February 11, 2021 at 15:15 #29903supportKeymasterHi,
Please refer to this page for a detailed overview of various Embedded CMake settings, including exceptions/RTTI.
February 12, 2021 at 05:12 #29904zhukowskiParticipantYes. Happened. Saw the ENABLE_EXCEPTIONS and ENABLE_RTTI lines being added to find_bsp.
The next question is how to properly configure the DEBUG and RELEASE configurations separatelyFebruary 12, 2021 at 07:05 #29909supportKeymasterHi,
There is no special VisualGDB GUI for configuration-specific CMake properties, however you easily achieve this by wrapping the relevant parts of the CMakeLists file in conditional statements checking the CMAKE_BUILD_TYPE variable.
-
AuthorPosts
- You must be logged in to reply to this topic.