Skip to content

Commit 03450d3

Browse files
committed
Merge branch 'feat/ble_log_v2_esp_target_support_v5.5' into 'release/v5.5'
Feat/ble log v2 esp target support (v5.5) See merge request espressif/esp-idf!41921
2 parents b0e0b4d + 7272249 commit 03450d3

File tree

15 files changed

+663
-320
lines changed

15 files changed

+663
-320
lines changed

components/bt/common/ble_log/Kconfig.in

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,32 @@ if BLE_LOG_ENABLED
3333
try to use the LBM with spin lock protection. So the more LBMs with atomic
3434
lock protection are created, the more ISRs can nest.
3535

36-
config BLE_LOG_LL_ENABLED
37-
bool "Enable BLE Log for Link Layer"
36+
config BLE_LOG_IS_ESP_CONTROLLER
37+
bool "Current BLE Controller is ESP BLE Controller"
3838
depends on BT_CONTROLLER_ENABLED
39+
depends on SOC_ESP_NIMBLE_CONTROLLER
3940
default y
4041
select BT_LE_CONTROLLER_LOG_ENABLED
41-
select BT_LE_CONTROLLER_LOG_MODE_BLE_LOG
42+
select BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
43+
select BLE_LOG_LL_ENABLED
44+
help
45+
Current BLE Controller is ESP BLE Controller
46+
47+
config BLE_LOG_IS_ESP_LEGACY_CONTROLLER
48+
bool "Current BLE Controller is ESP BLE Legacy Controller"
49+
depends on BT_CONTROLLER_ENABLED
50+
depends on !SOC_ESP_NIMBLE_CONTROLLER
51+
depends on BT_CTRL_RUN_IN_FLASH_ONLY
52+
default y
53+
select BT_CTRL_LE_LOG_EN
54+
select BLE_LOG_LL_ENABLED
55+
help
56+
Current BLE Controller is ESP BLE Legacy Controller
57+
58+
config BLE_LOG_LL_ENABLED
59+
bool "Enable BLE Log for Link Layer"
60+
depends on BT_CONTROLLER_ENABLED
61+
default n
4262
help
4363
Enable BLE Log for Link Layer
4464

@@ -96,11 +116,13 @@ if BLE_LOG_ENABLED
96116

97117
config BLE_LOG_PRPH_SPI_MASTER_DMA
98118
bool "Utilize SPI master DMA driver as transport"
119+
depends on SOC_GPSPI_SUPPORTED
99120
help
100121
Utilize SPI master DMA driver as transport
101122

102123
config BLE_LOG_PRPH_UART_DMA
103124
bool "Utilize UART DMA driver as transport"
125+
depends on SOC_UHCI_SUPPORTED
104126
help
105127
Utilize UART DMA driver as transport
106128
endchoice

components/bt/common/ble_log/src/internal_include/ble_log_lbm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include "freertos/FreeRTOS.h"
1919
#include "freertos/semphr.h"
20-
#include "freertos/portmacro.h"
2120

2221
/* ------------------------- */
2322
/* Log Frame Defines */

components/bt/common/ble_log/src/internal_include/ble_log_util.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
#include <string.h>
1818

1919
#include "esp_bit_defs.h"
20+
#include "freertos/FreeRTOS.h"
2021

2122
#ifndef UNIT_TEST
22-
#include "freertos/portmacro.h"
2323
#include "esp_heap_caps.h"
24-
#include "esp_rom_serial_output.h"
24+
#include "esp_rom_uart.h"
2525
#endif /* !UNIT_TEST */
2626

2727
/* MACRO */
@@ -47,18 +47,9 @@
4747
#define BLE_LOG_MEMSET(ptr, value, len) memset(ptr, value, len)
4848

4949
/* Critical section wrapper */
50-
#ifndef CONFIG_BLE_LOG_LL_ENABLED
5150
extern portMUX_TYPE ble_log_spin_lock;
5251
#define BLE_LOG_ENTER_CRITICAL() portENTER_CRITICAL_SAFE(&ble_log_spin_lock);
5352
#define BLE_LOG_EXIT_CRITICAL() portEXIT_CRITICAL_SAFE(&ble_log_spin_lock);
54-
#else /* CONFIG_BLE_LOG_LL_ENABLED */
55-
/* Note
56-
* It's mandatory to use the same spin lock with Link Layer in multi-core system */
57-
extern uint32_t npl_freertos_hw_enter_critical(void);
58-
extern void npl_freertos_hw_exit_critical(uint32_t ctx);
59-
#define BLE_LOG_ENTER_CRITICAL() npl_freertos_hw_enter_critical()
60-
#define BLE_LOG_EXIT_CRITICAL() npl_freertos_hw_exit_critical(0)
61-
#endif /* !CONFIG_BLE_LOG_LL_ENABLED */
6253

