From 46b7f97720293e098fa26eb5269b481c45819deb Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 26 May 2017 09:33:28 +0200 Subject: o Updating to latest mcucpp. --- .config | 19 +++++++++++++------ CMakeLists.txt | 6 +++--- src/radio-controller.cpp | 13 ++++++++----- thirdparty/mcucpp | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.config b/.config index fb84335..9664ef0 100644 --- a/.config +++ b/.config @@ -2,19 +2,26 @@ # Automatically generated file; DO NOT EDIT. # MCU C++ Configuration # -# CONFIG_PRINTF_TARGET_SEMIHOSTING is not set -CONFIG_PRINTF_TARGET_UART=y -CONFIG_TINYPRINTF=y # # tinyprintf settings # +CONFIG_TINYPRINTF=y CONFIG_TINYPRINTF_PRINTF=y CONFIG_TINYPRINTF_SNPRINTF=y -CONFIG_SEMIHOSTING=y # # Semihosting settings # -CONFIG_SEMIHOSTING_PUTCHAR=y -CONFIG_SEMIHOSTING_PUTS=y +CONFIG_SEMIHOSTING=y +# CONFIG_SEMIHOSTING_PUTCHAR is not set +# CONFIG_SEMIHOSTING_PUTS is not set + +# +# stdio settings +# +# CONFIG_STDIO_TARGET_SEMIHOSTING is not set +CONFIG_STDIO_TARGET_STM32CUBE_UART=y +# CONFIG_STDIO_TARGET_STM32CUBE_UART_PORT_1 is not set +CONFIG_STDIO_TARGET_STM32CUBE_UART_PORT_2=y +CONFIG_STDIO_TARGET_STM32CUBE_UART_PORT="huart2" diff --git a/CMakeLists.txt b/CMakeLists.txt index bf1aecd..4fc7403 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.6) set(MCU_CHIP stm32f103C6) -set(MCU_USE_STM32CUBEMX TRUE) +set(MCU_USE_STM32CUBE TRUE) set(MCU_LTO_MODE OFF) include(thirdparty/mcu.cmake/mcu.cmake) project(radio-controller C CXX ASM) @@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 14) 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) +target_compile_definitions(firmware PUBLIC MCUCMAKE_USING_STM32CUBE=1) target_include_directories(firmware PUBLIC include) target_link_libraries(firmware PUBLIC gcc) mcu_add_executable(TARGET firmware) @@ -34,7 +34,7 @@ target_sources(firmware PUBLIC mcucpp_process(TARGET firmware) -# stm32cubemx sources +# stm32cube sources mcu_include_directories_from_sources( SOURCE_DIR stm32cubemx EXCLUDE Templates diff --git a/src/radio-controller.cpp b/src/radio-controller.cpp index 9795574..461a910 100644 --- a/src/radio-controller.cpp +++ b/src/radio-controller.cpp @@ -1,8 +1,8 @@ #include "radio-controller.h" #include "stm32f1xx_hal.h" #include "mcu/arm/semihosting.h" -#include "mcu/stm32cubemx/uart.h" -#include "mcu/stm32cubemx/debug.h" +#include "mcu/stm32cube/uart.h" +#include "mcu/stm32cube/debug.h" #ifdef HAL_IWDG_MODULE_ENABLED extern IWDG_HandleTypeDef hiwdg; @@ -11,14 +11,17 @@ extern IWDG_HandleTypeDef hiwdg; extern TIM_HandleTypeDef htim1; extern UART_HandleTypeDef huart2; -mcu::stm32cubemx::uart::uart_port uart2(&huart2); -mcu::stm32cubemx::debug::dbg<100> dbg(uart2); +mcu::stm32cube::uart::uart_port uart2(&huart2); +mcu::stm32cube::debug::dbg<100> dbg(uart2); void main_pre_init() { } void main_post_init() { - semihosting::enable(); + bool debugger_connected = (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0; + if (debugger_connected) { + semihosting::enable(); + } printf("Radio Controller\n"); diff --git a/thirdparty/mcucpp b/thirdparty/mcucpp index 4a7d31a..2c9851f 160000 --- a/thirdparty/mcucpp +++ b/thirdparty/mcucpp @@ -1 +1 @@ -Subproject commit 4a7d31a8218a167ea19a7e43942bf698443c539f +Subproject commit 2c9851f00520d83615a5041dfd1c31180ed0c443 -- cgit v1.2.3