aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-01-25 20:51:35 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2017-01-25 20:51:35 +0100
commit8a3fedbcb8fc58dae8b43db3cae39688ec0332ef (patch)
treeb148bde0a9191bc44e1f7ace5dada5ac4677bec3 /cmake
parentb485617e1578ade7cb02e65a674d56315098b18c (diff)
downloadstm32f103-playground-8a3fedbcb8fc58dae8b43db3cae39688ec0332ef.tar.gz
stm32f103-playground-8a3fedbcb8fc58dae8b43db3cae39688ec0332ef.tar.bz2
stm32f103-playground-8a3fedbcb8fc58dae8b43db3cae39688ec0332ef.tar.xz
stm32f103-playground-8a3fedbcb8fc58dae8b43db3cae39688ec0332ef.zip
o i2c test
o Misc other stuff.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/stm32.toolchain.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmake/stm32.toolchain.cmake b/cmake/stm32.toolchain.cmake
index 8e380fe..05a9090 100644
--- a/cmake/stm32.toolchain.cmake
+++ b/cmake/stm32.toolchain.cmake
@@ -22,12 +22,17 @@ set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING 1)
set(TARGET_FLAGS "-mcpu=cortex-m3 -mthumb")
-set(BASE_FLAGS "-O3 -ffreestanding -Wall -Wextra -g -ffunction-sections -fdata-sections ${TARGET_FLAGS}")
+
+set(o_level "$<TARGET_PROPERTY:O_LEVEL>")
+add_compile_options("$<$<BOOL:${o_level}>:-O${o_level}>$<$<NOT:$<BOOL:${o_level}>>:-O3>")
+unset(o_level)
+
+set(BASE_FLAGS "-ffreestanding -Wall -Wextra -g -ffunction-sections -fdata-sections ${TARGET_FLAGS}")
set(CMAKE_C_FLAGS "${BASE_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${BASE_FLAGS} -fno-exceptions -fno-rtti -felide-constructors -std=c++14" CACHE STRING "c++ flags")
-set(LINKER_FLAGS "-O3 -nostdlib -Wl,--gc-sections ${TARGET_FLAGS}")
+set(LINKER_FLAGS "-nostdlib -Wl,--gc-sections ${TARGET_FLAGS}")
#set(LINKER_LIBS "-larm_cortexM4l_math -lm")
set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)