forked from espressif/esp-idf
Merge branch 'fix/coredump_uart_checksum_error' into 'master'
Fix/coredump uart checksum error Closes IDF-12696 and IDFGH-14580 See merge request espressif/esp-idf!38031
This commit is contained in:
@@ -120,6 +120,7 @@ static esp_err_t esp_core_dump_uart_write_data(core_dump_write_data_t *wr_data,
|
||||
/* Copy to stack to avoid alignment restrictions. */
|
||||
char *tmp = buf + (sizeof(buf) - len);
|
||||
memcpy(tmp, addr, len);
|
||||
esp_core_dump_checksum_update(&wr_data->checksum_ctx, tmp, len);
|
||||
esp_core_dump_b64_encode((const uint8_t *)tmp, len, (uint8_t *)buf);
|
||||
addr += len;
|
||||
ESP_COREDUMP_PRINT("%s\r\n", buf);
|
||||
@@ -127,7 +128,6 @@ static esp_err_t esp_core_dump_uart_write_data(core_dump_write_data_t *wr_data,
|
||||
|
||||
if (wr_data) {
|
||||
wr_data->off += data_len;
|
||||
esp_core_dump_checksum_update(&wr_data->checksum_ctx, data, data_len);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@@ -92,7 +92,9 @@ CONFIGS_HW_STACK_GUARD_DUAL_CORE = list(
|
||||
)
|
||||
)
|
||||
|
||||
CONFIG_CAPTURE_DRAM = list(itertools.chain(itertools.product(['coredump_flash_capture_dram'], TARGETS_ALL)))
|
||||
CONFIG_CAPTURE_DRAM = list(
|
||||
itertools.chain(itertools.product(['coredump_flash_capture_dram', 'coredump_uart_capture_dram'], TARGETS_ALL))
|
||||
)
|
||||
|
||||
CONFIG_COREDUMP_SUMMARY = list(itertools.chain(itertools.product(['coredump_flash_elf_sha'], TARGETS_ALL)))
|
||||
|
||||
@@ -1085,9 +1087,15 @@ def test_capture_dram(dut: PanicTestDut, config: str, test_func_name: str) -> No
|
||||
dut.expect_elf_sha256()
|
||||
dut.expect_none(['Guru Meditation', 'Re-entered core dump'])
|
||||
|
||||
expect_coredump_flash_write_logs(dut, config)
|
||||
core_elf_file = None
|
||||
if 'flash' in config:
|
||||
expect_coredump_flash_write_logs(dut, config)
|
||||
core_elf_file = dut.process_coredump_flash()
|
||||
elif 'uart' in config:
|
||||
coredump_base64 = expect_coredump_uart_write_logs(dut)
|
||||
core_elf_file = dut.process_coredump_uart(coredump_base64)
|
||||
assert core_elf_file is not None
|
||||
|
||||
core_elf_file = dut.process_coredump_flash()
|
||||
dut.start_gdb_for_coredump(core_elf_file)
|
||||
|
||||
assert dut.gdb_data_eval_expr('g_data_var') == '43'
|
||||
|
@@ -0,0 +1,5 @@
|
||||
CONFIG_ESP_COREDUMP_ENABLE_TO_UART=y
|
||||
CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y
|
||||
CONFIG_ESP_COREDUMP_CHECKSUM_SHA256=y
|
||||
CONFIG_ESP_COREDUMP_CAPTURE_DRAM=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
@@ -165,17 +165,19 @@ class PanicTestDut(IdfDut):
|
||||
|
||||
def process_coredump_uart(
|
||||
self, coredump_base64: Any, expected: Optional[List[Union[str, re.Pattern]]] = None,
|
||||
) -> None:
|
||||
) -> Any:
|
||||
with open(os.path.join(self.logdir, 'coredump_data.b64'), 'w') as coredump_file:
|
||||
logging.info('Writing UART base64 core dump to %s', coredump_file.name)
|
||||
coredump_file.write(coredump_base64)
|
||||
|
||||
output_file_name = os.path.join(self.logdir, 'coredump_uart_result.txt')
|
||||
coredump_elf_file = os.path.join(self.logdir, 'coredump_data.elf')
|
||||
self._call_espcoredump(
|
||||
['--core-format', 'b64', '--core', coredump_file.name], output_file_name
|
||||
['--core-format', 'b64', '--core', coredump_file.name, '--save-core', coredump_elf_file], output_file_name
|
||||
)
|
||||
if expected:
|
||||
self.expect_coredump(output_file_name, expected)
|
||||
return coredump_elf_file
|
||||
|
||||
def process_coredump_flash(self, expected: Optional[List[Union[str, re.Pattern]]] = None) -> Any:
|
||||
coredump_file_name = os.path.join(self.logdir, 'coredump_data.bin')
|
||||
|
Reference in New Issue
Block a user