Commit Graph

51 Commits (bd9a73847393318ba21c22f22bd0d5aa1ba568c9)

Author SHA1 Message Date
Naveen Kaje de271d4ba8 platform: fix build warning in mbed_error
Fix the following build warning

Compile [ 83.4%]: mbed_error.c
[Warning] mbed_error.c@71,21: 'compute_crc32' defined but not used [-Wunused-function]

compute_crc32 usage is guraded with #define, but not the definition.
Use the same #define around the definition of compute_crc32()
2019-02-12 16:20:25 -06:00
Kevin Bracey d55640340d Halt to enforce reboot limit once only
The pre-main check of error_reboot_count was applied repeatedly on
every boot, meaning that once the reboot limit was hit, every subsequent
reset would halt before main, until something managed to clear
or corrupt the error context.

Set the is_error_processed flag before halting, so that when an external
agent resets us while we're halted, we do not report the error and halt
again.
2019-01-30 12:58:25 +02:00
Senthil Ramakrishnan d0b95031c5 Print crash report reboot messages only for non-release builds 2019-01-23 17:40:05 -06:00
Senthil Ramakrishnan cc5969b1ec Remove printf completely and fix the optimization check 2019-01-22 16:04:47 -06:00
Senthil Ramakrishnan f10ed4b286 Add more information to error url to enhance error analytics 2019-01-04 09:24:31 -06:00
Senthil Ramakrishnan daa8b0e5c1 Disable printf in crash reporting for release builds 2018-12-20 13:47:35 -06:00
Martin Kojtal ad759b7749 platform: add spdx license 2018-11-28 10:39:52 +00:00
Senthil Ramakrishnan f59b99d889 Removing support for printing error-report after reboot and other minor fixes 2018-11-18 22:42:37 -06:00
Senthil Ramakrishnan 423b52e1c3 Fix crc calculation error, code-style issues and other fixes 2018-11-16 17:24:52 -06:00
Senthil Ramakrishnan a07a373c9f Change the reboot-max value semantics and code style and other fixes 2018-11-16 14:00:00 -06:00
Senthil Ramakrishnan 254062fc5a Add thread safety across reboot error info operations 2018-11-16 14:00:00 -06:00
Senthil Ramakrishnan 6181394e37 Error and fault handling changes for crash reporting 2018-11-16 13:59:59 -06:00
Kevin Bracey 638e071820 mbed_error.c: Fix format specifiers 2018-10-31 14:49:22 +02:00
Kevin Bracey ea16a6ba1d Add MBED_NORETURN attributes
Save some ROM space by putting MBED_NORETURN attributes on error
functions and failed asserts.

mbed_error was documented as returning an error code. It never
actually could return, so documentation updated, but return type
kept.
2018-10-29 13:58:06 +02:00
Kevin Bracey 57748bd46e Adjust error paths locking and returning
Various fixes in preparation for making sure error calls do not return.

* Clear out handle_error's use of error_in_progress as a sort of spin
  lock; this is most likely to deadlock if ever activated, and conflicts
  with error's use of error_in_progress. Use a normal critical section lock.

* Make error use same mbed_halt_system helper as mbed_error.

* Make error's recursion check avoid print and proceed to halt, rather
  than returning.

* Make mbed_error use error_in_progress to avoid recursion in same way
  as error() does.

* Give mbed_halt_system its own recursion check in case of error in
  mbed_die - give it a simple fallback.

* Make the in_progress things properly atomic, just in case.
2018-10-29 13:58:06 +02:00
Kevin Bracey 500e37f3a2 mbed_error: Always print full filename if passed
Don't extract filename from the stored error - print it directly.

Use "mbed_error_puts" for both error message and filename to avoid
buffer length limits.

Switch to puts also fixes the potential problem of an error message
containing a '%' upsetting the formatter - it should have been
mbed_printf_error("%s", error_msg) in the first place.
2018-10-22 09:53:21 +03:00
Kevin Bracey 10fe32277d mbed_error: Print thread names
As part of this, don't show empty current thread info in non-RTOS
build.
2018-10-22 09:53:21 +03:00
Kevin Bracey c3d0e2c2ef mbed_error: Correct full thread info print
Casts were covering up a type mismatch.

Print the "ready" list, and remove the explicit print of the idle thread
(it should be in the ready list).
2018-10-22 09:53:21 +03:00
Kevin Bracey 25d0fbaaeb mbed_error: remove redundant memset
If we want zero-fill, strncpy does it anyway.
2018-10-22 09:53:20 +03:00
Kevin Bracey c2076b5ec4 mbed_error: Simplify read of stack pointer 2018-10-22 09:53:20 +03:00
Kevin Bracey c989845d5a mbed_error_vfprintf -> mbed_error_vprintf
Name vfprintf doesn't make sense - if we have mbed_error_printf, this is
vprintf.
2018-10-17 12:55:20 +03:00
MateuszMaz e6ae3d2c51 Remove stray error_value 2018-10-09 18:49:47 +02:00
MateuszMaz cf43e1cb5c Fix message string 2018-10-08 18:41:50 +02:00
MateuszMaz 845655b621 Add case MBED_ERROR_CODE_ASSERTION_FAILED, fix names, pass expr to mbed_error 2018-10-05 21:15:03 +02:00
Tero Jääskö 321548cadc platform: error: fix bogus usage of memset()
Code had mixed up order of 'c' and 'n' arguments to memset().
Fix this.

Spotted-by: kjbracey-arm & a GCC profile without "-fno-builtin"

Related GCC warnings:
---8<---8<----
[Warning] mbed_error.c@123,5: 'memset' used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
[Warning] mbed_error.c@282,5: 'memset' used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
2018-09-07 15:40:44 +03:00
Senthil Ramakrishnan e84e56bc8d Add Error Decoding URL in error report 2018-08-30 12:19:59 +01:00
Brendan Moran 96fbd02f8c
Make location meaningful in print_error_report
`handle_error` calls `MBED_CALLER_ADDR()`, but this is always a location from within platform/mbed_error.c. This is because `handle_error` is declared static. This does not cause the function to be inlined however. Instead, it is called by each function within mbed_error.c. For example, mbed_error yields this code:

```
000625c8 <mbed_error>:
   625c8:       b510            push    {r4, lr}
   625ca:       460c            mov     r4, r1
   625cc:       4611            mov     r1, r2
   625ce:       461a            mov     r2, r3
   625d0:       9b02            ldr     r3, [sp, #8]
   625d2:       f7ff feff       bl      623d4 <handle_error>
   625d6:       b968            cbnz    r0, 625f4 <mbed_error+0x2c>
   625d8:       4620            mov     r0, r4
   625da:       f7ff ff67       bl      624ac <print_error_report.constprop.0>
   625de:       f7ff fea8       bl      62332 <core_util_is_isr_active>
   625e2:       b910            cbnz    r0, 625ea <mbed_error+0x22>
   625e4:       f7ff fe9f       bl      62326 <core_util_are_interrupts_enabled>
   625e8:       b908            cbnz    r0, 625ee <mbed_error+0x26>
   625ea:       bf30            wfi
   625ec:       e7fd            b.n     625ea <mbed_error+0x22>
   625ee:       2001            movs    r0, #1
   625f0:       f000 f948       bl      62884 <__wrap_exit>
   625f4:       4800            ldr     r0, [pc, #0]    ; (625f8 <mbed_error+0x30>)
   625f6:       bd10            pop     {r4, pc}
   625f8:       80ff010f        .word   0x80ff010f
```

Note that at `625d2` there is a bl to handle error. That replaces the LR, which means that ALL calls to mbed_error will report a location of 0x625d6 or 0x625d7 (user vs. supervisor). I do not expect that this was the intention of the code. The simplest fix is to change line 99:

```C
static inline mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number)
```

