aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be194aa..554dfa4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,8 +49,8 @@ project (ch537 LANGUAGES C ASM)
# Set compiler and linker flags
file(GLOB LINKER_SCRIPT "linker/*.ld")
-set(CMAKE_C_FLAGS "-march=rv32imac_zicsr -mabi=ilp32 -lgcc -static -O -std=gnu99" CACHE INTERNAL "C Compiler options")
-set(CMAKE_ASM_FLAGS "-march=rv32imac_zicsr -mabi=ilp32 -lgcc -static -O -std=gnu99" CACHE INTERNAL "C Compiler options")
+set(CMAKE_C_FLAGS "-march=rv32imac_zicsr -mabi=ilp32 -lgcc -static -Os -std=gnu99" CACHE INTERNAL "C Compiler options")
+set(CMAKE_ASM_FLAGS "-march=rv32imac_zicsr -mabi=ilp32 -lgcc -static -Os -std=gnu99" CACHE INTERNAL "C Compiler options")
set(CMAKE_EXE_LINKER_FLAGS "-static -L ${CMAKE_BINARY_DIR}/lib -lmain -T ${LINKER_SCRIPT}" CACHE INTERNAL "Linker options")
include_directories(include linker ${CMAKE_BINARY_DIR}/generated/fdl)
@@ -78,7 +78,7 @@ add_dependencies(libmain fdl_headers)
set(fdl_headers)
file(GLOB_RECURSE fdl_files "${CMAKE_SOURCE_DIR}/fdl/*.fdl")
fiddle_sources(fdl_headers "${fdl_files}")
-add_custom_target( fdl_headers DEPENDS ${fdl_headers})
+add_custom_target(fdl_headers DEPENDS ${fdl_headers})
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/main.elf
@@ -87,6 +87,7 @@ add_custom_command(
COMMAND ${CMAKE_C_COMPILER} -nostartfiles -lgcc
-static -L ${CMAKE_BINARY_DIR}/lib -T ${LINKER_SCRIPT}
-o ${CMAKE_BINARY_DIR}/main.elf
+ -Xlinker -Map=${CMAKE_BINARY_DIR}/main.map
-Wl,--no-whole-archive
-Wl,--whole-archive ${CMAKE_BINARY_DIR}/lib/libmain.a
-Wl,--no-whole-archive