Skip to content

Commit

Permalink
Merge pull request google#6326 from ejparkqc:master
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 627787787
  • Loading branch information
xnnpack-bot committed Apr 24, 2024
2 parents 8637b70 + bc07173 commit 78f8763
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions cmake/hexagon.toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SET(CMAKE_CROSSCOMPILING TRUE)

# For compatibility with with CMake toolchain from Hexagon SDK
SET(HEXAGON TRUE)
SET(HEXAGON_ARCH v66)
SET(HEXAGON_ARCH v68)

# This is configured for Hexagon SDK 5.3.0.0
IF(NOT DEFINED ENV{HEXAGON_SDK_ROOT})
Expand All @@ -28,7 +28,7 @@ SET(HEXAGON_SIM "$ENV{HEXAGON_TOOLS_ROOT}/bin/hexagon-sim")
SET(CMAKE_FIND_ROOT_PATH "$ENV{HEXAGON_TOOLS_ROOT}/target/hexagon")
SET(CMAKE_PREFIX_PATH "$ENV{HEXAGON_TOOLS_ROOT}/target/hexagon")
SET(CMAKE_INCLUDE_PATH "$ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/include")
SET(CMAKE_LIBRARY_PATH "$ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66")
SET(CMAKE_LIBRARY_PATH "$ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68")
SET(CMAKE_PROGRAM_PATH "$ENV{HEXAGON_TOOLS_ROOT}/bin")

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand All @@ -39,25 +39,25 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
SET(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES
"$ENV{HEXAGON_SDK_ROOT}/incs"
"$ENV{HEXAGON_SDK_ROOT}/incs/stddef"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/qurt"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/posix")
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/include"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/include/qurt"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/include/posix")

SET(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
"$ENV{HEXAGON_SDK_ROOT}/incs"
"$ENV{HEXAGON_SDK_ROOT}/incs/stddef"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/qurt"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/posix")
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/include"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/include/qurt"
"$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/include/posix")

SET(HEXAGON_C_LINK_EXECUTABLE_LINK_OPTIONS "-mv66 -g -nostdlib --section-start .interp=0x23000000 --dynamic-linker= --force-dynamic -E -z muldefs --whole-archive -o <TARGET> --start-group $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/init.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/crt1.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/debugmon.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/libqurt.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/libc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/libqcc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/libhexagon.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/libqurtcfs.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/libtimer.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/libposix.a <OBJECTS> <LINK_LIBRARIES> $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/fini.o --end-group")
SET(HEXAGON_CXX_LINK_EXECUTABLE_LINK_OPTIONS "-mv66 -g -nostdlib --section-start .interp=0x23000000 --dynamic-linker= --force-dynamic -E -z muldefs --whole-archive -o <TARGET> --start-group $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/init.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/crt1.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/debugmon.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/libqurt.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/libc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/libqcc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/libhexagon.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/libqurtcfs.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/pic/libtimer.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/lib/libposix.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/libc++.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/libc++abi.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/libc_eh.a <OBJECTS> <LINK_LIBRARIES> $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v66/G0/fini.o --end-group")
SET(HEXAGON_C_LINK_EXECUTABLE_LINK_OPTIONS "-mv68 -g -nostdlib --section-start .interp=0x23000000 --dynamic-linker= --force-dynamic -E -z muldefs --whole-archive -o <TARGET> --start-group $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/init.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/crt1.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/debugmon.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/libqurt.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/libc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/libqcc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/libhexagon.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/libqurtcfs.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/libtimer.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/libposix.a <OBJECTS> <LINK_LIBRARIES> $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/fini.o --end-group")
SET(HEXAGON_CXX_LINK_EXECUTABLE_LINK_OPTIONS "-mv68 -g -nostdlib --section-start .interp=0x23000000 --dynamic-linker= --force-dynamic -E -z muldefs --whole-archive -o <TARGET> --start-group $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/init.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/crt1.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/debugmon.o $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/libqurt.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/libc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/libqcc.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/libhexagon.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/libqurtcfs.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/pic/libtimer.a $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/lib/libposix.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/libc++.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/libc++abi.a $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/libc_eh.a <OBJECTS> <LINK_LIBRARIES> $ENV{HEXAGON_TOOLS_ROOT}/target/hexagon/lib/v68/G0/fini.o --end-group")

SET(CMAKE_C_LINK_EXECUTABLE "${HEXAGON_LINK} ${HEXAGON_C_LINK_EXECUTABLE_LINK_OPTIONS}")
SET(CMAKE_CXX_LINK_EXECUTABLE "${HEXAGON_LINK} ${HEXAGON_CXX_LINK_EXECUTABLE_LINK_OPTIONS}")

