核心转储上传服务

[English]

如需调查已出售设备中的 crash 事件,则需要回收回溯信息进行分析。核心转储上传服务 (core dump upload service) 支持通过 HTTP 将存储在设备分区中的回溯信息传输回来。选择 ESP_COREDUMP_ENABLE_TO_FLASH,即可启用此功能。

应用示例

以下示例展示了该 API 的实现方式。

Header File

Functions

bool coredump_need_upload()

This function will check the reset code and determine whether to upload the coredump.

Return

  • true: last reboot is a abnormal reset.

  • false

esp_err_t coredump_upload(periph_service_handle_t handle, char *url)

Upload the core dump image to the url. This function will block the current task until the upload process finished.

Return

  • ESP_OK

  • ESP_FAIL

Parameters
  • [in] handle: the ‘periph_service_handle_t’

  • [in] url: server addr

periph_service_handle_t coredump_upload_service_create(coredump_upload_service_config_t *config)

Create the core dump upload service instance.

Return

  • NULL: Failed

  • Others: Success

Parameters
  • config: configuration of the OTA service

Structures

struct coredump_upload_service_config_t

coredump service configuration parameters

Public Members

int task_stack

>0 Service task stack; =0 with out task created

int task_prio

Service task priority (based on freeRTOS priority)

int task_core

Service task running in core (0 or 1)

periph_service_cb evt_cb

Service callback function

void *cb_ctx

Callback context

bool (*do_post)(char *url, uint8_t *data, size_t len)

POST interface, users can override this to customize the http client. if left NULL, the service will use the default one

Macros

COREDUMP_UPLOAD_SERVICE_DEFAULT_CONFIG()