added the compile and link options to the main target options.

This commit is contained in:
jakeg00dwin 2025-03-07 10:51:47 -08:00
parent e8dad084d0
commit 9bec16fe6b

View file

@ -1,19 +1,3 @@
# Compiler flags
add_compile_options(
-g
-Os
-flto
-ffunction-sections
-fdata-sections
-fmessage-length=0
-msmall-data-limit=8
-march=rv32ec
-mabi=ilp32e
-DCH32V003=1
-static-libgcc
-nostdlib
-Wall
)
add_executable(${PROJECT_NAME}
main.c
@ -30,11 +14,35 @@ target_link_libraries(${PROJECT_NAME}
#${CMAKE_SOURCE_DIR}/libgcc.a
)
target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc)
target_link_options(${PROJECT_NAME} PRIVATE
-Wl,--print-memory-usage
-Wl,-Map=${PROJECT_NAME}.map
-lgcc
-Wl,--gc-sections
-T ${CMAKE_SOURCE_DIR}/src/linker_script.ld
)
target_compile_options(${PROJECT_NAME} PRIVATE
-g
-Os
-flto
-ffunction-sections
-fdata-sections
-fmessage-length=0
-msmall-data-limit=8
-march=rv32ec
-mabi=ilp32e
-DCH32V003=1
-static-libgcc
-nostdlib
-Wall
)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".elf")
#target_link_options(${PROJECT_NAME} PRIVATE -static -nostartfiles -T "./linker_script.ld")
# The other "targets" are size, upload, debug, production, etc
#if(NOT TARGET size)