diff --git a/port/stm32-f4discovery-cc256x/Makefile b/port/stm32-f4discovery-cc256x/Makefile index f24e77f3f..6f856b52e 100644 --- a/port/stm32-f4discovery-cc256x/Makefile +++ b/port/stm32-f4discovery-cc256x/Makefile @@ -43,6 +43,7 @@ ${BTSTACK_ROOT}/3rd-party/hxcmod-player/hxcmod.c \ ${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods/nao-deceased_by_disease.c \ ${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ +${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ ${BTSTACK_ROOT}/3rd-party/yxml/yxml.c \ ${BTSTACK_ROOT}/3rd-party/md5/md5.c \ @@ -53,6 +54,8 @@ ${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \ ${BTSTACK_ROOT}/src/ad_parser.c \ ${BTSTACK_ROOT}/src/ble/ancs_client.c \ ${BTSTACK_ROOT}/src/ble/att_db.c \ diff --git a/port/stm32-f4discovery-cc256x/README.md b/port/stm32-f4discovery-cc256x/README.md index edb837186..3940da15e 100644 --- a/port/stm32-f4discovery-cc256x/README.md +++ b/port/stm32-f4discovery-cc256x/README.md @@ -45,7 +45,7 @@ All debug output can be either send via SEGGER RTT or via USART2. To get the con In src/btstack_config.h resp. in example/btstack_config.h of the generated projects, additional debug information can be enabled by uncommenting ENABLE_LOG_INFO. -Also, the full packet log can be enabled in src/port.c resp. btstack/port/stm32-f4discovery-cc256x/src/port.c by uncommenting the hci_dump_open(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py +Also, the full packet log can be enabled in src/port.c resp. btstack/port/stm32-f4discovery-cc256x/src/port.c by uncommenting the hci_dump_init(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py ## GATT Database In BTstack, the GATT Database is defined via the .gatt file in the example folder. The Makefile contains rules to update the .h file when the .gatt was modified. diff --git a/port/stm32-f4discovery-cc256x/port/port.c b/port/stm32-f4discovery-cc256x/port/port.c index 13d9aaae6..ee73b9339 100644 --- a/port/stm32-f4discovery-cc256x/port/port.c +++ b/port/stm32-f4discovery-cc256x/port/port.c @@ -19,6 +19,9 @@ #ifdef ENABLE_SEGGER_RTT #include "SEGGER_RTT.h" +#include "hci_dump_segger_rtt_stdout.h" +#else +#include "hci_dump_embedded_stdout.h" #endif // @@ -316,7 +319,12 @@ void port_main(void){ btstack_memory_init(); btstack_run_loop_init(btstack_run_loop_embedded_get_instance()); - // hci_dump_open( NULL, HCI_DUMP_STDOUT ); + // uncomment to enable packet logger +#ifdef ENABLE_SEGGER_RTT + // hci_dump_init(hci_dump_segger_rtt_stdout_get_instance()); +#else + // hci_dump_init(hci_dump_embedded_stdout_get_instance()); +#endif // init HCI hci_init(hci_transport_h4_instance(btstack_uart_block_embedded_instance()), (void*) &config); diff --git a/port/stm32-f4discovery-usb/Makefile b/port/stm32-f4discovery-usb/Makefile index 5e54373c3..897e51f3d 100644 --- a/port/stm32-f4discovery-usb/Makefile +++ b/port/stm32-f4discovery-usb/Makefile @@ -54,6 +54,8 @@ ${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \ ${BTSTACK_ROOT}/src/ad_parser.c \ ${BTSTACK_ROOT}/src/ble/ancs_client.c \ ${BTSTACK_ROOT}/src/ble/att_db.c \ diff --git a/port/stm32-f4discovery-usb/port/port.c b/port/stm32-f4discovery-usb/port/port.c index e0d8698ad..f82468d75 100644 --- a/port/stm32-f4discovery-usb/port/port.c +++ b/port/stm32-f4discovery-usb/port/port.c @@ -60,6 +60,9 @@ #ifdef ENABLE_SEGGER_RTT #include "SEGGER_RTT.h" +#include "hci_dump_segger_rtt_stdout.h" +#else +#include "hci_dump_embedded_stdout.h" #endif static btstack_packet_callback_registration_t hci_event_callback_registration; @@ -130,8 +133,12 @@ void port_main(void){ btstack_memory_init(); btstack_run_loop_init(btstack_run_loop_embedded_get_instance()); - // uncomment for packet log - // hci_dump_open( NULL, HCI_DUMP_STDOUT ); + // uncomment to enable packet logger +#ifdef ENABLE_SEGGER_RTT + // hci_dump_init(hci_dump_segger_rtt_stdout_get_instance()); +#else + // hci_dump_init(hci_dump_embedded_stdout_get_instance()); +#endif // init HCI hci_init(hci_transport_h2_stm32_instance(), NULL); diff --git a/port/stm32-l073rz-nucleo-em9304/Makefile b/port/stm32-l073rz-nucleo-em9304/Makefile index 8c8029a65..46e56c4b0 100644 --- a/port/stm32-l073rz-nucleo-em9304/Makefile +++ b/port/stm32-l073rz-nucleo-em9304/Makefile @@ -41,6 +41,7 @@ VPATH += ${BTSTACK_ROOT}/example C_SOURCES = \ ${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ +${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ ${BTSTACK_ROOT}/chipset/em9301/btstack_chipset_em9301.c \ ${BTSTACK_ROOT}/chipset/em9301/0000000_META_hci_patches_v7.c \ @@ -48,6 +49,8 @@ ${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \ ${BTSTACK_ROOT}/src/ad_parser.c \ ${BTSTACK_ROOT}/src/ble/att_db.c \ ${BTSTACK_ROOT}/src/ble/att_dispatch.c \ diff --git a/port/stm32-l073rz-nucleo-em9304/README.md b/port/stm32-l073rz-nucleo-em9304/README.md index 7d3dd0d99..bce82d486 100644 --- a/port/stm32-l073rz-nucleo-em9304/README.md +++ b/port/stm32-l073rz-nucleo-em9304/README.md @@ -39,7 +39,7 @@ All debug output can be either send via SEGGER RTT or via USART2. To get the con In src/btstack_config.h resp. in example/btstack_config.h of the generated projects, additional debug information can be enabled by uncommenting ENABLE_LOG_INFO. -Also, the full packet log can be enabled in src/port.c by uncommenting the hci_dump_open(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py +Also, the full packet log can be enabled in src/port.c by uncommenting the hci_dump_init(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py ## GATT Database In BTstack, the GATT Database is defined via the .gatt file in the example folder. During the build, the .gatt file is converted into a .h file with a binary representation of the GATT Database and useful defines for the application. diff --git a/port/stm32-l073rz-nucleo-em9304/port/port.c b/port/stm32-l073rz-nucleo-em9304/port/port.c index 2a5cf8eb2..d38f04c56 100644 --- a/port/stm32-l073rz-nucleo-em9304/port/port.c +++ b/port/stm32-l073rz-nucleo-em9304/port/port.c @@ -61,6 +61,9 @@ #ifdef ENABLE_SEGGER_RTT #include "SEGGER_RTT.h" +#include "hci_dump_segger_rtt_stdout.h" +#else +#include "hci_dump_embedded_stdout.h" #endif // retarget printf @@ -477,7 +480,12 @@ void port_main(void){ btstack_memory_init(); btstack_run_loop_init(btstack_run_loop_embedded_get_instance()); - // hci_dump_open( NULL, HCI_DUMP_STDOUT ); + // uncomment to enable packet logger +#ifdef ENABLE_SEGGER_RTT + // hci_dump_init(hci_dump_segger_rtt_stdout_get_instance()); +#else + // hci_dump_init(hci_dump_embedded_stdout_get_instance()); +#endif // set up polling data_source btstack_run_loop_set_data_source_handler(&transport_data_source, &hal_spi_em9304_process); diff --git a/port/stm32-l451-miromico-sx1280/Makefile b/port/stm32-l451-miromico-sx1280/Makefile index 7d2b2c01a..38db65a53 100644 --- a/port/stm32-l451-miromico-sx1280/Makefile +++ b/port/stm32-l451-miromico-sx1280/Makefile @@ -48,6 +48,8 @@ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \ ${BTSTACK_ROOT}/src/ad_parser.c \ ${BTSTACK_ROOT}/src/ble/ancs_client.c \ ${BTSTACK_ROOT}/src/ble/att_db.c \ diff --git a/port/stm32-l451-miromico-sx1280/port/btstack_port.c b/port/stm32-l451-miromico-sx1280/port/btstack_port.c index 924870552..a0bdb6d54 100644 --- a/port/stm32-l451-miromico-sx1280/port/btstack_port.c +++ b/port/stm32-l451-miromico-sx1280/port/btstack_port.c @@ -58,6 +58,12 @@ #include "btstack_tlv_none.h" #include "ble/le_device_db_tlv.h" +#ifdef ENABLE_SEGGER_RTT +#include "SEGGER_RTT.h" +#include "hci_dump_segger_rtt_stdout.h" +#else +#include "hci_dump_embedded_stdout.h" +#endif void btstack_assert_failed(const char * file, uint16_t line_nr){ printf("Assert: file %s, line %u\n", file, line_nr); @@ -115,9 +121,13 @@ void btstack_port(void){ // init HCI hci_init(hci_transport, NULL); - - // enable full log output while porting - // hci_dump_open(NULL, HCI_DUMP_STDOUT); + + // uncomment to enable packet logger +#ifdef ENABLE_SEGGER_RTT + // hci_dump_init(hci_dump_segger_rtt_stdout_get_instance()); +#else + // hci_dump_init(hci_dump_embedded_stdout_get_instance()); +#endif // hand over to btstack embedded code btstack_main(); diff --git a/port/stm32-wb55xx-nucleo-freertos/Makefile b/port/stm32-wb55xx-nucleo-freertos/Makefile index 3496c4234..cec590205 100644 --- a/port/stm32-wb55xx-nucleo-freertos/Makefile +++ b/port/stm32-wb55xx-nucleo-freertos/Makefile @@ -43,6 +43,7 @@ C_SOURCES = \ ${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \ ${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ +${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ ${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ ${BTSTACK_ROOT}/platform/freertos/btstack_run_loop_freertos.c \ ${BTSTACK_ROOT}/src/ad_parser.c \ @@ -78,6 +79,8 @@ ${BTSTACK_ROOT}/src/l2cap_signaling.c \ ${BTSTACK_ROOT}/src/hci_transport_h4.c \ ${BTSTACK_ROOT}/platform/embedded/hal_flash_bank_memory.c \ ${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \ +${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \ $(FREERTOS_ROOT)/FreeRTOS/tasks.c \ $(FREERTOS_ROOT)/FreeRTOS/queue.c \ $(FREERTOS_ROOT)/FreeRTOS/list.c \ diff --git a/port/stm32-wb55xx-nucleo-freertos/README.md b/port/stm32-wb55xx-nucleo-freertos/README.md index d6c636a01..4470740ee 100644 --- a/port/stm32-wb55xx-nucleo-freertos/README.md +++ b/port/stm32-wb55xx-nucleo-freertos/README.md @@ -74,7 +74,7 @@ All debug output can be either send via SEGGER RTT or via USART1. To get the con In src/btstack_config.h resp. in example/btstack_config.h of the generated projects, additional debug information can be enabled by uncommenting ENABLE_LOG_INFO. -Also, the full packet log can be enabled in src/btstack_port.c by uncommenting the hci_dump_open(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py +Also, the full packet log can be enabled in src/btstack_port.c by uncommenting the hci_dump_init(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py ## GATT Database In BTstack, the GATT Database is defined via the .gatt file in the example folder. During the build, the .gatt file is converted into a .h file with a binary representation of the GATT Database and useful defines for the application. diff --git a/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c b/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c index efa73eeb1..a2d15f6f6 100644 --- a/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c +++ b/port/stm32-wb55xx-nucleo-freertos/port/btstack_port.c @@ -49,6 +49,12 @@ #include "btstack_config.h" #include "main.h" +#ifdef ENABLE_SEGGER_RTT +#include "hci_dump_segger_rtt_stdout.h" +#else +#include "hci_dump_embedded_stdout.h" +#endif + #ifndef ENABLE_SEGGER_RTT /******************************************** * system calls implementation @@ -582,8 +588,13 @@ void port_thread(void* args){ // enable packet logger #ifdef ENABLE_HCI_DUMP - // hci_dump_open(NULL, HCI_DUMP_STDOUT); +#ifdef ENABLE_SEGGER_RTT + // hci_dump_init(hci_dump_segger_rtt_stdout_get_instance()); +#else + // hci_dump_init(hci_dump_embedded_stdout_get_instance()); #endif +#endif + /// GET STARTED with BTstack /// btstack_memory_init(); btstack_run_loop_init(btstack_run_loop_freertos_get_instance());