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

Introduce an Mbed config to enable XIP #11006

Merged
merged 5 commits into from
Sep 9, 2019
Merged

Conversation

linlingao
Copy link
Contributor

@linlingao linlingao commented Jul 9, 2019

Description

Introduce an Mbed config to enable XIP (Execute In Place) capability on some boards. XIP can be enabled by adding "target.xip-enable": true in mbed_app.json. It's disabled by default.

Pull request type

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

Reviewers

Release Notes

Introduce xip-enable config to allow text/RO data to be loaded to QSPI flash where XIP (execute-in-place) is supported. This will allow programs with larger text/RO data section to run on a system with smaller on-chip flash.

This feature is disabled by default on all targets.

XIP can be enabled by adding target.xip-enable: true in mbed_app.json, then locate desired text/RO data sections to QSPI flash region in the linker script. In the boot sequence, QSPI flash needs to be configured to XIP mode.

@ciarmcom ciarmcom requested review from a team July 9, 2019 23:00
@ciarmcom
Copy link
Member

ciarmcom commented Jul 9, 2019

@linlingao, thank you for your changes.
@ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-pan @ARMmbed/mbed-os-storage @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-ipcore please review.

@40Grit
Copy link

40Grit commented Jul 10, 2019

@AGlass0fMilk

@@ -957,6 +957,12 @@ def add_linker_defines(self):
self.ld.append(define_string)
self.flags["ld"].append(define_string)

if "XIP_ENABLE" in self.target.macros :
Copy link
Contributor

@mark-edgeworth mark-edgeworth Jul 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment on what XIP is, and why this special case needs to be added here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XIP stands for Execute In Place. Since the text/RO data gets too big to fit on on chip flash, we need to move some code to the QSPI to execute for bigger applications such as Pelion cloud client. This feature is designed to be enabled in mbed_app.json because each application usually has its own JSON. By default it's disabled, because if the text/RO data can fit on the internal flash, there's no need to enable this feature.

Copy link
Contributor

@mark-edgeworth mark-edgeworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is enormous - 764 changed files!
I can only look at the tools changes; these look to be minor, but contribute to an increasing pool of special cases, each of which make maintaining the tools code more and more difficult.
I would like to see some comments to indicate what this changed code is actually doing and why.

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 10, 2019

This PR is enormous - 764 changed files!

+1, would be good to indicate which commits are actually for review here (range of them if multiple). Otherwise most of us just wait until the rebase is done once PR dependency is in

@0xc0170 0xc0170 requested review from a team and removed request for a team July 10, 2019 10:33
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 10, 2019

This is the commit: b075f76 for review.

What does this bring? Are there any implications one enabled?
Why XIP_ENABLE, is this part of QSPI, should it be addition to the current driver ? We rather should use driver config or somehow differently than using "macro" to enable it. Isn't this QSPI feature?

@linlingao
Copy link
Contributor Author

Yes, only b075f76 needs to be reviewed. It's fine to wait till the rebase.

@0xc0170 0xc0170 requested a review from a team July 11, 2019 07:59
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 11, 2019

Can you introduce XIP - answer my questions above.

@linlingao
Copy link
Contributor Author

Hope this helps:
https://en.wikipedia.org/wiki/Execute_in_place
XIP is a mode on the QSPI. I don't see how this can be done in the QSPI driver alone since this is really a systematic feature.
We need to relocate some code to QSPI, the only place to do that is via the linker.

@artokin
Copy link
Contributor

artokin commented Jul 15, 2019

@linlingao , #10692 is now merged, would you please rebase?

@maclobdell
Copy link
Contributor

maclobdell commented Jul 16, 2019

@ARMmbed/team-cypress - please review after this is rebased

@linlingao
Copy link
Contributor Author

linlingao commented Jul 17, 2019

Rebased. Reviewers, please review.

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please connect it to Mbed config system, similarly to MBED_CONF_TARGET_LSE_AVAILABLE which can be found in target.json as lse_available in config section.

@linlingao
Copy link
Contributor Author

@bulislaw I looked at how lse_available is used in targets.json. lse_available only applies to FAMILY_STM32. The default is "1", but on some targets, it's overridden to 0. That is, lse_available is the same setting on a certain target for all applications.

I'm not seeing close resemblance between lse_available and XIP_ENABLE. There're two differentiating points with respect to the intended usage of XIP_ENABLE:

(1) XIP_ENABLE can be used for ALL targets. For example, on the Nordic boards with XIP, if someone wants to enable XIP, he/she doesn't need to introduce another variable.
(2) XIP_ENABLE is application specific setting. Which means, on a board with XIP capability, one can choose in enable XIP in one application such as cloud client example when the on-chip flash is not big enough, but disable XIP in smaller applications when on-chip flash is more than enough.

@bulislaw
Copy link
Member

(1) XIP_ENABLE can be used for ALL targets. For example, on the Nordic boards with XIP, if someone wants to enable XIP, he/she doesn't need to introduce another variable.
(2) XIP_ENABLE is application specific setting. Which means, on a board with XIP capability, one can choose in enable XIP in one application such as cloud client example when the on-chip flash is not big enough, but disable XIP in smaller applications when on-chip flash is more than enough.

Even more reasons to have it as system config rather than a 'random' flag.

@linlingao
Copy link
Contributor Author

I had to wait for other PRs to go in first. It's fine to push this out to a minor release.

@linlingao linlingao changed the title Add XIP capability Add Mbed config to enable XIP Sep 3, 2019
@linlingao linlingao changed the title Add Mbed config to enable XIP Introduce an Mbed config to enable XIP Sep 3, 2019
@linlingao
Copy link
Contributor Author

XIP feature has already been added by Cypress in other PRs. Reduce the scope of this PR to just add the Mbed config.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 4, 2019

To understand the scope now - this provides a config option to enable/disable it. There're Cypress targets already providing all needed, and other targets can follow. This PR should be ready then ?

@linlingao
Copy link
Contributor Author

@0xc0170 Yes

@linlingao
Copy link
Contributor Author

@morser499 Please review the change in mbed_override.c

@morser499
Copy link

Looks good to me

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 6, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Sep 6, 2019

Test run: FAILED

Summary: 2 of 4 test jobs failed
Build number : 6
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-ARM

@mbed-ci
Copy link

mbed-ci commented Sep 6, 2019

Test run: SUCCESS

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

@0xc0170 0xc0170 merged commit 4585232 into ARMmbed:master Sep 9, 2019
@adbridge adbridge added release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 and removed release-version: 5.15.0-rc1 labels Oct 3, 2019
@0xc0170 0xc0170 added release-version: 5.15.0-rc1 and removed release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 labels Nov 19, 2019
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.