Skip to content

Commit 7c95d9b

Browse files
committed
force clang asm with -x assembler-with-cpp
1 parent bde4499 commit 7c95d9b

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

examples/build_system/cmake/toolchain/arm_clang.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ if (NOT DEFINED CMAKE_CXX_COMPILER)
77
endif ()
88

99
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
10+
set(TOOLCHAIN_ASM_FLAGS "-x assembler-with-cpp")
11+
1012
find_program(CMAKE_SIZE llvm-size)
1113
find_program(CMAKE_OBJCOPY llvm-objcopy)
1214
find_program(CMAKE_OBJDUMP llvm-objdump)

examples/build_system/cmake/toolchain/common.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang")
3232
-Wl,--gc-sections
3333
-Wl,--cref
3434
)
35-
3635
elseif (TOOLCHAIN STREQUAL "iar")
3736
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
3837
--diag_suppress=Li065
@@ -48,5 +47,10 @@ foreach (LANG IN ITEMS C CXX ASM)
4847
#set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
4948
endforeach ()
5049

50+
# Assembler
51+
if (DEFINED TOOLCHAIN_ASM_FLAGS)
52+
set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} ${TOOLCHAIN_ASM_FLAGS}")
53+
endif ()
54+
5155
# Linker
5256
list(JOIN TOOLCHAIN_EXE_LINKER_FLAGS " " CMAKE_EXE_LINKER_FLAGS_INIT)

hw/bsp/ch32v10x/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function(family_add_board BOARD_TARGET)
4848
update_board(${BOARD_TARGET})
4949

5050
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
51-
target_compile_options(${TARGET} PUBLIC -mcmodel=medany)
51+
target_compile_options(${BOARD_TARGET} PUBLIC -mcmodel=medany)
5252
endif()
5353
endfunction()
5454

hw/bsp/lpc11/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function(family_configure_example TARGET RTOS)
7979
--specs=nosys.specs --specs=nano.specs
8080
)
8181
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
82-
target_link_options(${BOARD_TARGET} PUBLIC
82+
target_link_options(${TARGET} PUBLIC
8383
"LINKER:--script=${LD_FILE_GNU}"
8484
)
8585
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")

0 commit comments

Comments
 (0)