6354
#define BLE_LOG_ACQUIRE_SPIN_LOCK(spin_lock) portENTER_CRITICAL_SAFE(spin_lock)
6455
#define BLE_LOG_RELEASE_SPIN_LOCK(spin_lock) portEXIT_CRITICAL_SAFE(spin_lock)

components/bt/common/ble_log/src/prph/ble_log_prph_uart_dma.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/* MACRO */
2525
#define BLE_LOG_UART_MAX_TRANSFER_SIZE (10240)
26-
#define BLE_LOG_UART_RX_BUF_SIZE (32)
26+
#define BLE_LOG_UART_RX_BUF_SIZE (256)
2727
#define BLE_LOG_UART_DMA_BURST_SIZE (32)
2828
#if BLE_LOG_PRPH_UART_DMA_REDIR
2929
#define BLE_LOG_UART_REDIR_BUF_SIZE (512)
@@ -95,8 +95,6 @@ bool ble_log_prph_init(size_t trans_cnt)
9595
.data_bits = UART_DATA_8_BITS,
9696
.parity = UART_PARITY_DISABLE,
9797
.stop_bits = UART_STOP_BITS_1,
98-
.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS,
99-
.rx_flow_ctrl_thresh = 122,
10098
};
10199
if ((uart_param_config(CONFIG_BLE_LOG_PRPH_UART_DMA_PORT, &uart_config) != ESP_OK) ||
102100
(uart_set_pin(CONFIG_BLE_LOG_PRPH_UART_DMA_PORT,

components/bt/controller/esp32/bt.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@
4848
#include "esp_rom_sys.h"
4949
#include "hli_api.h"
5050

51+
#if CONFIG_BLE_LOG_ENABLED
52+
#include "ble_log.h"
53+
#else /* !CONFIG_BLE_LOG_ENABLED */
5154
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
5255
#include "ble_log/ble_log_spi_out.h"
5356
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
57+
#endif /* CONFIG_BLE_LOG_ENABLED */
5458

5559
#if CONFIG_BT_ENABLED
5660

@@ -1702,13 +1706,21 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
17021706
coex_init();
17031707
#endif
17041708

1709+
#if CONFIG_BLE_LOG_ENABLED
1710+
if (!ble_log_init()) {
1711+
ESP_LOGE(BTDM_LOG_TAG, "BLE Log v2 init failed");
1712+
err = ESP_ERR_NO_MEM;
1713+
goto error;
1714+
}
1715+
#else /* !CONFIG_BLE_LOG_ENABLED */
17051716
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
17061717
if (ble_log_spi_out_init() != 0) {
17071718
ESP_LOGE(BTDM_LOG_TAG, "BLE Log SPI output init failed");
17081719
err = ESP_ERR_NO_MEM;
17091720
goto error;
17101721
}
17111722
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
1723+
#endif /* CONFIG_BLE_LOG_ENABLED */
17121724

17131725
btdm_cfg_mask = btdm_config_mask_load();
17141726

@@ -1737,9 +1749,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
17371749

17381750
error:
17391751

1752+
#if CONFIG_BLE_LOG_ENABLED
1753+
ble_log_deinit();
1754+
#else /* !CONFIG_BLE_LOG_ENABLED */
17401755
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
17411756
ble_log_spi_out_deinit();
17421757
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
1758+
#endif /* CONFIG_BLE_LOG_ENABLED */
17431759

17441760
bt_controller_deinit_internal();
17451761

@@ -1752,9 +1768,13 @@ esp_err_t esp_bt_controller_deinit(void)
17521768
return ESP_ERR_INVALID_STATE;
17531769
}
17541770

1771+
#if CONFIG_BLE_LOG_ENABLED
1772+
ble_log_deinit();
1773+
#else /* !CONFIG_BLE_LOG_ENABLED */
17551774
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
17561775
ble_log_spi_out_deinit();
17571776
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
1777+
#endif /* CONFIG_BLE_LOG_ENABLED */
17581778

17591779
btdm_controller_deinit();
17601780

components/bt/controller/esp32c2/Kconfig.in

Lines changed: 68 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -288,74 +288,83 @@ menu "Controller debug features"
288288
help
289289
Enable controller log
290290

291-
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
292-
bool "enable controller log module"
293-
depends on BT_LE_CONTROLLER_LOG_ENABLED
294-
default y
295-
help
296-
Enable controller log module
297-
298-
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
299-
bool "enable HCI log module"
300-
depends on BT_LE_CONTROLLER_LOG_ENABLED
291+
config BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
292+
bool "Utilize BLE Log v2 for controller log"
293+
depends on BLE_LOG_ENABLED
301294
default y
302295
help
303-
Enable hci log module
296+
Utilize BLE Log v2 for controller log
304297

305-
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
306-
bool "Controller log dump mode only"
307-
depends on BT_LE_CONTROLLER_LOG_ENABLED
308-
default y
309-
help
310-
Only operate in dump mode
298+
if !BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
299+
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
300+
bool "enable controller log module"
301+
depends on BT_LE_CONTROLLER_LOG_ENABLED
302+
default y
303+
help
304+
Enable controller log module
311305

312-
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
313-
bool "Output ble controller logs to SPI bus (Experimental)"
314-
depends on BT_LE_CONTROLLER_LOG_ENABLED
315-
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
316-
select BT_BLE_LOG_SPI_OUT_ENABLED
317-
default n
318-
help
319-
Output ble controller logs to SPI bus
306+
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
307+
bool "enable HCI log module"
308+
depends on BT_LE_CONTROLLER_LOG_ENABLED
309+
default y
310+
help
311+
Enable hci log module
320312

321-
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
322-
bool "Store ble controller logs to flash(Experimental)"
323-
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
324-
depends on BT_LE_CONTROLLER_LOG_ENABLED
325-
default n
326-
help
327-
Store ble controller logs to flash memory.
313+
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
314+
bool "Controller log dump mode only"
315+
depends on BT_LE_CONTROLLER_LOG_ENABLED
316+
default y
317+
help
318+
Only operate in dump mode
319+
320+
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
321+
bool "Output ble controller logs to SPI bus (Experimental)"
322+
depends on BT_LE_CONTROLLER_LOG_ENABLED
323+
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
324+
select BT_BLE_LOG_SPI_OUT_ENABLED
325+
default n
326+
help
327+
Output ble controller logs to SPI bus
328328

329-
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
330-
int "size of ble controller log partition(Multiples of 4K)"
331-
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
332-
default 65536
333-
help
334-
The size of ble controller log partition shall be a multiples of 4K.
335-
The name of log partition shall be "bt_ctrl_log".
336-
The partition type shall be ESP_PARTITION_TYPE_DATA.
337-
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
329+
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
330+
bool "Store ble controller logs to flash(Experimental)"
331+
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
332+
depends on BT_LE_CONTROLLER_LOG_ENABLED
333+
default n
334+
help
335+
Store ble controller logs to flash memory.
338336

339-
config BT_LE_LOG_CTRL_BUF1_SIZE
340-
int "size of the first BLE controller LOG buffer"
341-
depends on BT_LE_CONTROLLER_LOG_ENABLED
342-
default 4096
343-
help
344-
Configure the size of the first BLE controller LOG buffer.
337+
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
338+
int "size of ble controller log partition(Multiples of 4K)"
339+
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
340+
default 65536
341+
help
342+
The size of ble controller log partition shall be a multiples of 4K.
343+
The name of log partition shall be "bt_ctrl_log".
344+
The partition type shall be ESP_PARTITION_TYPE_DATA.
345+
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
346+
347+
config BT_LE_LOG_CTRL_BUF1_SIZE
348+
int "size of the first BLE controller LOG buffer"
349+
depends on BT_LE_CONTROLLER_LOG_ENABLED
350+
default 4096
351+
help
352+
Configure the size of the first BLE controller LOG buffer.
345353

346-
config BT_LE_LOG_CTRL_BUF2_SIZE
347-
int "size of the second BLE controller LOG buffer"
348-
depends on BT_LE_CONTROLLER_LOG_ENABLED
349-
default 1024
350-
help
351-
Configure the size of the second BLE controller LOG buffer.
354+
config BT_LE_LOG_CTRL_BUF2_SIZE
355+
int "size of the second BLE controller LOG buffer"
356+
depends on BT_LE_CONTROLLER_LOG_ENABLED
357+
default 1024
358+
help
359+
Configure the size of the second BLE controller LOG buffer.
352360

353-
config BT_LE_LOG_HCI_BUF_SIZE
354-
int "size of the BLE HCI LOG buffer"
355-
depends on BT_LE_CONTROLLER_LOG_ENABLED
356-
default 4096
357-
help
358-
Configure the size of the BLE HCI LOG buffer.
361+
config BT_LE_LOG_HCI_BUF_SIZE
362+
int "size of the BLE HCI LOG buffer"
363+
depends on BT_LE_CONTROLLER_LOG_ENABLED
364+
default 4096
365+
help
366+
Configure the size of the BLE HCI LOG buffer.
367+
endif
359368

360369
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
361370
bool "Enable wrap panic handler"

0 commit comments

Comments
 (0)