在此之前我尝试过IDE Keil并且她工作但是作为IDE它很可怕。 因此,我尝试使用CLion 2016.3在Ubuntu 16.04上为STM32L100RCx目标构建嵌入式C ++项目。但我无法理解如何正确设置。阅读Jetbrain的博客对我没有帮助。编译后有一些错误,它无法从* .ld文件中找到一些调用。 Cmake标志:
SET(CMAKE_C_FLAGS "-mcpu=cortex-m3 -mthumb" "-msoft-float -mfix-cortex-m3-ldrd")
出错了:
/tmp/ccPo0ceQ.s:713: Error: selected processor does not support `dsb 0xF' in ARM mode
/tmp/ccPo0ceQ.s:734: Error: selected processor does not support `dsb 0xF' in ARM mode
/tmp/ccPo0ceQ.s:1100: Error: selected processor does not support `dsb 0xF' in ARM mode
/tmp/ccPo0ceQ.s:1111: Error: selected processor does not support `isb 0xF' in ARM mode
/tmp/ccPo0ceQ.s:1157: Error: selected processor does not support `dmb 0xF' in ARM mode
*** recipe for target 'CMakeFiles/Project.elf.dir/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_cortex.c.obj' failed
任何人都可以帮助我,或者可以让我使用CMakeLists.txt和* .cmake文件吗?
UPD:
我的Cmake文件:
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
CMAKE_FORCE_C_COMPILER(/opt/arm/bin/arm-none-eabi-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(/opt/arm/bin/arm-none-eabi-g++ GNU)
SET(CMAKE_C_FLAGS "-mcpu=cortex-m3 -mthumb" "-msoft-float -mfix-cortex-m3-ldrd")
# fix long strings (CMake appends semicolons)
string(REGEX REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32L100RCTx_FLASH.ld)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections -T ${LINKER_SCRIPT}")
答案 0 :(得分:0)
我似乎找到了正确的方法。 我错误的行动顺序:
我认为'重置缓存和重新加载项目'只是清理Cmake缓存,但事实上它看起来好像正在删除一些必要的文件。
序列是正确的:
一般情况下,只需检查“在编辑时自动重新加载Cmake项目”选项即可。