Since `handle_error()` will be inlined, the link register will be kept the same, so `MBED_CALLER_ADDR()` will yield the expected result. However, there is no guarantee that the compiler will respect the `inline` keyword in all circumstances.

The result is that each function that wishes to report its caller must extract its caller. This code cannot be centralised.

I have modified `mbed_error.c` to report the caller of each error reporting function, rather than the error reporting function itself.
2018-07-26 16:21:17 +01:00
Senthil Ramakrishnan b6179d281d Remove error reporting for release builds 2018-07-06 10:15:07 -05:00
Senthil Ramakrishnan a29eee4e73 Don't print error reports in release builds 2018-07-06 09:56:34 -05:00
Senthil Ramakrishnan a443e9bb47 Fix wrong config binding 2018-07-03 14:00:46 -05:00
Martin Kojtal ffcb6ecfb5 platform: astyle update 2018-06-29 10:38:44 +01:00
Senthil Ramakrishnan baa44eb3f2 Limit error filename capture to 64 chars, wrapping tests with right configs and astyle fixes. 2018-06-20 11:56:32 -05:00
Senthil Ramakrishnan cbb12e326d Updates to configuration flags used in error handling implementation.
The new configuration make Error history tracking switched off by default and enabled by using the config flag MBED_CONF_PLATFORM_ERROR_HIST_ENABLED.
Config flag MBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO enables printing info of all threads. This will be turned off by default.
2018-06-20 11:56:31 -05:00
Martin Kojtal 4f90f4c735 error: fix undeclared memcpy
Some targets do not get string header file in, results in the warning:
implicit declaration of function 'memcpy'
2018-06-06 09:00:27 +01:00
Senthil Ramakrishnan 68e59a11b9 Fix for error report not printing when calling error API 2018-05-31 11:27:20 -05:00
Senthil Ramakrishnan 07a6ab0864 Fix for filename capture not working 2018-05-31 10:39:58 -05:00
Senthil Ramakrishnan 5ef6728c08 Splitting MBED_ERROR macros to support ones with/without error value argument 2018-05-23 12:21:28 -05:00
Senthil Ramakrishnan 693a6c40bb Refactor error reporting 2018-05-23 12:21:11 -05:00
Senthil Ramakrishnan d4fe75731d Adding mbed prefixes to all macros and functions to avoid namespace conflicts 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 147d9cac4e Test application/cases optimization for some low memory targets, macro changes and test fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan f9c25612ae Fix test failures when trap errors are enabled and other fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan cbfc06577b Fixes to align with naming conventions 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 92df68b1ea Changed variable names for registers to avoid namespace conflicts, build fixes, macros and other fixes 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 530e9d323f Changed variable names for registers to avoid namespace conflicts and rtos disabled build fixes 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 2e28dd95e1 Change set_error/set_error_fatal to warning/error, add itm support and other changes 2018-05-23 12:21:08 -05:00
Senthil Ramakrishnan 839fef0ad1 Added more tests for error log and error reporting, updated doxygen comments 2018-05-23 12:21:07 -05:00
Senthil Ramakrishnan 9041b475c6 Error handling/logging implementation and tests 2018-05-23 12:21:07 -05:00
Russ Butler a84142fc4e Prevent recursive call to error()
Only allow error to be called once. This prevents a loop where error()
calls exit() which in turn triggers another call to exit().
2017-06-02 23:50:35 -05:00
Christopher Haster aff49d8d1e Renamed files in platform to match source names
critical.h     -> mbed_critical.h
sleep.h        -> mbed_sleep.h
toolchain.h    -> mbed_toolchain.h
rtc_time.h     -> mbed_rtc_time.h
semihost_api.h -> mbed_semihost_api.h
wait_api.h     -> mbed_wait_api.h
2017-02-22 18:17:54 -06:00
Sam Grove 301b77c4b2 For drivers, events, hal, platform, rtos and mbed.h add one level of path to make sure specific and unique includes files are found. 2016-10-01 02:11:36 -05:00