adds cmake for coremark
This commit is contained in:
parent
1629b165b5
commit
75ba2e7588
@ -1,8 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.21)
|
||||||
project(coremark C)
|
project(coremark C)
|
||||||
|
set(TARGET coremark)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
|
||||||
|
|
||||||
# Include BSP libwrap
|
|
||||||
include(${BSP_BASE}/libwrap/CMakeLists.txt)
|
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
@ -16,51 +17,20 @@ set(SOURCES
|
|||||||
cm/core_util.c
|
cm/core_util.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Create executable
|
# Create executable
|
||||||
add_executable(coremark ${SOURCES})
|
add_executable(coremark ${SOURCES})
|
||||||
|
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/cm)
|
||||||
|
target_compile_options(${TARGET} PRIVATE -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -fno-common -funroll-loops -finline-functions -falign-functions=16 -falign-jumps=4 -falign-loops=4 -finline-limit=1000 -fno-if-conversion2 -fselective-scheduling -fno-crossjumping -freorder-blocks-and-partition -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -fno-common -funroll-loops -finline-functions -falign-functions=16 -falign-jumps=4 -falign-loops=4 -finline-limit=1000 -fno-if-conversion2 -fselective-scheduling -fno-crossjumping -freorder-blocks-and-partition )
|
||||||
|
target_compile_definitions(${TARGET} PRIVATE PERFORMANCE_RUN=1 CLOCKS_PER_SEC=10000000 FLAGS_STR="" PERFORMANCE_RUN=1 CLOCKS_PER_SEC=10000000 ITERATIONS=600)
|
||||||
|
|
||||||
# Include directories
|
set(BOARD "iss" CACHE STRING "Target board")
|
||||||
target_include_directories(coremark PRIVATE
|
add_subdirectory(../../bare-metal-bsp bsp)
|
||||||
${BSP_BASE}/include
|
target_link_libraries(${TARGET} PRIVATE bsp)
|
||||||
${BSP_BASE}/drivers
|
|
||||||
${BSP_BASE}/env
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cm
|
|
||||||
)
|
|
||||||
|
|
||||||
# Link with libwrap
|
include(CMakePrintHelpers)
|
||||||
target_link_libraries(coremark PRIVATE
|
cmake_print_properties(TARGETS ${TARGET} PROPERTIES COMPILE_DEFINITIONS COMPILE_OPTIONS LINK_OPTIONS INTERFACE_LINK_OPTIONS)
|
||||||
LIBWRAP_TGC
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add compile definitions
|
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||||
target_compile_definitions(coremark PRIVATE
|
COMMAND ${CMAKE_OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
|
||||||
BOARD_${BOARD}
|
COMMENT "Creating disassembly for ${TARGET}")
|
||||||
PERFORMANCE_RUN=1
|
|
||||||
ITERATIONS=1000
|
|
||||||
COMPILER_FLAGS="${CMAKE_C_FLAGS}"
|
|
||||||
COMPILER_VERSION="${CMAKE_C_COMPILER_VERSION}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set compile options
|
|
||||||
target_compile_options(coremark PRIVATE
|
|
||||||
-march=${RISCV_ARCH}_zicsr_zifencei
|
|
||||||
-mabi=${RISCV_ABI}
|
|
||||||
-mcmodel=medany
|
|
||||||
-ffunction-sections
|
|
||||||
-fdata-sections
|
|
||||||
-O2 # Optimization level for benchmarking
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set linker options
|
|
||||||
target_link_options(coremark PRIVATE
|
|
||||||
-T${BSP_BASE}/env/${BOARD}/link.ld
|
|
||||||
-nostartfiles
|
|
||||||
-Wl,--gc-sections
|
|
||||||
${LIBWRAP_TGC_LDFLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install target
|
|
||||||
install(TARGETS coremark
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user