Skip to content
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

mbed fault handler: fix mbed_fault_context parameter #11272

Merged
merged 2 commits into from Aug 23, 2019

Conversation

@andrewc-arm
Copy link
Contributor

commented Aug 21, 2019

Description

Why required

Without this fix, when void mbed_fault_handler(uint32_t fault_type, void *mbed_fault_context_in) is called, mbed_fault_context_in is in **mbed_fault_context_t type which is unnecessarily doubly pointered. Also, it's unintuitive, most users will expect to simply static cast the void pointer argument to *mbed_fault_context_t instead of **mbed_fault_context_t.

What's the change

The except.S Fault_Handler assembly code will prepare mbed_fault_context_in argument as *mbed_fault_context_t type instead of **mbed_fault_context_t type.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

…fault_context in mbed_fault_handler.
@0xc0170

This comment has been minimized.

Copy link
Member

commented Aug 21, 2019

Can you rework the commit message, shall be something like: mbed fault handler: fix mbed_fault_context parameter and second paragraph containing info about the fix - what is it fixing and why

@andrewc-arm andrewc-arm changed the title Fixes the bug of having &mbed_fault_context in mbed_fault_handler() mbed fault handler: fix mbed_fault_context parameter Aug 21, 2019
@kjbracey-arm

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2019

If you're going to change this, it's a behaviour change, so you should at least change the parameter to be mbed_fault_context_t * to show what it actually is. (Maybe const, if the handler isn't supposed to modify it).

This isn't public API anyway, I believe, and it doesn't currently use that parameter, so I'd be inclined to just stop passing that parameter at all - save an instruction.

While here, remove the unnecessary cast at

mbed_fault_context_t *const mbed_fault_context = (mbed_fault_context_t *) &fault_context;

Is there a reason this change is happening?

@andrewc-arm

This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2019

Is there a reason this change is happening?

I was making stack dump feature for my customers and found that parameter was returning misleading information. It took me quite sometime to figure out the right values.

I agree with const mbed_fault_context_t *. It would really help users to understand what it is instead searching through the code/assembly. I will change them. For the mbed_fault_handler override, they can make use of the argument well.

@ciarmcom ciarmcom requested review from ARMmbed/mbed-os-maintainers Aug 21, 2019
@ciarmcom

This comment has been minimized.

Copy link
Member

commented Aug 21, 2019

@andrewc-arm, thank you for your changes.
@ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

left a comment

Looks fine to me, but it is an API change, so not sure it would be appropriate for a patch release. But I don't feel that strongly.

@0xc0170

This comment has been minimized.

Copy link
Member

commented Aug 21, 2019

@andrewc-arm Lets take it to 5.14. If this is API change, should be "functional change" in PR type above and contain "release notes" details as well.

@andrewc-arm

This comment has been minimized.

Copy link
Contributor Author

commented Aug 22, 2019

Sure. Thanks for making better software.

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Aug 22, 2019
@0xc0170

This comment has been minimized.

Copy link
Member

commented Aug 22, 2019

CI started

@mbed-ci

This comment has been minimized.

Copy link

commented Aug 22, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 merged commit 2c3ce96 into ARMmbed:master Aug 23, 2019
25 checks passed
25 checks passed
continuous-integration/jenkins/pr-head This commit looks good
Details
jenkins-ci/build-ARM Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(-24 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Success!
Details
travis-ci/docs Success!
Details
travis-ci/doxy-spellcheck Success!
Details
travis-ci/events Success! Runtime is 8610 cycles.
Details
travis-ci/gitattributestest Success!
Details
travis-ci/include_check Success!
Details
travis-ci/licence_check Success!
Details
travis-ci/littlefs Success! Code size is 8464B.
Details
travis-ci/psa-autogen Success!
Details
travis-ci/tools-py2.7 Success!
Details
travis-ci/tools-py3.5 Success!
Details
travis-ci/tools-py3.6 Success!
Details
travis-ci/tools-py3.7 Success!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.