Skip to content

Commit f8d7c31

Browse files
author
Cruz Monrreal
authored
Merge pull request #9188 from SenRamakri/sen_ErrorUrlEnhance
Add more information to error url to enhance error analytics
2 parents b9d5dce + 3e6dafa commit f8d7c31

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

platform/mbed_error.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "platform/mbed_error_hist.h"
2626
#include "platform/mbed_interface.h"
2727
#include "platform/mbed_power_mgmt.h"
28+
#include "platform/mbed_stats.h"
2829
#ifdef MBED_CONF_RTOS_PRESENT
2930
#include "rtx_os.h"
3031
#endif
@@ -454,6 +455,8 @@ static void print_threads_info(const osRtxThread_t *threads)
454455
#endif
455456

456457
#ifndef NDEBUG
458+
#define GET_TARGET_NAME_STR(tgt_name) #tgt_name
459+
#define GET_TARGET_NAME(tgt_name) GET_TARGET_NAME_STR(tgt_name)
457460
static void print_error_report(const mbed_error_ctx *ctx, const char *error_msg, const char *error_filename, int error_line)
458461
{
459462
int error_code = MBED_GET_ERROR_CODE(ctx->error_status);
@@ -539,11 +542,18 @@ static void print_error_report(const mbed_error_ctx *ctx, const char *error_msg,
539542
mbed_error_printf("\nDelay:");
540543
print_threads_info(osRtxInfo.thread.delay_list);
541544
#endif
542-
mbed_error_printf(MBED_CONF_PLATFORM_ERROR_DECODE_HTTP_URL_STR, ctx->error_status);
545+
#if !defined(MBED_SYS_STATS_ENABLED)
546+
mbed_error_printf("\nFor more info, visit: https://mbed.com/s/error?error=0x%08X&tgt=" GET_TARGET_NAME(TARGET_NAME), ctx->error_status);
547+
#else
548+
mbed_stats_sys_t sys_stats;
549+
mbed_stats_sys_get(&sys_stats);
550+
mbed_error_printf("\nFor more info, visit: https://mbed.com/s/error?error=0x%08X&osver=%d&core=0x%08X&comp=%d&ver=%d&tgt=" GET_TARGET_NAME(TARGET_NAME), ctx->error_status, sys_stats.os_version, sys_stats.cpu_id, sys_stats.compiler_id, sys_stats.compiler_version);
551+
#endif
543552
mbed_error_printf("\n-- MbedOS Error Info --\n");
544553
}
545554
#endif //ifndef NDEBUG
546555

556+
547557
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED
548558
//Retrieve the error context from error log at the specified index
549559
mbed_error_status_t mbed_get_error_hist_info(int index, mbed_error_ctx *error_info)

platform/mbed_lib.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@
108108
"value": null
109109
},
110110

111-
"error-decode-http-url-str": {
112-
"help": "HTTP URL string for ARM Mbed-OS Error Decode microsite",
113-
"value": "\"\\nFor more info, visit: https://armmbed.github.io/mbedos-error/?error=0x%08X\""
114-
},
115-
116111
"cthunk_count_max": {
117112
"help": "The maximum CThunk objects used at the same time. This must be greater than 0 and less 256",
118113
"value": 8

tools/toolchains/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def get_symbols(self, for_asm=False):
201201
if MBED_ORG_USER:
202202
self.cxx_symbols.append('MBED_USERNAME=' + MBED_ORG_USER)
203203

204+
# Add target's name
205+
self.cxx_symbols += ["TARGET_NAME=" + self.target.name]
204206
# Add target's symbols
205207
self.cxx_symbols += self.target.macros
206208
# Add target's hardware

0 commit comments

Comments
 (0)