-
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
PSOC6: move mbed_sdk_init to mbed_overrides.c #10483
Conversation
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.
@vmedcy, thank you for your changes. |
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.
Nice unification
{ | ||
#if !defined(COMPONENT_SPM_MAILBOX) | ||
/* Disable global interrupts */ | ||
__disable_irq(); |
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.
you should use rather critical section 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.
Same for line 63 and 56
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.
As this was in the code previously, we could still fix it 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.
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.
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.
PSA-wise this is fine
@0xc0170: code review feedback is addressed, the needless |
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.
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(); |
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.
is this still needed ? Previously was disable-enable pair, now only enable in sdk_init
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.
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:
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Purposes:
to simplify updates to new PDL version (startup code is part of PDL).
This change is non-functional, sequence itself is not changed for any
of the PSoC 6 M4/M0 PSA/non-PSA targets.
Description
Pull request type
Reviewers
Release Notes