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 mbed_hal-sleep test failed #8049

Merged
merged 7 commits into from Oct 1, 2018

Conversation

Projects
None yet
7 participants
@ccli8
Contributor

ccli8 commented Sep 10, 2018

Description

This PR tries to fix mbed_hal-sleep test failure on Nuvoton targets. It includes:

  1. Replace wait_us with nu_busy_wait_us in lp ticker since wait_us is not available with us ticker layer shutting down in the test.
  2. Fix serial corruption due to entering deep sleep
  3. Update M2351 secure library/executable

Pull request type

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

ccli8 added some commits Aug 13, 2018

[Nuvoton] Add nu_busy_wait_us
nu_busy_wait_us is a replacement for wait_us when intermediary us ticker layer is disabled.
[Nuvoton] Add nu_delay_cycle_x4
nu_delay_cycle_x4 is a replacement for wait_us when us ticker is not available.
[Nuvoton] Fix HAL sleep test failure with lp_ticker
Replace wait_us with nu_busy_wait_us in lp_ticker since wait_us is not allowed in sleep test
which would suspend us ticker layer on which wait_us relies. nu_busy_wait_us is implemented
by calling us ticker HAL API directly rather than relying on us ticker layer.
[Nuvoton] Fix serial corruption due to deep sleep
Prevent deep sleep when there is still any character being transmitted on the UART.
This allows tickless to be safely enabled.
[M2351] Fix hal_deepsleep with serial_can_deep_sleep
Add secure functions CLK_PowerDown_S/CLK_Idle_S
[M2351] Update secure library/executable
1. Remove hal_sleep/hal_deepsleep from secure library
2. Add CLK_Idle_S/CLK_PowerDown_S
@adbridge

This comment has been minimized.

Contributor

adbridge commented Sep 10, 2018

@ARMmbed/mbed-os-hal please review

@adbridge adbridge requested a review from ARMmbed/mbed-os-hal Sep 10, 2018

@jamesbeyond

This comment has been minimized.

Contributor

jamesbeyond commented Sep 10, 2018

Hi @fkjagodzinski , do you mind have a look?

@@ -1136,4 +1139,23 @@ static int serial_is_irq_en(serial_t *obj, SerialIrq irq)
}
#endif // #if DEVICE_SERIAL_ASYNCH
bool serial_can_deep_sleep(void)

This comment has been minimized.

@fkjagodzinski

fkjagodzinski Sep 14, 2018

Member

I think the code of this fun is the same for every target in this PR. It might be a good idea to move it to a common file.

This comment has been minimized.

@ccli8

ccli8 Sep 17, 2018

Contributor

@fkjagodzinski serial_can_deep_sleep is recommended in #7698 by @c1728p9 , but it is not defined in HAL spec. I can only fix on Nuvoton targets.

This comment has been minimized.

@fkjagodzinski

fkjagodzinski Sep 17, 2018

Member

Oh, I wasn't aware of the origin of this function. This could be a useful HAL feature. 👍

Anyway, my original comment was only about your new code. It might be convenient not to keep a few copies of one function. In this case it would stay inside targets/TARGET_NUVOTON/.

This comment has been minimized.

@ccli8

ccli8 Sep 18, 2018

Contributor

@fkjagodzinski Currently, on Nuvoton targets, HAL implementations (e.g. serial_api.c) for each target (NUMAKER_PFM_NUC472, NUMAKER_PFM_M453, etc.) are branched. Except these HAL implementations are resolved to merge into one, serial_can_deep_sleep would be kept branched for consistency.

This comment has been minimized.

@fkjagodzinski

fkjagodzinski Sep 18, 2018

Member

Sure, no problem for me.

@@ -1,797 +1,873 @@
:020000040000FA
:1000000000080020050F0000D90B0000D90B0000EC
:1000000000080020AB100000190D0000190D0000C1

This comment has been minimized.

@0xc0170

0xc0170 Sep 19, 2018

Member

Should this file and also another object file in the same folder contain a license file? (https://github.com/ARMmbed/mbed-os/tree/a65e3d42e53e5c46c8a5bd74f17c5d0e7cef0f1b/targets/TARGET_NUVOTON/TARGET_M2351/TARGET_NUMAKER_PFM_M2351/TARGET_M23_NS)

Would be good to have it as a separate PR

This comment has been minimized.

@ccli8

ccli8 Sep 20, 2018

Contributor

@0xc0170 The Permissive Binary License meets the scenario. Could we reuse this license just like it is attached in https://github.com/ARMmbed/mbed-os/tree/master/tools/bootloaders/MTB_MTS_DRAGONFLY?
@cyliangtw

This comment has been minimized.

@0xc0170

0xc0170 Sep 20, 2018

Member

Yes.

Regarding this hex file - what does it do as it has suffix -example ?

This comment has been minimized.

@ccli8

ccli8 Sep 20, 2018

Contributor

@0xc0170 Thanks.

Regarding this hex file - what does it do as it has suffix -example ?

TrustZone target requires two codes, secure and non-secure. Secure code would run first to set up security environment and then bring up non-secure code. NuMaker-mbed-TZ-secure-example.hex is the default secure code (and cmse_lib.o is the secure gateway library exported by it). It is built from:
https://github.com/OpenNuvoton/NuMaker-mbed-TZ-secure-example
We choose .hex rather than .bin as output format because secure/non-secure code may not start at address 0x0. To flash secure/non-secure code on M2351, we would drag-n-drop NuMaker-mbed-TZ-secure-example.hex first and then user program e.g. mbed-os-example-blinky.hex.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 29, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Sep 29, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 merged commit 59ce41f into ARMmbed:master Oct 1, 2018

14 checks passed

ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed , RTOS ROM(+0.0%) RAM(+0.0%)
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/cloud_client_smoke_test Test job: successful
Details
travis-ci/astyle Passed, 598 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9375 cycles (-1166 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8372B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details

@0xc0170 0xc0170 removed the ready for merge label Oct 1, 2018

@ccli8 ccli8 deleted the OpenNuvoton:nuvoton_fix_hal_sleep branch Oct 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment