-
Notifications
You must be signed in to change notification settings - Fork 3k
Revert "Debug build flag + change to sleep behavior in debug mode" #4200
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
Conversation
@@ -34,13 +34,13 @@ | |||
#include "sleep_api.h" | |||
#include "lp.h" | |||
|
|||
void hal_sleep(void) | |||
void sleep(void) |
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.
can we keep this change? I would like to not re-break master.
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, we should
{ | ||
LP_EnterLP2(); | ||
} | ||
|
||
// Low-power stop mode | ||
void hal_deepsleep(void) | ||
void deepsleep(void) |
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 change too.
{ | ||
hal_sleep(); | ||
sleep(); |
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.
And this one.
If we wanted the same behavior of #4097 without the extra flags, could we do: #ifndef DEBUG ? |
@geky Did I get ^ right? |
/morph export-build |
It looks like NDEBUG is only set for the release profile (not develop). Perhaps we should be setting NDEBUG in the develop profile as well? There is a change needed for the sleep behaviour @bulislaw is looking for, although !NDEBUG being different from MBED_DEBUG does not make sense to me, so +1 for this revert. |
I think we don't want to set 'NDEBUG' for 'develop' as it should carry some debug info. It has to to be fair otherwise people using online ide won't get any error info. For me it would make sense to define debug level flags the same way we have debug level profiles. |
I think it makes sense to not sleep only for debug builds. Therefore: |
Result: FAILUREYour command has finished executing! Here's what you wrote!
|
@studavekar, @bridadan
|
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.
Agreed with @theotherjimmy, can we keep the fix in?
@geky Yup, the config on the CI side wasn't happy. I've pushed another patch, but because there are other jobs in the queue I can't really test my changes before they go live. I believe I've fixed it once in for all, but no way to tell for sure until we run it again. |
Ok, let's take a step back. What is the problem with the original PR? People don't like |
This revert is not to go in as is but the way it went in was wrong and I'm even questioning the original motivation for NDEBUG in the sleep APIs which seems to be the reason we got here in the first place. See comments in #4097 I think the initial addition of NDEBUG was wrong to begin with given I cant tell what problem it solved or any documentation to support its addition. |
/morph export-build |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 19 All exports and builds passed! |
Here's my summary (having looked at relevant PR that touched sleep and profiles)
I think the 2nd is good (introducing another macro, disconnecting from NDEBUG) to enable sleep for develop and release. The debug profile is for debugging, thus disabling sleep. The ideal solution would be to use one macro - |
That's good analysis. Why are we thinking about reverting this PR or at least parts of it? |
My one qualm is that NDEBUG not matching MBED_DEBUG is a bit confusing. But I can see why you'd want to keep them seperate here. We should probably add which flags are defined by each profile: And if we're going down the route of per-profile macros, should we define MBED_RELEASE and MBED_DEVELOP? |
Yeah, if we agree that per (standard) profile macros are something want to have, I'll add the remaining ones and update docs. |
what would be the use for these? Shall an app change its behaviour for these (something like it does for NDEBUG/MBED_DEBUG) ? |
We don't have usage for now, that's why I haven't added them in the first place. But if we add them to be build profile and docs they are ready to be used when needed. If we don't do that we risk people doing it yet another way. |
https://vilimpoc.org/blog/2017/04/24/power-profiling-on-mbed-nordic-nrf5-series/ Only enabling low power (not lowest but low) based on release profile doesn't seem nice. We shouldn't poke at a solution here and if there is no solution, legacy FTW. |
Will plan some larger work to address the problems here and document the usage. |
Reverts #4097