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
parent
commit
3ae428f092
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      README.md
  2. 6
      examples/libs/CMakeLists.txt
  3. 2
      examples/libs/lib/CMakeLists.txt
  4. 6
      examples/mix/CMakeLists.txt
  5. 6
      examples/version/CMakeLists.txt
  6. 4
      tutorial/CMakeLists.txt

6
README.md

@ -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 .
```

6
examples/libs/CMakeLists.txt

@ -12,7 +12,11 @@ add_subdirectory()
# TODO 5: Link the `lib` against `libs`
target_link_libraries()
target_link_options(libs PRIVATE --semihosting)
target_compile_options(libs PRIVATE --cpu=cortex-m4)
target_link_options(libs PRIVATE
--cpu=cortex-m4
--semihosting)
enable_testing()

2
examples/libs/lib/CMakeLists.txt

@ -6,3 +6,5 @@ target_sources()
# TODO 3: Using the `PUBLIC` scope, expose the `lib` headers (inc) to other targets
target_include_directories()
target_compile_options(lib PRIVATE --cpu=cortex-m4)

6
examples/mix/CMakeLists.txt

@ -8,7 +8,11 @@ add_executable(mix)
# TODO 2: Add `fun.s` source to the `mix` target
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
--cpu=cortex-m4
--semihosting)
enable_testing()

6
examples/version/CMakeLists.txt

@ -13,7 +13,11 @@ configure_file()
# TODO 3: Add the Project Binary Directory to the target's include directories
target_include_directories()
target_link_options(version PRIVATE --semihosting)
target_compile_options(version PRIVATE --cpu=cortex-m4)
target_link_options(version PRIVATE
--cpu=cortex-m4
--semihosting)
enable_testing()

4
tutorial/CMakeLists.txt

@ -14,7 +14,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)
# TODO 1: Enable testing in CMake

Loading…
Cancel
Save