0
在此之前,我嘗試IDE Keil和她的工作,但作爲IDE它是可怕的。 因此,我試圖使用CLion 2016.3爲Ubuntu 16.04上的STM32L100RCx目標構建嵌入式C++項目。但我不能解開如何正確設置。閱讀Jetbrain的博客並不能幫助我。編譯後有一些錯誤,它無法從* .ld文件中找到某個調用。 cmake的標誌:Clion + STM32L1xx - 如何設置
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}")
你使用正確的交叉編譯器嗎?您是否[正確設置了工具鏈](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html)? –
感謝您的鏈接,我會稍後閱讀。 – Sergey
我假設你在'CmakeForceCompiler.cmake'文件中設置了'COMMON_FLAGS'?否則,它是未設置和空的。並且您將'CMAKE_C_FLAGS'多次設置爲不同的值。 –