Skip to content

Remove mbed wait deprecated APIs #12572

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

Merged
merged 4 commits into from
Apr 9, 2020

Conversation

rajkan01
Copy link
Contributor

@rajkan01 rajkan01 commented Mar 4, 2020

Summary of changes

Removed mbed wait deprecated APIs.

Impact of changes

Breaking change: wait and wait_ms APIs have been deprecated since Mbed OS 5.14 and they are removed now.

Migration actions required

If you wish to sleep, use ThisThread::sleep_for (C++) or thread_sleep_for (C). If you wish to wait (without sleeping), call wait_us. wait_us is safe to call from ISR context.

Documentation

ARMmbed/mbed-os-5-docs@19d1ed0


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[x] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@evedon


@rajkan01 rajkan01 force-pushed the waitapi_remove_deprecated branch from 7332519 to 8fa3202 Compare March 4, 2020 15:56
@ciarmcom ciarmcom requested review from evedon and a team March 4, 2020 16:00
@ciarmcom
Copy link
Member

ciarmcom commented Mar 4, 2020

@rajkan01, thank you for your changes.
@evedon @ARMmbed/mbed-os-core @ARMmbed/mbed-os-wan @ARMmbed/mbed-os-pan @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-test @ARMmbed/mbed-os-maintainers please review.

@evedon
Copy link
Contributor

evedon commented Mar 4, 2020

These APIs are widely used so we need to ensure that there is no internal usage in greentea tests, examples etc. before merging. @0xc0170 it would be useful to kick off CI to see which tests/targets fail to build.

Copy link
Contributor

@maciejbocianski maciejbocianski left a comment

Choose a reason for hiding this comment

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

Why some test use thread_sleep_for and the other use ThisThread::sleep_for ?

@@ -46,54 +46,14 @@ extern "C" {
* int main() {
* while (1) {
* heartbeat = 1;
* wait(0.5);
* wait_us(500);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be 500ms not 500us

* heartbeat = 0;
* wait(0.5);
* wait_us(500);
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

@rajkan01 rajkan01 Mar 5, 2020

Choose a reason for hiding this comment

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

@maciejbocianski We try to showcase time precision sleeping, but we are working on better example to showcase wait API.

@cmonr
Copy link
Contributor

cmonr commented Mar 4, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Mar 4, 2020

Test run: FAILED

Summary: 3 of 4 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

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

@rajkan01
Copy link
Contributor Author

rajkan01 commented Mar 5, 2020

Why some test use thread_sleep_for and the other use ThisThread::sleep_for ?
@maciejbocianski
Thread_sleep_for is only supported in baremetal. if the test case requires to run bare metal and RTOS, then it uses this API.
Note:
Thread_sleep_for internally calls either ThisThread::sleep_for API for RTOS mode or do_timed_sleep_relative_or_forever for bare metal mode.

@jamesbeyond
Copy link
Contributor

This PR needs to merge after : ARMmbed/mbed-os-examples-docs_only#59

@kjbracey
Copy link
Contributor

kjbracey commented Mar 5, 2020

if the test case requires to run bare metal and RTOS, then it uses this API.

To clarify, both APIs are available bare-metal, but you do have to ask for the C++ apis with requires: "rtos-api" in your mbed_app.json, as they're not enabled by default.

Biggest 2 reasons to use thread_sleep_for are (a) you're in writing a C file or (b) you're in the main Mbed OS hal/drivers/targets directories and want to cope with the RTOS API not being there - for now we've been avoiding having a dependency from those directories to the rtos one. (Because quite a few people put rtos in their .mbedignore).

It's no big deal which the tests use though. Using the C one is fine.

Note that all the C++ timing APIs you're switching to are planned to be deprecated by #12425 - they'll want to be changed again to ThisThread::sleep_for(1s) or ThisThread::sleep_for(500ms).

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 9, 2020

there are two libraries that need to be rebuilt for this PR:

  1. targets/TARGET_WICED/TOOLCHAIN_ARMC6/TARGET_MTB_MXCHIP_EMW3166/libwiced_drivers.ar - @michalpasztamobica @AnttiKauppila

  2. targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar
    @ARMmbed/team-ublox

Can you please rebuilt the libraries using this PR and share SHA on your branch? We can cherry-pick them here so all goes in together.

@rajkan01 Please correct me if any other library missing in this list.

@AnttiKauppila
Copy link

@tymoteuszblochmobica / @mtomczykmobica - Could you check Martin's last comment regarding to libwiced drivers?

@rajkan01
Copy link
Contributor Author

rajkan01 commented Mar 9, 2020

there are two libraries that need to be rebuilt for this PR:

targets/TARGET_WICED/TOOLCHAIN_ARMC6/TARGET_MTB_MXCHIP_EMW3166/libwiced_drivers.ar - @michalpasztamobica @AnttiKauppila

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar
@ARMmbed/team-ublox

Can you please rebuilt the libraries using this PR and share SHA on your branch? We can cherry-pick them here so all goes in together.
@rajkan01 Please correct me if any other library missing in this list.

@0xc0170 yes, in addition to the previous list with below libraries also needs to be check for the wait API usage

@mbed-ci
Copy link

mbed-ci commented Apr 2, 2020

Test run: FAILED

Summary: 1 of 7 test jobs failed
Build number : 9
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@rajkan01
Copy link
Contributor Author

rajkan01 commented Apr 2, 2020

@0xc0170 mbed test setup handler was failed. Please restart the greentea test

[1585852052.00][urllib3.connectionpool]https://mervi.mbedcloudtesting.com:443 "PUT /resource/079602210525681A3A61FEB1/connect HTTP/1.1" 200 78
[1585852052.00][GLRM][INF] remote resources reset...
mbedgt: :73::FAIL: Expected 0 Was -3010
[1585852052.50][CONN][RXD] :73::FAIL: Expected 0 Was -3010
mbedgt: :73::FAIL: Expected 0 Was -3010
[1585852052.50][CONN][RXD] :73::FAIL: Expected 0 Was -3010
[1585852052.50][CONN][RXD] >>> failure with reason 'Assertion Failed' during 'Test Setup Handler'

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2020

Restarted test, this is known issue

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 6, 2020

Restarted tests, some targets were put into maintenance mode in CI.

rajkan01 added 4 commits April 8, 2020 10:35
…PI with IRQ masked, so wait_us is used to fix this issue as PWM testes to be executed with interrupt disabled to avoid context switch.
- Incorporate the review comment.
@rajkan01 rajkan01 force-pushed the waitapi_remove_deprecated branch from 5eba674 to 3d128e8 Compare April 8, 2020 09:35
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 8, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Apr 8, 2020

Test run: FAILED

Summary: 2 of 3 test jobs failed
Build number : 10
Build artifacts

Failed test jobs:

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

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 8, 2020

CI restarted (ble example was fixed)

@mbed-ci
Copy link

mbed-ci commented Apr 8, 2020

Test run: SUCCESS

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

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 9, 2020

CI passed, time for some reviews

Copy link
Contributor

@evedon evedon left a comment

Choose a reason for hiding this comment

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

Re-approved

@0xc0170 0xc0170 merged commit 7fce7f5 into ARMmbed:master Apr 9, 2020
@mergify mergify bot removed the ready for merge label Apr 9, 2020
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.