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

STM32: Add LP_TICKER and US_TICKER optimisation macro #14536

Merged
merged 1 commit into from
May 24, 2021

Conversation

jeromecoutant
Copy link
Collaborator

@jeromecoutant jeromecoutant commented Apr 13, 2021

Summary of changes

Proposition is following:

This needs an update in hal/lp_ticker_info_test, as tested expression could exceed u32.
And made for the patch in hal/us_ticker_info_test
@kjbracey-arm

Impact of changes

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] 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


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Apr 13, 2021
@ciarmcom ciarmcom requested a review from a team April 13, 2021 09:30
@ciarmcom
Copy link
Member

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

@@ -22,6 +22,9 @@
#include "PinNames.h"
#include "gpio_object.h"

#include "us_ticker_defines.h"
#include "lp_ticker_defines.h"
Copy link
Contributor

@kjbracey kjbracey Apr 13, 2021

Choose a reason for hiding this comment

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

Eh? Why wasn't us_ticker_defines already there?

Oh, looks like this was broken in 4740775 from #13090.

So the wait_us optimisations have been broken for STM since Mbed OS 6.1, and the custom-tickers stuff would never have been doing anything.

This should be included in the documentation - you are also re-adding the missing USTICKER optimisations.

But only for STM32F0 in this version.

You should put the usticker include up in device.h, as it's a shared not-target-specific header, to reactivate it for all devices. (That would be reverting #13090 in its entirety.)

I guess you could put the usticker include in every objects.h instead, which would have made the custom target with replacement device.h work in #12990 but I'm not sure what was being done there (replacing device.h) was in any sense documented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kjbracey-arm
Updates done for all STM32

#define LP_TICKER_PERIOD_NUM 1000000

#if MBED_CONF_TARGET_LSE_AVAILABLE
#define LP_TICKER_PERIOD_DEN (LSE_VALUE / 4) // RTC_CLOCK / RTC_WAKEUPCLOCK_RTCCLK_DIV4
Copy link
Contributor

@kjbracey kjbracey Apr 13, 2021

Choose a reason for hiding this comment

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

What are the comments trying to say here?

If that's a better way of writing the expression, why not use it?

If you can't due to non-visibility of those macros in general context, so you're writing something you think should be equivalent, how about asserting equivalence in a C file where you can?

#if LP_TICKER_PERIOD_DEN != RTC_CLOCK / RTC_WAKEUPCLOCK_RTCCLK_DIV4
#error "Mismatch with lp_ticker_defines.h"
#endif

Although I guess the lp_ticker_info_test would catch it with its runtime cross-check.

******************************************************************************
*/

#ifndef __LP_TICKER_DEFINES_H
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that lp_ticker.c is common for all STM families, can't this file be common for all families too, like us_ticker_defines.h?

Would just need the extra ifdefs for DEVICE_LPTICKER and MBED_CONF_TARGET_LPTICKER_LPTIM you see in the C file.

@mergify mergify bot dismissed kjbracey’s stale review April 20, 2021 07:39

Pull request has been modified.

@jeromecoutant jeromecoutant changed the title STM32F0: Implement LPTICKER optimisation STM32: Add LP_TICKER and US_TICKER optimisation macro Apr 20, 2021
@@ -37,4 +37,7 @@

#include "objects.h"

#include "us_ticker_defines.h"
#include "lp_ticker_defines.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you make this include, or the contents of the header file, conditional on DEVICE_LPTICKER or whatever it is?

I'd rather the macros were left undefined in that case. There may not be any problem in the Mbed OS tree, but it's possible someone might assume LPTICKER is available if LP_TICKER_PERIOD_NUM is defined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kjbracey-arm
Done

@mergify mergify bot added needs: CI and removed needs: work labels Apr 20, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 21, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Apr 21, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test

@mergify mergify bot added needs: work and removed needs: CI labels Apr 21, 2021
@jeromecoutant
Copy link
Collaborator Author

Jenkins CI Test : ❌ FAILED

I forgot to indicate this PR needs #14554 first

@jeromecoutant
Copy link
Collaborator Author

Let's restart CI ?
Thx

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 28, 2021

CI restarted

@mbed-ci
Copy link

mbed-ci commented Apr 28, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test

@mergify mergify bot added needs: work and removed needs: CI labels Apr 28, 2021
@jeromecoutant
Copy link
Collaborator Author

Jenkins CI Test : ❌ FAILED

Seems to be an issue with Ethernet tests, which is not related to this PR :-(

@mbed-ci
Copy link

mbed-ci commented Apr 28, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 3 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test

@jeromecoutant
Copy link
Collaborator Author

Let's restart CI ?

@ciarmcom ciarmcom added the stale Stale Pull Request label May 10, 2021
@ciarmcom
Copy link
Member

This pull request has automatically been marked as stale because it has had no recent activity. @jeromecoutant, please carry out any necessary work to get the changes merged. Thank you for your contributions.

@ciarmcom ciarmcom added stale Stale Pull Request and removed stale Stale Pull Request labels May 14, 2021
@jeromecoutant
Copy link
Collaborator Author

Let's restart CI ?
Thx

@0xc0170
Copy link
Contributor

0xc0170 commented May 18, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented May 18, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 4 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 added ready for merge and removed needs: work stale Stale Pull Request labels May 18, 2021
@adbridge adbridge merged commit dcd6dc3 into ARMmbed:master May 24, 2021
@jeromecoutant jeromecoutant deleted the DEV_STM32F0_LPTICKER_OPTIM branch May 24, 2021 12:09
@mbedmain mbedmain added release-version: 6.12.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jun 18, 2021
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.

7 participants