From 9994cdda7dec0ea4fa279c10c19c6f6c25ede9d2 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 12 Jan 2018 16:37:57 +0100 Subject: [PATCH] stm32-f4discovery-cc256x: support ENABLE_SEGGER_RTT --- .../cubemx-f4discovery-cc256x/Makefile | 4 ++++ port/stm32-f4discovery-cc256x/src/btstack_config.h | 1 + port/stm32-f4discovery-cc256x/src/port.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/port/stm32-f4discovery-cc256x/cubemx-f4discovery-cc256x/Makefile b/port/stm32-f4discovery-cc256x/cubemx-f4discovery-cc256x/Makefile index 12f88cc57..205085d66 100644 --- a/port/stm32-f4discovery-cc256x/cubemx-f4discovery-cc256x/Makefile +++ b/port/stm32-f4discovery-cc256x/cubemx-f4discovery-cc256x/Makefile @@ -38,6 +38,7 @@ VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce VPATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player VPATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods +VPATH += ${BTSTACK_ROOT}/3rd-party/segger-rtt VPATH += ${BTSTACK_ROOT}/chipset/cc256x VPATH += ${BTSTACK_ROOT}/example VPATH += ${BTSTACK_ROOT}/platform/embedded @@ -159,6 +160,8 @@ device_id_server.c \ obex_iterator.c \ pbap_client.c \ goep_client.c \ +SEGGER_RTT.c \ +SEGGER_RTT_Syscalls_GCC.c \ # ASM sources ASM_SOURCES = \ @@ -231,6 +234,7 @@ C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods +C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt C_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded C_INCLUDES += -I${BTSTACK_ROOT}/chipset/cc256x C_INCLUDES += -I${BTSTACK_ROOT}/port/stm32-f4discovery-cc256x/src diff --git a/port/stm32-f4discovery-cc256x/src/btstack_config.h b/port/stm32-f4discovery-cc256x/src/btstack_config.h index 2eb184ee0..ae8321a52 100644 --- a/port/stm32-f4discovery-cc256x/src/btstack_config.h +++ b/port/stm32-f4discovery-cc256x/src/btstack_config.h @@ -18,6 +18,7 @@ #define ENABLE_LOG_ERROR #define ENABLE_CC256X_BAUDRATE_CHANGE_FLOWCONTROL_BUG_WORKAROUND // #define ENABLE_EHCILL +// #define ENABLE_SEGGER_RTT // BTstack configuration. buffers, sizes, ... diff --git a/port/stm32-f4discovery-cc256x/src/port.c b/port/stm32-f4discovery-cc256x/src/port.c index 8c98bd388..8064231bd 100644 --- a/port/stm32-f4discovery-cc256x/src/port.c +++ b/port/stm32-f4discovery-cc256x/src/port.c @@ -15,6 +15,10 @@ #include "classic/btstack_link_key_db_tlv.h" #include "hal_flash_bank_stm32.h" +#ifdef ENABLE_SEGGER_RTT +#include "SEGGER_RTT.h" +#endif + // extern UART_HandleTypeDef huart2; extern UART_HandleTypeDef huart3; @@ -192,6 +196,8 @@ void hal_uart_dma_receive_block(uint8_t *data, uint16_t size){ HAL_UART_Receive_DMA( &huart3, data, size ); } +#ifndef ENABLE_SEGGER_RTT + /** * Use USART_CONSOLE as a console. * This is a syscall for newlib @@ -224,6 +230,7 @@ int _write(int file, char *ptr, int len){ return len; #endif } + int _read(int file, char * ptr, int len){ UNUSED(file); UNUSED(ptr); @@ -231,6 +238,8 @@ int _read(int file, char * ptr, int len){ return -1; } +#endif + int _close(int file){ UNUSED(file); return -1; @@ -303,7 +312,7 @@ void port_main(void){ btstack_memory_init(); btstack_run_loop_init(btstack_run_loop_embedded_get_instance()); - hci_dump_open( NULL, HCI_DUMP_STDOUT ); + // hci_dump_open( NULL, HCI_DUMP_STDOUT ); // init HCI hci_init(hci_transport_h4_instance(btstack_uart_block_embedded_instance()), (void*) &config);