ADD_COMPILE_OPTIONS(-O2)
ADD_COMPILE_OPTIONS(-mv66)
ADD_COMPILE_OPTIONS(-mv68)

SET(CMAKE_THREAD_LIBS_INIT "" CACHE STRING "")
SET(CMAKE_HAVE_THREADS_LIBRARY TRUE)
Expand All @@ -67,14 +67,14 @@ SET(THREADS_PREFER_PTHREAD_FLAG FALSE)
SET(Threads_FOUND TRUE CACHE BOOL "")

# Setup Hexagon simulator
SET(HEXAGON_SIM_OSAM_CONTENT "$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/debugger/lnx64/qurt_model.so")
SET(HEXAGON_SIM_OSAM_CONTENT "$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/debugger/lnx64/qurt_model.so")
SET(HEXAGON_SIM_Q6SS_CONTENT
"$ENV{HEXAGON_TOOLS_ROOT}/lib/iss/qtimer.so --csr_base=0xFC900000 --irq_p=1 --freq=19200000 --cnttid=1
$ENV{HEXAGON_TOOLS_ROOT}/lib/iss/l2vic.so 32 0xFC910000")

SET(HEXAGON_SIMRUN_CONTENT
"#!/bin/sh
${HEXAGON_SIM} -mv66g_1024 --quiet --simulated_returnval --usefs ${CMAKE_CURRENT_BINARY_DIR} --pmu_statsfile ${CMAKE_CURRENT_BINARY_DIR}/pmu_stats.txt --cosim_file ${CMAKE_BINARY_DIR}/q6ss.cfg --l2tcm_base 0xd800 --rtos ${CMAKE_BINARY_DIR}/osam.cfg $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/sdksim_bin/runelf.pbn -- $@")
${HEXAGON_SIM} -mv68 --quiet --simulated_returnval --usefs ${CMAKE_CURRENT_BINARY_DIR} --pmu_statsfile ${CMAKE_CURRENT_BINARY_DIR}/pmu_stats.txt --cosim_file ${CMAKE_BINARY_DIR}/q6ss.cfg --l2tcm_base 0xd800 --rtos ${CMAKE_BINARY_DIR}/osam.cfg $ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/sdksim_bin/runelf.pbn -- $@")


FILE(WRITE "${CMAKE_BINARY_DIR}/osam.cfg" "${HEXAGON_SIM_OSAM_CONTENT}")
Expand All @@ -84,4 +84,4 @@ FILE(TOUCH "${CMAKE_BINARY_DIR}/simrun")
FILE(CHMOD "${CMAKE_BINARY_DIR}/simrun" FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ WORLD_READ)
FILE(WRITE "${CMAKE_BINARY_DIR}/simrun" "${HEXAGON_SIMRUN_CONTENT}")

SET(CMAKE_CROSSCOMPILING_EMULATOR "${HEXAGON_SIM}" "-mv66g_1024" "--quiet" "--simulated_returnval" "--usefs" "${CMAKE_CURRENT_BINARY_DIR}" "--pmu_statsfile" "${CMAKE_CURRENT_BINARY_DIR}/pmu_stats.txt" "--cosim_file" "${CMAKE_BINARY_DIR}/q6ss.cfg" "--l2tcm_base" "0xd800" "--rtos" "${CMAKE_BINARY_DIR}/osam.cfg" "$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev66/sdksim_bin/runelf.pbn" "--")
SET(CMAKE_CROSSCOMPILING_EMULATOR "${HEXAGON_SIM}" "-mv68" "--quiet" "--simulated_returnval" "--usefs" "${CMAKE_CURRENT_BINARY_DIR}" "--pmu_statsfile" "${CMAKE_CURRENT_BINARY_DIR}/pmu_stats.txt" "--cosim_file" "${CMAKE_BINARY_DIR}/q6ss.cfg" "--l2tcm_base" "0xd800" "--rtos" "${CMAKE_BINARY_DIR}/osam.cfg" "$ENV{HEXAGON_SDK_ROOT}/rtos/qurt/computev68/sdksim_bin/runelf.pbn" "--")
4 changes: 2 additions & 2 deletions scripts/build-qurt-v66.sh → scripts/build-qurt-v68.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -e

mkdir -p build/qurt/v66
mkdir -p build/qurt/v68

CMAKE_ARGS=()

Expand All @@ -29,7 +29,7 @@ CMAKE_ARGS+=("-DHAVE_STEADY_CLOCK=0")
# Use-specified CMake arguments go last to allow overridding defaults
CMAKE_ARGS+=($@)

cd build/qurt/v66 && cmake ../../.. \
cd build/qurt/v68 && cmake ../../.. \
"${CMAKE_ARGS[@]}"

cmake --build . -- "-j$((2*$(nproc)))"

0 comments on commit 78f8763

Please sign in to comment.