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

Nuvoton: Fix NUC472 hard fault in SMCC tests #9171

Merged
merged 1 commit into from
Dec 28, 2018

Conversation

cyliangtw
Copy link
Contributor

@cyliangtw cyliangtw commented Dec 20, 2018

Description

This PR is to fix NUC472 hard fault what Mihail Stoyanov found in SMCC connect or update tests.
Test by pelion-enablement repo with mbed test -t ARM -m NUMAKER_PFM_NUC472 -n simple-mbed-cloud-client-tests-dev_mgmt-* --run -v

Pull request type

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

Test log:

mbedgt: test case report:
+------------------------+--------------------+-------------------------------------------------+----------------------------+--------+--------+--------+--------------------+
| target                 | platform_name      | test suite                                      | test case                  | passed | failed | result | elapsed_time (sec) |
+------------------------+--------------------+-------------------------------------------------+----------------------------+--------+--------+--------+--------------------+
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Connect to Ethernet        | 1      | 0      | OK     | 4.7                |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Format FAT                 | 1      | 0      | OK     | 0.23               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Initialize NUSD+FAT        | 1      | 0      | OK     | 0.12               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Initialize Simple PDMC     | 1      | 0      | OK     | 8.85               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Pelion DM Bootstrap & Reg. | 1      | 0      | OK     | 62.16              |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Pelion DM Directory        | 1      | 0      | OK     | 6.71               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Pelion DM Re-register      | 1      | 0      | OK     | 20.43              |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Post-reset Identity        | 1      | 0      | OK     | 2.37               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Resource LwM2M GET         | 1      | 0      | OK     | 1.72               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Resource LwM2M POST        | 1      | 0      | OK     | 1.78               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Resource LwM2M PUT         | 1      | 0      | OK     | 1.54               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-connect | Resource LwM2M SET         | 1      | 0      | OK     | 0.77               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Connect to Ethernet        | 1      | 0      | OK     | 4.55               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Firmware Download          | 1      | 0      | OK     | 142.29             |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Firmware Prepare           | 1      | 0      | OK     | 0.58               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Firmware Update            | 1      | 0      | OK     | 16.98              |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Format FAT                 | 1      | 0      | OK     | 0.08               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Initialize NUSD+FAT        | 1      | 0      | OK     | 0.04               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Initialize Simple PDMC     | 1      | 0      | OK     | 8.78               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Pelion DM Bootstrap & Reg. | 1      | 0      | OK     | 63.07              |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Pelion DM Directory        | 1      | 0      | OK     | 6.42               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Pelion DM Re-register      | 1      | 0      | OK     | 20.41              |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Post-update Erase          | 1      | 0      | OK     | 0.01               |
| NUMAKER_PFM_NUC472-ARM | NUMAKER_PFM_NUC472 | simple-mbed-cloud-client-tests-dev_mgmt-update  | Post-update Identity       | 1      | 0      | OK     | 2.1                |
+------------------------+--------------------+-------------------------------------------------+----------------------------+--------+--------+--------+--------------------+
mbedgt: test case results: 24 OK
mbedgt: completed in 464.09 sec

Reviewers

@MarceloSalazar
@samchuarm

@@ -75,6 +75,8 @@ void CLK_PowerDown(void)
SCB->SCR = SCB_SCR_SLEEPDEEP_Msk;
CLK->PWRCTL |= (CLK_PWRCTL_PDEN_Msk | CLK_PWRCTL_PDWKDLY_Msk );
__WFI();
__DSB();
__ISB();
Copy link
Contributor

@0xc0170 0xc0170 Dec 20, 2018

Choose a reason for hiding this comment

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

why are these barriers after and not before WFI - why it was hardfaulting previously?

I am missing what has caused the hardfault (how these 2 barriers are adressing it), adding them after _WFI is executed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@0xc0170 , according to the hard fault prompt & tracking, it's failed in branch instruction after wake-up. So add these barriers to ensure data & instruction ready before branch. Cross checking of my test proved it could work as our expectation.

@ciarmcom
Copy link
Member

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

@screamerbg
Copy link
Contributor

This is great! Thank you @cyliangtw for your hard work to get to the bottom of the issue and resolve it!

@NirSonnenschein
Copy link
Contributor

This may need another review before going in, but starting CI in the mean time

@mbed-ci
Copy link

mbed-ci commented Dec 24, 2018

Test run: SUCCESS

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

@cmonr
Copy link
Contributor

cmonr commented Dec 24, 2018

This may need another review before going in, but starting CI in the mean time

@NirSonnenschein could you clarify? This appears to be good to go.

@NirSonnenschein
Copy link
Contributor

should be good to go, a question came up regarding additional reviews.

@cmonr cmonr merged commit 1bf7e1c into ARMmbed:master Dec 28, 2018
@cyliangtw cyliangtw deleted the nuvoton_nuc472_hardfault branch March 9, 2023 05:25
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.

None yet

8 participants