Skip to content

Commit 8d1378d

Browse files
Remove Segger RTT from pico-btstack (#1995)
* Remove btstack Segger RTT from pico-btstack We now have this in the SDK so adding it again in pico-btstack leads to link errors. But it's possible to use the btstack RTT functionality by defining ENABLE_SEGGER_RTT=1, and if we're not using pico_stio_rtt we still need to add the btstack RTT source. * Fix build issues when RTT is enabled Fixes raspberrypi/pico-examples#565
1 parent fe018f9 commit 8d1378d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/rp2_common/pico_btstack/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ if (EXISTS ${PICO_BTSTACK_PATH}/${BTSTACK_TEST_PATH})
2828
target_sources(pico_btstack_base INTERFACE
2929
${PICO_BTSTACK_PATH}/3rd-party/micro-ecc/uECC.c
3030
${PICO_BTSTACK_PATH}/3rd-party/rijndael/rijndael.c
31-
${PICO_BTSTACK_PATH}/3rd-party/segger-rtt/SEGGER_RTT.c
3231
${PICO_BTSTACK_PATH}/3rd-party/segger-rtt/SEGGER_RTT_printf.c
3332
${PICO_BTSTACK_PATH}/platform/embedded/btstack_tlv_flash_bank.c
3433
${PICO_BTSTACK_PATH}/platform/embedded/hci_dump_embedded_stdout.c
@@ -60,6 +59,13 @@ if (EXISTS ${PICO_BTSTACK_PATH}/${BTSTACK_TEST_PATH})
6059
${PICO_BTSTACK_PATH}/3rd-party/yxml/yxml.c
6160
${CMAKE_CURRENT_LIST_DIR}/btstack_stdin_pico.c
6261
)
62+
# pico-sdk now supports RTT using pico_enable_stdio_rtt in your cmake file or -DPICO_STDIO_RTT=1 on the command line
63+
# Then the output of printf goes to RTT. But if you define ENABLE_SEGGER_RTT=1 it will use the btstack functionality to use RTT
64+
# and we'll have to add the source file it requires.
65+
target_sources(pico_btstack_base INTERFACE
66+
$<IF:$<BOOL:$<IF:$<STREQUAL:$<TARGET_PROPERTY:PICO_TARGET_STDIO_RTT>,>,${PICO_STDIO_RTT},$<TARGET_PROPERTY:PICO_TARGET_STDIO_RTT>>>,,${PICO_BTSTACK_PATH}/3rd-party/segger-rtt/SEGGER_RTT.c>
67+
)
68+
6369
target_include_directories(pico_btstack_base_headers SYSTEM INTERFACE
6470
${PICO_BTSTACK_PATH}/
6571
${PICO_BTSTACK_PATH}/3rd-party/md5

src/rp2_common/pico_stdio_rtt/SEGGER/RTT/SEGGER_RTT.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ Additional information:
7878

7979
#include <string.h> // for memcpy
8080

81+
#ifdef __GNUC__
82+
#pragma GCC diagnostic ignored "-Wcast-qual"
83+
#pragma GCC diagnostic ignored "-Wcast-align"
84+
#endif
85+
8186
/*********************************************************************
8287
*
8388
* Configuration, default values

src/rp2_common/pico_stdio_rtt/stdio_rtt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ void stdio_rtt_deinit(void) {
2626
}
2727

2828
static void stdio_rtt_out_chars(const char *buf, int length) {
29-
SEGGER_RTT_Write(0, buf, length);
29+
SEGGER_RTT_Write(0, buf, (unsigned)length);
3030
}
3131

3232
static int stdio_rtt_in_chars(char *buf, int length) {
33-
return SEGGER_RTT_Read(0, buf, length);
33+
return (int)SEGGER_RTT_Read(0, buf, (unsigned)length);
3434
}
3535

3636
stdio_driver_t stdio_rtt = {

0 commit comments

Comments
 (0)