File tree 2 files changed +46
-2
lines changed
2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change
1
+
2
+
1
3
idf_component_register(
2
4
SRCS "Dummy.c"
3
5
INCLUDE_DIRS "."
4
6
)
5
7
8
+ idf_build_get_property(target IDF_TARGET)
9
+ idf_build_get_property(arch IDF_TARGET_ARCH)
10
+
11
+ if ("${arch} " STREQUAL "xtensa" )
12
+ message (FATAL_ERROR "Not supported target: ${target} " )
13
+ endif ()
14
+
15
+ if (${target} STREQUAL "esp32c2" OR ${target} STREQUAL "esp32c3" )
16
+ set (march_flag "rv32imc_zicsr_zifencei" )
17
+ set (mabi_flag "ilp32" )
18
+ elseif (${target} STREQUAL "esp32p4" )
19
+ set (march_flag "rv32imafc_zicsr_zifencei" )
20
+ set (mabi_flag "ilp32f" )
21
+ else ()
22
+ set (march_flag "rv32imac_zicsr_zifencei" )
23
+ set (mabi_flag "ilp32" )
24
+ endif ()
25
+
6
26
execute_process (COMMAND xcrun -f swiftc OUTPUT_VARIABLE SWIFTC OUTPUT_STRIP_TRAILING_WHITESPACE)
7
27
8
28
add_custom_command (
9
29
OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /_swiftcode.o
10
30
COMMAND
11
31
${SWIFTC}
12
32
-target riscv32-none-none-eabi
13
- -Xfrontend -function-sections -enable-experimental-feature Embedded -wmo -parse-as-library -Osize
33
+ -Xfrontend -function-sections -enable-experimental-feature Embedded -static -wmo -parse-as-library -Osize
34
+ -Xcc -march=${march_flag} -Xcc -mabi=${mabi_flag}
35
+ -Xlinker -march=${march_flag} -Xlinker -mabi=${mabi_flag}
14
36
$$\( echo '$<TARGET_PROPERTY:__idf_main,INCLUDE_DIRECTORIES >' | tr '\;' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \)
15
37
$$\( echo '${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ' | tr ' ' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \)
16
38
-import-bridging-header ${CMAKE_CURRENT_LIST_DIR} /BridgingHeader.h
Original file line number Diff line number Diff line change
1
+
2
+
1
3
idf_component_register(
2
4
SRCS "Dummy.c"
3
5
INCLUDE_DIRS "."
4
6
)
5
7
8
+ idf_build_get_property(target IDF_TARGET)
9
+ idf_build_get_property(arch IDF_TARGET_ARCH)
10
+
11
+ if ("${arch} " STREQUAL "xtensa" )
12
+ message (FATAL_ERROR "Not supported target: ${target} " )
13
+ endif ()
14
+
15
+ if (${target} STREQUAL "esp32c2" OR ${target} STREQUAL "esp32c3" )
16
+ set (march_flag "rv32imc_zicsr_zifencei" )
17
+ set (mabi_flag "ilp32" )
18
+ elseif (${target} STREQUAL "esp32p4" )
19
+ set (march_flag "rv32imafc_zicsr_zifencei" )
20
+ set (mabi_flag "ilp32f" )
21
+ else ()
22
+ set (march_flag "rv32imac_zicsr_zifencei" )
23
+ set (mabi_flag "ilp32" )
24
+ endif ()
25
+
6
26
execute_process (COMMAND xcrun -f swiftc OUTPUT_VARIABLE SWIFTC OUTPUT_STRIP_TRAILING_WHITESPACE)
7
27
8
28
add_custom_command (
9
29
OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /_swiftcode.o
10
30
COMMAND
11
31
${SWIFTC}
12
32
-target riscv32-none-none-eabi
13
- -Xfrontend -function-sections -enable-experimental-feature Embedded -wmo -parse-as-library -Osize
33
+ -Xfrontend -function-sections -enable-experimental-feature Embedded -static -wmo -parse-as-library -Osize
34
+ -Xcc -march=${march_flag} -Xcc -mabi=${mabi_flag}
35
+ -Xlinker -march=${march_flag} -Xlinker -mabi=${mabi_flag}
14
36
$$\( echo '$<TARGET_PROPERTY:__idf_main,INCLUDE_DIRECTORIES >' | tr '\;' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \)
15
37
$$\( echo '${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ' | tr ' ' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \)
16
38
-import-bridging-header ${CMAKE_CURRENT_LIST_DIR} /BridgingHeader.h
You can’t perform that action at this time.
0 commit comments