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

PSOC6: move mbed_sdk_init to mbed_overrides.c #10483

Merged
merged 2 commits into from May 16, 2019

Conversation

Projects
None yet
6 participants
@vmedcy
Copy link
Contributor

commented Apr 25, 2019

Purposes:

  • Remove MbedOS-specific code from system_psoc6_{cm4,cm0plus}.c
    to simplify updates to new PDL version (startup code is part of PDL).
  • Unify mbed_sdk_init initialization sequence for both CPU cores.
    This change is non-functional, sequence itself is not changed for any
    of the PSoC 6 M4/M0 PSA/non-PSA targets.
  • Do not disable global interrupts during init_cycfg_all, this function is safe to execute with interrupts enabled.

Description

Pull request type

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

Reviewers

Release Notes

PSOC6: move mbed_sdk_init to mbed_overrides.c
Purposes:
* Remove MbedOS-specific code from system_psoc6_{cm4,cm0plus}.c
  to simplify updates to new PDL version (startup code is part of PDL).
* Unify mbed_sdk_init initialization sequence for both CPU cores.
  This change is non-functional, sequence itself is not changed for any
  of the PSoC 6 M4/M0 PSA/non-PSA targets.

@ciarmcom ciarmcom requested a review from ARMmbed/mbed-os-maintainers Apr 25, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

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

@0xc0170
Copy link
Member

left a comment

Nice unification

{
#if !defined(COMPONENT_SPM_MAILBOX)
/* Disable global interrupts */
__disable_irq();

This comment has been minimized.

Copy link
@0xc0170

0xc0170 Apr 29, 2019

Member

you should use rather critical section here

This comment has been minimized.

Copy link
@0xc0170

0xc0170 Apr 29, 2019

Member

Same for line 63 and 56

This comment has been minimized.

Copy link
@0xc0170

0xc0170 Apr 29, 2019

Member

As this was in the code previously, we could still fix it here.

This comment has been minimized.

Copy link
@vmedcy

vmedcy May 3, 2019

Author Contributor

This is now fixed by 737c98f - after further analysis, I can confirm entering critical section is not needed at all, init_cycfg_all is fine to execute with global interrupts enabled. I checked this functionally on CM4/CM0P PSA/non-PSA targets (actually there is no change in PSA case). On CM0+, global interrupts are enabled by ROM boot before Reset_Handler.

@orenc17
Copy link
Contributor

left a comment

PSA-wise this is fine

@0xc0170 0xc0170 added needs: work and removed needs: review labels May 2, 2019

@vmedcy

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2019

@0xc0170: code review feedback is addressed, the needless __enable_irq()/__disable_irq() calls removed from mbed_sdk_init.

@0xc0170
Copy link
Member

left a comment

thanks for the update

Sorry about the delay for this review. Just one question about the enable irq

init_cycfg_all();

/* Enable global interrupts (disabled in CM4 startup assembly) */
__enable_irq();

This comment has been minimized.

Copy link
@0xc0170

0xc0170 May 15, 2019

Member

is this still needed ? Previously was disable-enable pair, now only enable in sdk_init

This comment has been minimized.

Copy link
@vmedcy

vmedcy May 15, 2019

Author Contributor

Yes. As mentioned in the code comment, CM4 startup assembly masks the global interrupts in Reset_Handler (this behavior is required to enable correct startup sequence under all scenarios, the code is there since the initial PDL 3.0.0 release).
For example, see startup_psoc6_01_cm4.S:

@mbed-ci

This comment has been minimized.

Copy link

commented May 15, 2019

Test run: SUCCESS

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

@adbridge adbridge added ready for merge and removed needs: CI labels May 15, 2019

@adbridge adbridge merged commit d997563 into ARMmbed:master May 16, 2019

26 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
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 Success
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 8604 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 8448B.
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
You can’t perform that action at this time.