mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'feat/debug_probe_esp32s31_v6.1' into 'release/v6.1'
feat(debug): add esp32s31 debug probe support (v6.1) See merge request espressif/esp-idf!48893
This commit is contained in:
@@ -224,8 +224,7 @@ esp_err_t debug_probe_chan_add_signal_by_byte(debug_probe_channel_handle_t chan,
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(chan, ESP_ERR_INVALID_ARG, TAG, "invalid args");
|
||||
debug_probe_unit_t *unit = chan->unit;
|
||||
ESP_RETURN_ON_FALSE(byte_idx < ((unit->unit_id == DEBUG_PROBE_UNIT_LP) ? 2 : 4),
|
||||
ESP_ERR_INVALID_ARG, TAG, "byte_idx out of range");
|
||||
ESP_RETURN_ON_FALSE(byte_idx < 4, ESP_ERR_INVALID_ARG, TAG, "byte_idx out of range");
|
||||
ESP_RETURN_ON_FALSE(sig_group < 16, ESP_ERR_INVALID_ARG, TAG, "sig_group out of range");
|
||||
debug_probe_ll_channel_add_signal_group(unit->unit_id, chan->chan_id, byte_idx, sig_group);
|
||||
return ESP_OK;
|
||||
|
||||
@@ -66,7 +66,7 @@ esp_err_t debug_probe_del_unit(debug_probe_unit_handle_t unit);
|
||||
*/
|
||||
typedef struct {
|
||||
union {
|
||||
debug_probe_target_t hp_target; ///< Target when unit is HP
|
||||
debug_probe_target_hp_t hp_target; ///< Target when unit is HP
|
||||
debug_probe_target_lp_t lp_target; ///< Target when unit is LP
|
||||
} target_module;
|
||||
} debug_probe_channel_config_t;
|
||||
@@ -106,10 +106,10 @@ esp_err_t debug_probe_del_channel(debug_probe_channel_handle_t chan);
|
||||
* byte_idx = 1: signal 8-15 in the group
|
||||
* ...
|
||||
* @note If you add the signals from different groups but with the same byte_idx, only the last added signal will be effective.
|
||||
* @note You can save up to 32 signals in a channel, but in the end, only the part of them (e.g. upper or lower 16 signals) can be output to the GPIO pads.
|
||||
* @note You can save up to 32 signals in a channel, but only 16 of them can be routed to GPIO pads at a time.
|
||||
*
|
||||
* @param[in] chan Handle of the debug probe channel
|
||||
* @param[in] byte_idx Byte index (HP: 0-3, LP: 0-1)
|
||||
* @param[in] byte_idx Byte index (0-3)
|
||||
* @param[in] sig_group Signal group of the signal, ranges from 0 to 15
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
|
||||
@@ -22,12 +22,12 @@ extern "C" {
|
||||
#if SOC_DEBUG_PROBE_SUPPORTED
|
||||
#define DEBUG_PROBE_MAX_OUTPUT_WIDTH SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH
|
||||
#define DEBUG_PROBE_GPIO_NUMS_NONE { [0 ... (SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH - 1)] = -1 }
|
||||
typedef soc_debug_probe_target_t debug_probe_target_t;
|
||||
typedef soc_debug_probe_target_hp_t debug_probe_target_hp_t;
|
||||
typedef soc_debug_probe_target_lp_t debug_probe_target_lp_t;
|
||||
#else
|
||||
#define DEBUG_PROBE_MAX_OUTPUT_WIDTH 16
|
||||
#define DEBUG_PROBE_GPIO_NUMS_NONE { [0 ... 15] = -1 }
|
||||
typedef int debug_probe_target_t;
|
||||
typedef int debug_probe_target_hp_t;
|
||||
typedef int debug_probe_target_lp_t;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ esp_err_t esp_vbat_init(void)
|
||||
#endif
|
||||
ESP_ERROR_CHECK(debug_probe_new_unit(&unit_config, &lp_probe_hdl));
|
||||
ESP_ERROR_CHECK(debug_probe_new_channel(lp_probe_hdl, &chan_config, &lp_probe_channel_hdl));
|
||||
ESP_ERROR_CHECK(debug_probe_chan_add_signal_by_byte(lp_probe_channel_hdl, 1, DEBUG_PROBE_TARGET_LP_PMU));
|
||||
ESP_ERROR_CHECK(debug_probe_chan_add_signal_by_byte(lp_probe_channel_hdl, 1, 0));
|
||||
ESP_ERROR_CHECK(debug_probe_unit_merge16(lp_probe_hdl, lp_probe_channel_hdl, DEBUG_PROBE_SPLIT_UPPER16, NULL, 0));
|
||||
}
|
||||
// The LP Probe & LP IOMUX pathways depend on the LP_PERIPH power domain.
|
||||
|
||||
+48
-5
@@ -34,9 +34,9 @@ TEST_CASE("debug probe install & uninstall", "[debug_probe]")
|
||||
for (int i = 0; i < SOC_DEBUG_PROBE_NUM_UNIT; i++) {
|
||||
debug_probe_channel_config_t chan_config = {0};
|
||||
if (i == 0) {
|
||||
chan_config.target_module.hp_target = DEBUG_PROBE_TARGET_AXI_GDMA;
|
||||
chan_config.target_module.hp_target = DEBUG_PROBE_TARGET_HP_CORE;
|
||||
} else {
|
||||
chan_config.target_module.lp_target = DEBUG_PROBE_TARGET_LP_PMU;
|
||||
chan_config.target_module.lp_target = DEBUG_PROBE_TARGET_LP_CORE;
|
||||
}
|
||||
for (int j = 0; j < DEBUG_PROBE_LL_CHANNELS_PER_UNIT; j++) {
|
||||
TEST_ESP_OK(debug_probe_new_channel(probe_units[i], &chan_config, &probe_chans[i][j]));
|
||||
@@ -52,7 +52,7 @@ TEST_CASE("debug probe install & uninstall", "[debug_probe]")
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("debug probe read", "[debug_probe]")
|
||||
TEST_CASE("debug probe HP read", "[debug_probe]")
|
||||
{
|
||||
debug_probe_unit_config_t unit_config = {
|
||||
.unit_id = DEBUG_PROBE_UNIT_HP,
|
||||
@@ -63,9 +63,13 @@ TEST_CASE("debug probe read", "[debug_probe]")
|
||||
|
||||
// allocate two channels from the unit, each channel monitor different target module
|
||||
debug_probe_channel_handle_t probe_chans[2] = {0};
|
||||
const debug_probe_target_hp_t targets[2] = {
|
||||
DEBUG_PROBE_TARGET_HP_MSPI_FLASH,
|
||||
DEBUG_PROBE_TARGET_HP_CORE,
|
||||
};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
debug_probe_channel_config_t chan_config = {0};
|
||||
chan_config.target_module.hp_target = (debug_probe_target_t)(i + 1);
|
||||
chan_config.target_module.hp_target = targets[i];
|
||||
TEST_ESP_OK(debug_probe_new_channel(probe_unit, &chan_config, &probe_chans[i]));
|
||||
|
||||
// group15[7:0] contains the debug target module ID
|
||||
@@ -81,7 +85,7 @@ TEST_CASE("debug probe read", "[debug_probe]")
|
||||
uint32_t probe_result = 0;
|
||||
TEST_ESP_OK(debug_probe_unit_read(probe_unit, &probe_result));
|
||||
printf("probe result: 0x%"PRIx32"\r\n", probe_result);
|
||||
TEST_ASSERT_EQUAL_HEX32(0x20001, probe_result);
|
||||
TEST_ASSERT_EQUAL_HEX32(0xE0006, probe_result);
|
||||
|
||||
// free resources
|
||||
for (int i = 0; i < 2; i++) {
|
||||
@@ -89,3 +93,42 @@ TEST_CASE("debug probe read", "[debug_probe]")
|
||||
}
|
||||
TEST_ESP_OK(debug_probe_del_unit(probe_unit));
|
||||
}
|
||||
|
||||
TEST_CASE("debug probe LP read", "[debug_probe]")
|
||||
{
|
||||
debug_probe_unit_config_t unit_config = {
|
||||
.unit_id = DEBUG_PROBE_UNIT_LP,
|
||||
.probe_out_gpio_nums = DEBUG_PROBE_GPIO_NUMS_NONE,
|
||||
};
|
||||
debug_probe_unit_handle_t probe_unit = NULL;
|
||||
TEST_ESP_OK(debug_probe_new_unit(&unit_config, &probe_unit));
|
||||
|
||||
debug_probe_channel_handle_t probe_chans[2] = {0};
|
||||
const debug_probe_target_lp_t targets[2] = {
|
||||
DEBUG_PROBE_TARGET_LP_PMU,
|
||||
DEBUG_PROBE_TARGET_LP_CORE,
|
||||
};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
debug_probe_channel_config_t chan_config = {0};
|
||||
chan_config.target_module.lp_target = targets[i];
|
||||
TEST_ESP_OK(debug_probe_new_channel(probe_unit, &chan_config, &probe_chans[i]));
|
||||
|
||||
TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 0, 15));
|
||||
TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 1, 15));
|
||||
TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 2, 15));
|
||||
TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 3, 15));
|
||||
}
|
||||
|
||||
TEST_ESP_OK(debug_probe_unit_merge16(probe_unit,
|
||||
probe_chans[0], DEBUG_PROBE_SPLIT_LOWER16,
|
||||
probe_chans[1], DEBUG_PROBE_SPLIT_LOWER16));
|
||||
uint32_t probe_result = 0;
|
||||
TEST_ESP_OK(debug_probe_unit_read(probe_unit, &probe_result));
|
||||
printf("LP probe result: 0x%"PRIx32"\r\n", probe_result);
|
||||
TEST_ASSERT_EQUAL_HEX32(0x1F0025, probe_result);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
TEST_ESP_OK(debug_probe_del_channel(probe_chans[i]));
|
||||
}
|
||||
TEST_ESP_OK(debug_probe_del_unit(probe_unit));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user