Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

sg-
Copy link
Contributor

@sg- sg- commented Apr 19, 2017

Reverts #4097

@@ -34,13 +34,13 @@
#include "sleep_api.h"
#include "lp.h"

void hal_sleep(void)
void sleep(void)
Copy link
Contributor

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.

Copy link
Contributor

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)
Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

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

And this one.

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Apr 19, 2017

If we wanted the same behavior of #4097 without the extra flags, could we do:

#ifndef DEBUG

?

@theotherjimmy
Copy link
Contributor

@geky Did I get ^ right?

@theotherjimmy
Copy link
Contributor

/morph export-build

@geky
Copy link
Contributor

geky commented Apr 19, 2017

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.

@bulislaw
Copy link
Member

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.

@theotherjimmy
Copy link
Contributor

I think it makes sense to not sleep only for debug builds. Therefore: #ifndef DEBUG.

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph export-build

@geky
Copy link
Contributor

geky commented Apr 19, 2017

@studavekar, @bridadan
not sure what happened, but mbed bot looks unhappy:

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.util.ArrayList#getAt.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
	[interface groovy.lang.Range]
	[interface java.util.Collection]

Copy link
Contributor

@bridadan bridadan left a 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?

@bridadan
Copy link
Contributor

@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.

@bulislaw
Copy link
Member

Ok, let's take a step back. What is the problem with the original PR? People don't like MBED_DEBUG flag? Or not sleeping only for debug profile? Or something else?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 20, 2017

Ok, let's take a step back. What is the problem with the original PR? People don't like MBED_DEBUG flag? Or not sleeping only for debug profile? Or something else?

Reverts #4097

If we are reverting something, we should provide a reason why. @sg- Can you provide details?

@sg-
Copy link
Contributor Author

sg- commented Apr 20, 2017

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.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 24, 2017

/morph export-build

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 19

All exports and builds passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 24, 2017

Here's my summary (having looked at relevant PR that touched sleep and profiles)

  1. As it was until recently:

    sleep() function did sleep only if a board supports sleep functionality, and NDEBUG is defined.
    NDEBUG is defined only for the release build.

    Introduced as a fix to allow debugging applications using develop/debug profiles.

  2. With the patch for MBED_DEBUG:

    Leave NDEBUG out of the picture, introduce MBED_DEBUG. This is defined only for debug profile. Thus sleep is enabled by default (develop profile). And also enabled for the release sleep.
    On the other side, breaks uvisor (not yet supported there to go to sleep in the unpriviledged code) .

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 - NDEBUG but develop can't have that one defined (asserts would be off in the online IDE which we want to keep in).

@bulislaw
Copy link
Member

That's good analysis. Why are we thinking about reverting this PR or at least parts of it?

@geky
Copy link
Contributor

geky commented Apr 24, 2017

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:
https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/build_profiles/

And if we're going down the route of per-profile macros, should we define MBED_RELEASE and MBED_DEVELOP?

@bulislaw
Copy link
Member

Yeah, if we agree that per (standard) profile macros are something want to have, I'll add the remaining ones and update docs.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 25, 2017

And if we're going down the route of per-profile macros, should we define MBED_RELEASE and MBED_DEVELOP?

what would be the use for these? Shall an app change its behaviour for these (something like it does for NDEBUG/MBED_DEBUG) ?

@bulislaw
Copy link
Member

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.

@sg-
Copy link
Contributor Author

sg- commented Apr 27, 2017

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.

@adbridge
Copy link
Contributor

@sg- @bulislaw @geky So is there any progress on this?

@sg-
Copy link
Contributor Author

sg- commented Jun 15, 2017

Will plan some larger work to address the problems here and document the usage.

@sg- sg- closed this Jun 15, 2017
@sg- sg- deleted the revert-4097-build_debug_macro branch June 15, 2017 15:23
@sg- sg- removed the needs: work label Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants