From b502c816326908d04252ea3346f07811e8bdd42c Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 14 May 2017 16:03:46 +0200 Subject: wip, experimenting with kconfig in mcucpp. --- .config | 10 ++++++++-- .editorconfig | 2 +- CMakeLists.txt | 50 ++++++++------------------------------------------ Kconfig | 30 ------------------------------ config.cmake | 5 ----- thirdparty/mcu.cmake | 2 +- thirdparty/mcucpp | 2 +- 7 files changed, 19 insertions(+), 82 deletions(-) delete mode 100644 Kconfig delete mode 100644 config.cmake diff --git a/.config b/.config index 83894d2..fb84335 100644 --- a/.config +++ b/.config @@ -2,9 +2,15 @@ # Automatically generated file; DO NOT EDIT. # MCU C++ Configuration # +# CONFIG_PRINTF_TARGET_SEMIHOSTING is not set +CONFIG_PRINTF_TARGET_UART=y CONFIG_TINYPRINTF=y -CONFIG_PRINTF_TARGET_SEMIHOSTING=y -# CONFIG_PRINTF_TARGET_UART is not set + +# +# tinyprintf settings +# +CONFIG_TINYPRINTF_PRINTF=y +CONFIG_TINYPRINTF_SNPRINTF=y CONFIG_SEMIHOSTING=y # diff --git a/.editorconfig b/.editorconfig index 8c27bca..120ffd0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,5 +10,5 @@ indent_size = 4 [stm32cubemx/**.{h,c}] indent_size = 2 -[*.cmake] +[{*.cmake,CMakeLists.txt}] indent_size = 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 002e4c4..bf1aecd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,16 +7,7 @@ project(radio-controller C CXX ASM) set(CMAKE_CXX_STANDARD 14) -include(config.cmake) - -add_custom_target(kconfig DEPENDS config.cmake) - -add_custom_command(OUTPUT .config config.cmake - COMMAND /home/trygvis/opt/kconfig/bin/kconfig-mconf Kconfig - COMMAND cat .config | thirdparty/mcucpp/config-to-cmake > config.cmake - COMMAND echo Generated config.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - USES_TERMINAL) +include(thirdparty/mcucpp/cmake/mcucpp.cmake) add_executable(firmware src/radio-controller.cpp include/radio-controller.h) target_compile_definitions(firmware PUBLIC MCUCMAKE_USING_STM32CUBEMX=1) @@ -24,48 +15,24 @@ target_include_directories(firmware PUBLIC include) target_link_libraries(firmware PUBLIC gcc) mcu_add_executable(TARGET firmware) +mcucpp_configure_target(TARGET firmware) + # mcu.cmake sources target_include_directories(firmware PUBLIC thirdparty/mcu.cmake/stm32f103/include -) + ) target_sources(firmware PUBLIC -# thirdparty/mcu.cmake/stm32f103/src/default_handler.cpp + # thirdparty/mcu.cmake/stm32f103/src/default_handler.cpp thirdparty/mcu.cmake/stm32f103/src/init_high.cpp -# thirdparty/mcu.cmake/stm32f103/src/init_low.s + # thirdparty/mcu.cmake/stm32f103/src/init_low.s thirdparty/mcu.cmake/stm32f103/src/init_stm32f103_ld.cpp thirdparty/mcu.cmake/stm32f103/src/init_low_halt.s thirdparty/mcu.cmake/stm32f103/src/init_low_Reset_Handler.s thirdparty/mcu.cmake/stm32f103/src/breakpoint.s $ENV{HOME}/opt/STM32CubeMX/Repository/STM32Cube_FW_F1_V1.4.0/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s -) + ) -# mcucpp sources -target_include_directories(firmware PUBLIC - thirdparty/mcucpp/include - thirdparty/mcucpp/thirdparty/tinyprintf -) -target_sources(firmware PUBLIC - thirdparty/mcucpp/include/mcu/arm/semihosting.h - thirdparty/mcucpp/src/arm/semihosting.cpp - thirdparty/mcucpp/src/arm/semihosting-puts.cpp - thirdparty/mcucpp/src/arm/semihosting-putchar.cpp - - thirdparty/mcucpp/src/generic/tinyprintf-printf.cpp - thirdparty/mcucpp/src/generic/tinyprintf-snprintf.cpp - - thirdparty/mcucpp/include/mcu/nonew/function.h - thirdparty/mcucpp/include/mcu/nonew/queue.h - - thirdparty/mcucpp/include/mcu/io/output_stream.h - thirdparty/mcucpp/src/io/output_stream.cpp - - thirdparty/mcucpp/include/mcu/stm32cubemx/debug.h - - thirdparty/mcucpp/include/mcu/stm32cubemx/uart.h - thirdparty/mcucpp/src/stm32cubemx/uart.cpp - - thirdparty/mcucpp/thirdparty/tinyprintf/tinyprintf.c -) +mcucpp_process(TARGET firmware) # stm32cubemx sources mcu_include_directories_from_sources( @@ -74,7 +41,6 @@ mcu_include_directories_from_sources( EXCLUDE _template.c EXCLUDE Examples EXCLUDE DSP_Lib -# EXCLUDE stm32f1xx_it.c SOURCES_VAR STM32_CUBEMX_SOURCES HEADERS_VAR STM32_CUBEMX_HEADERS INCLUDES_VAR STM32_CUBEMX_INCLUDES diff --git a/Kconfig b/Kconfig deleted file mode 100644 index 0fd66ed..0000000 --- a/Kconfig +++ /dev/null @@ -1,30 +0,0 @@ -mainmenu "MCU C++ Configuration" - -config TINYPRINTF - bool "Enable tinyprintf" - -choice PRINTF_TARGET - prompt "printf() target" - - config PRINTF_TARGET_SEMIHOSTING - bool "Semihosting" - - config PRINTF_TARGET_UART - bool "UART" - -endchoice - -config SEMIHOSTING - bool "Enable semihosting" - -menu "Semihosting settings" - depends on SEMIHOSTING - -config SEMIHOSTING_PUTCHAR - bool "Enable putchar() implementation with semihosting" - default y - -config SEMIHOSTING_PUTS - bool "Enable puts() implementation with semihosting" - default y -endmenu diff --git a/config.cmake b/config.cmake deleted file mode 100644 index 94de0d7..0000000 --- a/config.cmake +++ /dev/null @@ -1,5 +0,0 @@ -set(KCONFIG_TINYPRINTF TRUE) -set(KCONFIG_PRINTF_TARGET_SEMIHOSTING TRUE) -set(KCONFIG_SEMIHOSTING TRUE) -set(KCONFIG_SEMIHOSTING_PUTCHAR TRUE) -set(KCONFIG_SEMIHOSTING_PUTS TRUE) diff --git a/thirdparty/mcu.cmake b/thirdparty/mcu.cmake index d645452..d37d895 160000 --- a/thirdparty/mcu.cmake +++ b/thirdparty/mcu.cmake @@ -1 +1 @@ -Subproject commit d6454522261d34a0c7460189194a6d5716751c69 +Subproject commit d37d89515e7f635694f89cb16d27efc3ccc3f39d diff --git a/thirdparty/mcucpp b/thirdparty/mcucpp index 2ff0cbc..4a7d31a 160000 --- a/thirdparty/mcucpp +++ b/thirdparty/mcucpp @@ -1 +1 @@ -Subproject commit 2ff0cbc23628d5712773ed820bc291f420119090 +Subproject commit 4a7d31a8218a167ea19a7e43942bf698443c539f -- cgit v1.2.3