Browse Source
Fix linker options (#44 )
* Added compiler and linker options for CM4
* Mention forced reconfiguration
master
Felipe Torrezan
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with
24 additions and
6 deletions
README.md
examples/libs/CMakeLists.txt
examples/libs/lib/CMakeLists.txt
examples/mix/CMakeLists.txt
examples/version/CMakeLists.txt
tutorial/CMakeLists.txt
@ -50,7 +50,9 @@ target_sources(tutorial PRIVATE tutorial.c)
target_compile_options(tutorial PRIVATE --cpu=cortex-m4)
# linker options
target_link_options(tutorial PRIVATE --semihosting)
target_link_options(tutorial PRIVATE
--cpu=cortex-m4
--semihosting)
```
### Enabling the IAR Compiler
@ -126,7 +128,7 @@ add_test(NAME tutorialTest
set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello world!")
```
- Since `CMakeLists.txt` was modified, the build system needs to be reconfigured:
- Since `CMakeLists.txt` was modified, the build system needs to be reconfigured. Rebuilding the project will automatically force reconfiguration, creating the `CTestTestfile.cmake` file :
```
cmake --build .
```
@ -12,7 +12,11 @@ add_subdirectory()
# T O D O 5 : L i n k t h e ` l i b ` a g a i n s t ` l i b s `
target_link_libraries ( )
target_link_options ( libs PRIVATE --semihosting )
target_compile_options ( libs PRIVATE --cpu=cortex-m4 )
target_link_options ( libs PRIVATE
- - c p u = c o r t e x - m 4
- - s e m i h o s t i n g )
enable_testing ( )
@ -6,3 +6,5 @@ target_sources()
# T O D O 3 : U s i n g t h e ` P U B L I C ` s c o p e , e x p o s e t h e ` l i b ` headers ( inc ) t o o t h e r t a r g e t s
target_include_directories ( )
target_compile_options ( lib PRIVATE --cpu=cortex-m4 )
@ -8,7 +8,11 @@ add_executable(mix)
# T O D O 2 : A d d ` f u n . s ` s o u r c e t o t h e ` m i x ` t a r g e t
target_sources ( mix PRIVATE main.c )
target_link_options ( mix PRIVATE --semihosting )
target_compile_options ( mix PRIVATE --cpu=cortex-m4 )
target_link_options ( mix PRIVATE
- - c p u = c o r t e x - m 4
- - s e m i h o s t i n g )
enable_testing ( )
@ -13,7 +13,11 @@ configure_file()
# T O D O 3 : A d d t h e P r o j e c t B i n a r y D i r e c t o r y t o t h e t a r g e t ' s i n c l u d e d i r e c t o r i e s
target_include_directories ( )
target_link_options ( version PRIVATE --semihosting )
target_compile_options ( version PRIVATE --cpu=cortex-m4 )
target_link_options ( version PRIVATE
- - c p u = c o r t e x - m 4
- - s e m i h o s t i n g )
enable_testing ( )
@ -14,7 +14,9 @@ target_sources(tutorial PRIVATE tutorial.c)
target_compile_options ( tutorial PRIVATE --cpu=cortex-m4 )
# l i n k e r o p t i o n s
target_link_options ( tutorial PRIVATE --semihosting )
target_link_options ( tutorial PRIVATE
- - c p u = c o r t e x - m 4
- - s e m i h o s t i n g )
# T O D O 1 : E n a b l e t e s t i n g i n C M a k e