aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-14 02:19:09 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-11-14 02:19:09 -0700
commitd1ebd3bd806f4b4e1f74703f682ca64994c79a28 (patch)
tree248a6a35a3b7c5232bcdafe6a6bfbe556be8ad0f /CMakeLists.txt
parentc9402e5a5d67ef877fa7f5f67c07a794574ded35 (diff)
downloadch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.gz
ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.bz2
ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.zip
Get a good, basic framework for ISRs and properly handle the data sections.
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