Go to file
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
.github Merge pull request #6728 from 0xc0170/fix-issue-template 2018-05-07 10:38:49 -05:00
TESTS Merge pull request #7530 from jeromecoutant/PR_RTOS_TICKLESS 2018-07-23 10:13:50 -05:00
cmsis Add volatile modifier for CP15 accessors 2018-06-07 16:47:12 +09:00
drivers Improve efficiency and formatting of ITM output 2018-07-04 10:16:28 +03:00
events Introduce API to query how much time is left for delayed event 2018-05-18 12:55:06 +03:00
features Merge pull request #7587 from SeppoTakalo/fix-tpcserver-warning 2018-07-25 14:20:05 +02:00
hal Improve efficiency and formatting of ITM output 2018-07-04 10:16:28 +03:00
platform Make location meaningful in print_error_report 2018-07-26 16:21:17 +01:00
rtos Fix spelling in error message in fault handler 2018-07-19 10:31:34 -05:00
targets Merge pull request #7551 from M-ichae-l/realtek-rtl8195am-remove-DEVICE_EMAC 2018-07-25 14:18:57 +02:00
tools Merge pull request #7480 from klaas019/master 2018-07-23 10:12:31 -05:00
.astyleignore AStyle: ignore hal storage abstraction 2018-06-29 10:36:36 +01:00
.astylerc AStyle: fix indentation for longer lines 2018-05-24 14:15:52 +01:00
.coveragerc Exclude libraries and tests from coverage numbers 2017-09-25 11:51:31 -05:00
.gitattributes Added .gitattributes for automatic LF line ending conversion 2013-08-08 13:19:34 +03:00
.gitignore BLE: Initialize the pal in GenericSecurityManager 2018-03-23 12:06:08 +00:00
.pylintrc Add pylint configuration file 2016-08-16 11:48:45 -05:00
.travis.yml Moved the sourcing of the astyle archive to AWS from SourceForge. 2018-06-26 10:54:57 -05:00
CONTRIBUTING.md Update link in CONTRIBUTING.md 2017-06-09 16:38:38 -05:00
DOXYGEN_FRONTPAGE.md Very minimal text 2016-08-04 14:09:59 +01:00
Jenkinsfile Jenkinsfile: remove client app test temporarily 2017-06-01 12:15:09 +01:00
LICENSE Add Apache v2 LICENSE file 2013-08-06 12:05:04 +01:00
README.md Simple typo fix in the README.md 2018-01-08 19:50:18 +00:00
doxyfile_options Remove FEATURE_LWIP. The LwIP stack is enabled on all builds now 2018-06-21 11:00:00 +03:00
doxygen_options.json Remove FEATURE_LWIP. The LwIP stack is enabled on all builds now 2018-06-21 11:00:00 +03:00
logo.png Readme updates for style and branding 2017-12-04 14:59:16 -06:00
mbed.h Separate version header file to get version updates in Mbed OS 2018-07-11 09:41:30 -05:00
requirements.txt Added missing six requirement 2018-05-11 14:25:27 -05:00

README.md

Mbed OS

Build status release Build status master Tools coverage status PR progress

Arm Mbed OS is an open source embedded operating system designed specifically for the "things" in the Internet of Things. It includes all the features you need to develop a connected product based on an Arm Cortex-M microcontroller, including security, connectivity, an RTOS and drivers for sensors and I/O devices.

Mbed OS provides a platform that includes:

  • Security foundations.
  • Cloud management services.
  • Drivers for sensors, I/O devices and connectivity.

Release notes

The release notes detail the current release. You can also find information about previous versions.

Getting started for developers

We have a developer website for asking questions, engaging with others, finding information on boards and components, using an online IDE and compiler, reading the documentation and learning about what's new and what's coming next in Mbed OS.

Getting started for contributors

We also have a contributing and publishing guide that covers licensing, contributor agreements and style guidelines.