added the compile and link options to the main target options.
This commit is contained in:
parent
e8dad084d0
commit
9bec16fe6b
1 changed files with 25 additions and 17 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue