From 0df111f945b10c8f11234a021279e63ed6502ffe Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Fri, 14 Jun 2024 10:11:30 +0200 Subject: [PATCH] cleans up CMakeLists --- CMakeLists.txt | 6 +-- semihosting_test/CMakeLists.txt | 91 --------------------------------- semihosting_test/test.c | 21 -------- 3 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 semihosting_test/CMakeLists.txt delete mode 100644 semihosting_test/test.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 824bae2..c2d2fbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,14 +6,14 @@ if (NOT DEFINED ISA) endif() message(STATUS "Building firmware using ${BOARD} board configuration") add_custom_target(fw-hello-world ALL - COMMAND make -C ${riscvfw_SOURCE_DIR}/hello-world BOARD=${BOARD} ISA=${ISA} + COMMAND make -C hello-world BOARD=${BOARD} ISA=${ISA} USES_TERMINAL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) add_custom_target(fw-dhrystone ALL - COMMAND make -C ${riscvfw_SOURCE_DIR}/benchmarks/dhrystone BOARD=${BOARD} ISA=${ISA} + COMMAND make -C benchmarks/dhrystone BOARD=${BOARD} ISA=${ISA} USES_TERMINAL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) add_custom_target(fw-coremark ALL - COMMAND make -C ${riscvfw_SOURCE_DIR}/benchmarks/coremark BOARD=${BOARD} ISA=${ISA} + COMMAND make -C benchmarks/coremark BOARD=${BOARD} ISA=${ISA} USES_TERMINAL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/semihosting_test/CMakeLists.txt b/semihosting_test/CMakeLists.txt deleted file mode 100644 index f40f9d7..0000000 --- a/semihosting_test/CMakeLists.txt +++ /dev/null @@ -1,91 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.13 FATAL_ERROR) - - - -SET(BOARD "iss" CACHE STRING "board to be compiled for") -OPTION(SEMIHOSTING "Enable Semihosting" ON) - -SET(RISCV_ARCH "rv32imc" CACHE STRING "arch") -SET(RISCV_ABI "ilp32" CACHE STRING "abi") - -EXECUTE_PROCESS( - COMMAND which riscv64-unknown-elf-gcc - OUTPUT_VARIABLE COMPILER - OUTPUT_STRIP_TRAILING_WHITESPACE) - -GET_FILENAME_COMPONENT(TOOL_DIR ${COMPILER} DIRECTORY) - -SET(TRIPLET "riscv64-unknown-elf") - -SET(CMAKE_C_COMPILER ${TOOL_DIR}/${TRIPLET}-gcc) -SET(CMAKE_CXX_COMPILER ${TOOL_DIR}/${TRIPLET}-g++) -SET(CMAKE_ASM_COMPILER ${TOOL_DIR}/${TRIPLET}-gcc) -SET(CMAKE_LINKER ${TOOL_DIR}/${TRIPLET}-ld) -SET(CMAKE_OBJCOPY ${TOOL_DIR}/${TRIPLET}-objcopy) -SET(CMAKE_AR ${TOOL_DIR}/${TRIPLET}-ar) - -PROJECT(semihosting_test) - -SET(BSP_BASE "../bare-metal-bsp") -SET(ENV_DIR ${BSP_BASE}/env) -SET(PLATFORM_DIR ${ENV_DIR}/${BOARD}) - -SET(SEMIHOSTING TRUE) - -INCLUDE(${BSP_BASE}/libwrap/CMakeLists.txt) - -INCLUDE_DIRECTORIES( - ${BSP_BASE}/include - ${BSP_BASE}/drivers - ${BSP_BASE}/libwrap/semihosting - ${PLATFORM_DIR} - ${ENV_DIR} -) - -# Source files -SET(ASM_SRCS - ${ENV_DIR}/entry.S - ${ENV_DIR}/start.S -) -SET(C_SRCS - ${PLATFORM_DIR}/init.c - test.c -) -SET_SOURCE_FILES_PROPERTIES(${ASM_SRCS} PROPERTIES LANGUAGE C) - -# Compiler Flags -SET(COMMON_FLAGS "") - -# GCC Version Check -EXECUTE_PROCESS( - COMMAND ${CMAKE_C_COMPILER} --version - OUTPUT_VARIABLE GCC_VERSION -) -IF(GCC_VERSION MATCHES "9.2") - LIST(APPEND COMMON_FLAGS "-march=${RISCV_ARCH}") -ELSE() - LIST(APPEND COMMON_FLAGS "-march=${RISCV_ARCH}_zicsr_zifencei") -ENDIF() -LIST(APPEND COMMON_FLAGS "-mabi=${RISCV_ABI}" "-mcmodel=medany" "-DBOARD_${BOARD}") - -# Compiler Options -ADD_COMPILE_OPTIONS("${COMMON_FLAGS}") -IF(SEMIHOSTING) -ADD_DEFINITIONS(-DSEMIHOSTING=1) -ELSE () -ADD_DEFINITIONS(-DSEMIHOSTING=0) -ENDIF() - -ADD_EXECUTABLE(${PROJECT_NAME} ${ASM_SRCS} ${C_SRCS} ${SRC_FILES}) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${LIBWRAP_TGC_LDFLAGS} LIBWRAP_TGC) - -# Linker Flags -TARGET_LINK_LIBRARIES(${PROJECT_NAME} - PUBLIC - -march=${RISCV_ARCH} -mabi=${RISCV_ABI} - -T../${PLATFORM_DIR}/link.lds #TODO Path - -Wl,-Map=${PROJECT_NAME}.map - -nostartfiles - -L${ENV_DIR} -) diff --git a/semihosting_test/test.c b/semihosting_test/test.c deleted file mode 100644 index 81e46f9..0000000 --- a/semihosting_test/test.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -#include "platform.h" -#include "encoding.h" -#include "semihosting.h" - -int main() -{ - char new[]="/scratch/gabriel/Documents/test_file"; - //puts(new); - //char buf[10]; - printf("TEST!!!"); - //int fh = open(new, 0, 0); - //unlink(new); - //read(fh, buf, 10); - //printf(buf); - //read(fh, buf, 10); - return 0; -}