arduino / ArduinoCore-mbed

330 stars 196 forks source link

Accessing mbed errors history #908

Open Goliath86 opened 3 months ago

Goliath86 commented 3 months ago

Hi, how can I access the functions _mbed_get_error_histcount() and _mbed_get_error_histinfo()? I can't compile if I use it

This is the function I use to try to get the errors history:

void getErrorInfoFromHist() { mbed_error_ctx hist_error_ctx; int numEntriesInHist = mbed_get_error_hist_count(); for (int i = 0; i < numEntriesInHist; i++) { mbed_get_error_hist_info(i, &hist_error_ctx); printf(MBED_GET_ERROR_CODE(hist_error_ctx.error_status)); } mbed_clear_all_errors(); }

But when I compile I get:

_undefined reference to mbed_get_error_hist_count undefined reference to mbed_get_error_histinfo

Thank you

pennam commented 3 months ago

Hi @Goliath86 this two functions are not enabled by default if you need to use them you have to rebuild libmbed.a and enable MBED_CONF_PLATFORM_ERROR_HIST_ENABLED