Skip to content

Commit 85a88f3

Browse files
committed
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
2 parents f3625b0 + d2c8825 commit 85a88f3

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

components/espcoredump/src/core_dump_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ static esp_err_t esp_core_dump_uart_write_data(core_dump_write_data_t *wr_data,
120120
/* Copy to stack to avoid alignment restrictions. */
121121
char *tmp = buf + (sizeof(buf) - len);
122122
memcpy(tmp, addr, len);
123+
esp_core_dump_checksum_update(&wr_data->checksum_ctx, tmp, len);
123124
esp_core_dump_b64_encode((const uint8_t *)tmp, len, (uint8_t *)buf);
124125
addr += len;
125126
ESP_COREDUMP_PRINT("%s\r\n", buf);
126127
}
127128

128129
if (wr_data) {
129130
wr_data->off += data_len;
130-
esp_core_dump_checksum_update(&wr_data->checksum_ctx, data, data_len);
131131
}
132132
return err;
133133
}

tools/test_apps/system/panic/pytest_panic.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
)
9393
)
9494

95-
CONFIG_CAPTURE_DRAM = list(itertools.chain(itertools.product(['coredump_flash_capture_dram'], TARGETS_ALL)))
95+
CONFIG_CAPTURE_DRAM = list(
96+
itertools.chain(itertools.product(['coredump_flash_capture_dram', 'coredump_uart_capture_dram'], TARGETS_ALL))
97+
)
9698

9799
CONFIG_COREDUMP_SUMMARY = list(itertools.chain(itertools.product(['coredump_flash_elf_sha'], TARGETS_ALL)))
98100

@@ -1085,9 +1087,15 @@ def test_capture_dram(dut: PanicTestDut, config: str, test_func_name: str) -> No
10851087
dut.expect_elf_sha256()
10861088
dut.expect_none(['Guru Meditation', 'Re-entered core dump'])
10871089

1088-
expect_coredump_flash_write_logs(dut, config)
1090+
core_elf_file = None
1091+
if 'flash' in config:
1092+
expect_coredump_flash_write_logs(dut, config)
1093+
core_elf_file = dut.process_coredump_flash()
1094+
elif 'uart' in config:
1095+
coredump_base64 = expect_coredump_uart_write_logs(dut)
1096+
core_elf_file = dut.process_coredump_uart(coredump_base64)
1097+
assert core_elf_file is not None
10891098

1090-
core_elf_file = dut.process_coredump_flash()
10911099
dut.start_gdb_for_coredump(core_elf_file)
10921100

10931101
assert dut.gdb_data_eval_expr('g_data_var') == '43'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_ESP_COREDUMP_ENABLE_TO_UART=y
2+
CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y
3+
CONFIG_ESP_COREDUMP_CHECKSUM_SHA256=y
4+
CONFIG_ESP_COREDUMP_CAPTURE_DRAM=y
5+
CONFIG_LOG_DEFAULT_LEVEL_INFO=y

tools/test_apps/system/panic/test_panic_util/panic_dut.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,19 @@ def _call_espcoredump(
165165

166166
def process_coredump_uart(
167167
self, coredump_base64: Any, expected: Optional[List[Union[str, re.Pattern]]] = None,
168-
) -> None:
168+
) -> Any:
169169
with open(os.path.join(self.logdir, 'coredump_data.b64'), 'w') as coredump_file:
170170
logging.info('Writing UART base64 core dump to %s', coredump_file.name)
171171
coredump_file.write(coredump_base64)
172172

173173
output_file_name = os.path.join(self.logdir, 'coredump_uart_result.txt')
174+
coredump_elf_file = os.path.join(self.logdir, 'coredump_data.elf')
174175
self._call_espcoredump(
175-
['--core-format', 'b64', '--core', coredump_file.name], output_file_name
176+
['--core-format', 'b64', '--core', coredump_file.name, '--save-core', coredump_elf_file], output_file_name
176177
)
177178
if expected:
178179
self.expect_coredump(output_file_name, expected)
180+
return coredump_elf_file
179181

180182
def process_coredump_flash(self, expected: Optional[List[Union[str, re.Pattern]]] = None) -> Any:
181183
coredump_file_name = os.path.join(self.logdir, 'coredump_data.bin')

0 commit comments

Comments
 (0)