-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error handling configuration updates and Optimization for exception handling #7214
Conversation
Looking at this, I'm a teeny bit nervous some of the prints are getting a bit close to the 128-byte buffer limit in So |
@@ -53,6 +53,6 @@ typedef struct { | |||
|
|||
//This is a handler function called from Fault handler to print the error information out. | |||
//This runs in fault context and uses special functions(defined in mbed_rtx_fault_handler.c) to print the information without using C-lib support. | |||
__NO_RETURN void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in, void *osRtxInfoIn); | |||
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in, void *osRtxInfoIn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we removing no_return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xc0170 - With the new error handling implementation fault handler will call into error handler which will handle halting the system and thus no longer required here.
platform/mbed_error.c
Outdated
mbed_error_printf("\nLocation: 0x%X", ctx->error_address); | ||
|
||
#if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED && !defined(NDEBUG) | ||
if((NULL != ctx->error_filename[0]) && (ctx->error_line_number != 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (
space . Look at astyle failures for this changes in Travis
} | ||
|
||
void print_context_info(void) | ||
MBED_NOINLINE void print_context_info(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inlining was causing some problems for this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No specific problems with inlining. But sometimes debugging and also identifying the space required for individual functions becomes hard. So I removed inline as I was working on some optimizations.
That info should be part of the commit messages here |
@0xc0170 - You mentioned my description should be part of commit messages? Are you meaning I should include the entire description? |
@kjbracey-arm - Good point about the mbed_error_printf/%s. Currently we are using %s for printing filename. I'll change the implementation to limit the filename length to 64 chars max, by default its 16. That should take care of this as we have one printf which prints the filename+linenum but nothing else. |
b31e28e
to
4a92075
Compare
//We have to limit this to 64 bytes since we use mbed_error_printf for error reporting | ||
//and mbed_error_vfprintf uses 128bytes internal buffer which may not be sufficient for anything | ||
//longer that 64 bytes with the current implementation. | ||
#error "Unsupported error filename buffer length detected, max supported length is 64 chars. Please change MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN or max-error-filename-len in configuration." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kjbracey-arm - Please see this change to limit the filename buffer to 64 chars. This should take care of 128 chars buffer limitation in mbed_error_printf implementation.
6057ccd
to
28be10c
Compare
Yes, I dont see a reason why not. This needs a rebase now |
1736154
to
dc66deb
Compare
@0xc0170 - Commit message has been updated. |
The last commit was amended. What I had in mind was reworked all 3 commits to provide details, this needs rebase interactive and edit each one of them . The last commit does not make much sense , or am I misreading the changes vs commit msg there (the last commit contains style changes that should be separate commit - this is making it hard to review). |
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.
… and use mbed_error_printf to optimize memory usage. Dedicated safe printfs were originally developed to print data over serial with minimal resources. But this adds more code space, so we are switching to use mbed_error_printf.
…onfigs and astyle fixes.
dc66deb
to
baa44eb
Compare
@0xc0170 - Commit messages have been split/re-worked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/morph build |
Build : FAILUREBuild number : 2418 |
Looks like the K64F example mbed-os-example-error-handling failed on all compilers, but looks like a simple fix. |
@cmonr - Thanks Cruz, I'll look into the failure and push a fix. |
@cmonr - I have pushed a fix to the example app(on master branch). |
/morph build |
@SenRamakri Thansk for the quick direct commit to the example, but I'm thinking that once an example becomes public, fixes and the such should come into the example as PRs instead of direct commits. @ARMmbed/mbed-os-maintainers Thoughts? I'm not sure ownership/process is clear/public for internal examples that become public. |
Build : SUCCESSBuild number : 2437 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2069 |
Test : SUCCESSBuild number : 2217 |
Description
This change is targeted towards optimizing Error handling and exception handling to save memory.
The PR contains following changes:
Dedicated safe printfs were originally developed to print data over serial with minimal resources. But this adds more code space, so we are switching to use mbed_error_printf. Although it uses more resources, but it saves on rom usage.
These optimizations should save around 800 bytes on Rom.
Pull request type