updates dhrystone build
This commit is contained in:
parent
85304d1a43
commit
cde5ae627c
@ -1,58 +1,21 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.21)
|
||||||
project(dhrystone C)
|
project(dhrystone C)
|
||||||
|
set(TARGET dhrystone)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
set(ITERATIONS 50000) # 20000 for TGC
|
||||||
|
|
||||||
# Include BSP libwrap
|
add_executable(${TARGET} dhry_1.c dhry_2.c dhry_stubs.c)
|
||||||
include(${BSP_BASE}/libwrap/CMakeLists.txt)
|
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
target_compile_options(${TARGET} PRIVATE -fno-inline -fno-builtin-printf -fno-common -Wno-implicit -funroll-loops -fpeel-loops -fgcse-sm -fgcse-las)
|
||||||
|
target_compile_definitions(${TARGET} PRIVATE ITERATIONS=${ITERATIONS} HZ=32768 TIME NO_INIT)
|
||||||
|
|
||||||
# Source files
|
set(BOARD "iss" CACHE STRING "Target board")
|
||||||
set(SOURCES
|
add_subdirectory(../../bare-metal-bsp bsp)
|
||||||
dhry_1.c
|
target_link_libraries(${TARGET} PRIVATE bsp)
|
||||||
dhry_2.c
|
target_link_options(${TARGET} PRIVATE LINKER:--wrap=scanf)
|
||||||
dhry_stubs.c
|
include(CMakePrintHelpers)
|
||||||
)
|
cmake_print_properties(TARGETS ${TARGET} PROPERTIES COMPILE_DEFINITIONS COMPILE_OPTIONS LINK_OPTIONS INTERFACE_LINK_OPTIONS)
|
||||||
|
|
||||||
# Create executable
|
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||||
add_executable(dhrystone ${SOURCES})
|
COMMAND ${CMAKE_OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
|
||||||
|
COMMENT "Creating disassembly for ${TARGET}")
|
||||||
# Include directories
|
|
||||||
target_include_directories(dhrystone PRIVATE
|
|
||||||
${BSP_BASE}/include
|
|
||||||
${BSP_BASE}/drivers
|
|
||||||
${BSP_BASE}/env
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Link with libwrap
|
|
||||||
target_link_libraries(dhrystone PRIVATE
|
|
||||||
LIBWRAP_TGC
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add compile definitions
|
|
||||||
target_compile_definitions(dhrystone PRIVATE
|
|
||||||
BOARD_${BOARD}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set compile options
|
|
||||||
target_compile_options(dhrystone PRIVATE
|
|
||||||
-march=${RISCV_ARCH}_zicsr_zifencei
|
|
||||||
-mabi=${RISCV_ABI}
|
|
||||||
-mcmodel=medany
|
|
||||||
-ffunction-sections
|
|
||||||
-fdata-sections
|
|
||||||
-O2 # Optimization level for benchmarking
|
|
||||||
-DTIME # Enable time measurement
|
|
||||||
-DNOENUM # Disable enum usage as per dhrystone requirements
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set linker options
|
|
||||||
target_link_options(dhrystone PRIVATE
|
|
||||||
-T${BSP_BASE}/env/${BOARD}/link.ld
|
|
||||||
-nostartfiles
|
|
||||||
-Wl,--gc-sections
|
|
||||||
${LIBWRAP_TGC_LDFLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install target
|
|
||||||
install(TARGETS dhrystone
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
|
@ -17,6 +17,7 @@ endif
|
|||||||
# '-lgcc -lm' are needed to add softfloat routines
|
# '-lgcc -lm' are needed to add softfloat routines
|
||||||
CFLAGS := -g -O3 -DITERATIONS=$(ITERATIONS) -DHZ=32768 -DTIME -DNO_INIT -fno-inline -fno-builtin-printf -fno-common -Wno-implicit \
|
CFLAGS := -g -O3 -DITERATIONS=$(ITERATIONS) -DHZ=32768 -DTIME -DNO_INIT -fno-inline -fno-builtin-printf -fno-common -Wno-implicit \
|
||||||
-funroll-loops -fpeel-loops -fgcse-sm -fgcse-las
|
-funroll-loops -fpeel-loops -fgcse-sm -fgcse-las
|
||||||
|
LDFLAGS := -Wl,--wrap=scanf
|
||||||
|
|
||||||
TOOL_DIR=$(dir $(compiler))
|
TOOL_DIR=$(dir $(compiler))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user