Skip to content

Disable write buffer in debug builds (M3/M4) #8655

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

Merged
merged 2 commits into from
Dec 17, 2018

Conversation

kjbracey
Copy link
Contributor

@kjbracey kjbracey commented Nov 6, 2018

Description

As part of work to improve the debugging of exceptions, have
Mbed OS make an effort to make exceptions more precise in debug builds
at the cost of performance.

Related pyOCD work:

pyocd/pyOCD#430

Pull request type

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

@kjbracey kjbracey requested a review from c1728p9 November 6, 2018 14:49
@cmonr cmonr requested review from SenRamakri and a team November 7, 2018 03:11
@kjbracey
Copy link
Contributor Author

kjbracey commented Nov 7, 2018

I think my main desire for this (writes to NULL) is relieved by the latest version of #8335, but could still be worthwhile for other weird bus accesses.

@NirSonnenschein
Copy link
Contributor

CI is still problematic, but trying to test this for build/export
/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 18, 2018

Build : SUCCESS

Build number : 3663
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8655/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Nov 18, 2018

@mbed-ci
Copy link

mbed-ci commented Nov 18, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 19, 2018

Info: This PR has been re-bundled into a new rollup PR (#8800).

No further work is needed here, as once that PR is merged, this PR will also be closed and marked as merged.
If any more commits are made in this PR, this PR will remain open and have to go through CI on its own.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 19, 2018

This needs work. Exporters failure here are valid (latest results above) and were reproduced in the rollup

@kjbracey
Copy link
Contributor Author

kjbracey commented Nov 20, 2018

Will investigate. You can treat this as low priority - it's a nice-to-have, but not really needed for 5.11 as long as #8335 makes it in.

@kjbracey
Copy link
Contributor Author

kjbracey commented Nov 21, 2018

Okay, re-read the manual while investigating M3 revisions (turns out not all revisions of M3 have the bit, and not all platforms specify their M3 revision, and core_cm3.h is unhelpfully designed).

This bit only affects behaviour when the MPU is turned off, so it interacts weirdly with #8335, and there's no simple portable way to reproduce the behaviour with the MPU on, so I'm going to just drop it.

#8335's ROM write protection should cover 90% of the cases I'm worried about - will revisit with an MPU solution if I hit others. (Maybe make some areas Strongly Ordered in debug builds?)

@kjbracey
Copy link
Contributor Author

kjbracey commented Dec 13, 2018

Reopening, as #8335 does not in fact cover my most common case - the K64F.

Even if the K64F had a MPU driver, it still wouldn't provide precise aborts like the ARM MPU. So this patch is still useful.

Now incorporating a CMSIS patch to make the ACTLR register easier to deal with - should fix the previous CI failures. That has already been merged upstream: ARM-software/CMSIS_5#478

The ACTLR register itself is conditional on chip revision, but its
bit definitions were always defined.

Make the the bit definitions also conditional, so it is possible to
produce portable code that sets DISDEFWBUF if available:

    #ifdef SCnSCB_ACTLR_DISDEFWBUF_Msk
       SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;
    #endif

(cherry-picked from CMSIS b2b04dbeece0a046556bfc320bef6b20bef3f16f)
As part of work to improve the debugging of exceptions, have
Mbed OS make an effort to make exceptions more precise in debug builds
at the cost of performance.

Related pyOCD work:

   pyocd/pyOCD#430
@kjbracey
Copy link
Contributor Author

Shouldn't need work any more - I believe the extra commit clears the previous CI failures.

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 14, 2018

CI started

@mbed-ci
Copy link

mbed-ci commented Dec 14, 2018

Test run: SUCCESS

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

@cmonr cmonr merged commit 7bf2fbd into ARMmbed:master Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants