aocpu: add pre-build for link file. [1/2]
PD#SWPL-140804
Problem:
link file do not support preprocess.
Solution:
add pre-build for link file.
Verify:
N/A
Change-Id: I2db1bdc5533b73843e01b00a1c7c254901190842
Signed-off-by: shijie.xiong <shijie.xiong@amlogic.com>
diff --git a/cmake/root.cmake b/cmake/root.cmake
index 03a3d18..33803b9 100755
--- a/cmake/root.cmake
+++ b/cmake/root.cmake
@@ -135,6 +135,7 @@
-T"${BOARD_DIR}/lscript.ld"
)
elseif(CONFIG_RISCV)
+add_custom_command(TARGET ${TARGET_NAME} PRE_BUILD COMMAND ${CMAKE_C_COMPILER} -I ${BOARD_DIR} -E -xc -P ${BOARD_DIR}/lscript.ld > ${BOARD_DIR}/lscript)
target_link_libraries(
${TARGET_NAME}
-Wl,--start-group
@@ -142,7 +143,7 @@
${COLLECT_LINK_OBJS}
${SYSTEM_LIBS} ${COLLECT_LINK_LIBRARIES}
-Wl,--end-group
- -T"${BOARD_DIR}/lscript.ld"
+ -T"${BOARD_DIR}/lscript"
)
endif()