aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09a39d9..792547f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
include(cmake/fiddle.cmake)
-project (ch537)
+project (ch537 LANGUAGES C ASM)
# Configure for Bare Metal.
set(CMAKE_SYSTEM_NAME Generic)
@@ -12,9 +12,11 @@ set(CMAKE_SYSTEM_PROCESSOR riscv32)
set(TC_PREFIX riscv32-unknown-elf-)
include_directories(include linker ${CMAKE_BINARY_DIR}/generated/fdl)
-file(GLOB SOURCES "src/*.c" "src/*.s")
+file(GLOB_RECURSE SOURCES "src/*.c" "src/*.s")
file(GLOB LINKER_SCRIPT "linker/*.ld")
+message("Sources ${SOURCES}")
+
file(REAL_PATH "ch-flash/" CH_FLASH_DIR)
# Set compiler and tools
@@ -24,7 +26,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set compiler and linker flags
-set(CMAKE_C_FLAGS "-ffreestanding -march=rv32imac -mabi=ilp32 -lgcc -static -nostartfiles -O -std=gnu99" CACHE INTERNAL "C Compiler options")
+set(CMAKE_C_FLAGS "-ffreestanding -march=rv32imac_zicsr -mabi=ilp32 -lgcc -static -nostartfiles -O -std=gnu99" CACHE INTERNAL "C Compiler options")
+set(CMAKE_ASM_FLAGS "-ffreestanding -march=rv32imac_zicsr -mabi=ilp32 -lgcc -static -nostartfiles -O -std=gnu99" CACHE INTERNAL "C Compiler options")
set(CMAKE_EXE_LINKER_FLAGS "--xref -static -T ${LINKER_SCRIPT}" CACHE INTERNAL "Linker options")
# Add executable with custom linking commands