如果要判断不同编译工具,怎么处理,特别是在嵌入式系统中,不同编译工具,对应的代码可能会有不一样。 #3647
niurenyige
started this conversation in
General
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
set(HC32F030_SDK_VER HC32F030_DDL_Rev1.3.1)
if(${CMAKE_C_COMPILER_ID} MATCHES "ARMCC")
#target_sources(mcu PRIVATE common/startup_hc32f005.c)
target_sources(mcu PRIVATE common/startup_hc32f030_armcc.s)
set(LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/common/armcc_hc32f030.sct)
else()
message(STATUS "GNU GCC COMPILER")
tos_compile_options(-mcpu=cortex-m0plus -mthumb)
tos_ld_options(-mcpu=cortex-m0plus -mthumb)
set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/common/gcc_hc32f030.ld")
tos_ld_options( "-Wl,--gc-sections -T ${LINKER_SCRIPT}")
endif()
这个是我以前用CMAKE 写的,想用XMAKE 来做。如果有is_toolchain("gcc") is_toolchain("armcc") 这样就好处理。
Beta Was this translation helpful? Give feedback.
All reactions