This is a question about performance, I am struggling with this for a while and my google-fu does not help me finding a way of fixing it.
I am crosscompiling an application for an embedded project. The microprocessor where the code resides has a memory splitted at half and I can decide to run the software from address_0 or addres_max/2.
at the moment i have a static library that is linked to main two times.
add_executable(mytarget_0 main.c)
target_link_libraries(mytarget_0 ${extralib})
set_target_properties(mytarget_0 PROPERTIES LINK_FLAGS ${CMAKE_EXE_LINKER_FLAGS_LOW} )
and an exact same that links to another region.
add_executable(mytarget_1 main.c)
target_link_libraries(mytarget_1 ${extralib})
set_target_properties(mytarget_1 PROPERTIES LINK_FLAGS ${CMAKE_EXE_LINKER_FLAGS_MID} )
Basically the compilation of main is performed two times the linking is performed two times with different parameters.
I have this operation replicated for a lot of target and basically I would like to clean the code in order to improve compilation time.
My question now are 2:
- does someone have an idea about how to relocate the code without compiling it? I read about srecord but I am not sure I can use it for this purpose.
- does someone have an idea about how to change link flags in cmake without creating another target?