Skip to content

Tests for SysTimer (the idle loop timer for tickless mode) #5548

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
Mar 1, 2018

Conversation

fkjagodzinski
Copy link
Member

@fkjagodzinski fkjagodzinski commented Nov 21, 2017

Description

Add tests for an RtosTimer class introduced with TICKLESS mode support in #4991.

Status

READY

Issues to be resolved before merge:

@fkjagodzinski
Copy link
Member Author

Regarding CI test runs -- this test suite needs first to be compiled with -DMBED_TICKLESS i.e.:

mbed test -t GCC_ARM -m NUCLEO_L476RG -n tests-mbedmicro-rtos-mbed-systimer -DMBED_TICKLESS --compile

and then run without -DMBED_TICKLESS i.e.:

mbed test -t GCC_ARM -m NUCLEO_L476RG -n tests-mbedmicro-rtos-mbed-systimer --run -v

Where do I need to include this setup?

@bulislaw
Copy link
Member

MBED_TICKLESS should be defined by targets that support tickless feature so I don't think you need to do anything special, it'll be tested by default for supported hw.

bulislaw
bulislaw previously approved these changes Nov 21, 2017
Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

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

LGTM

@bulislaw bulislaw requested a review from c1728p9 November 21, 2017 16:44
@0xc0170
Copy link
Contributor

0xc0170 commented Nov 22, 2017

This PR confused me first. The headline is about tests, but this introduces a new API: SysTimer . Please be more detailed in the description and the commit messages (expose details, do not hide them). Previously it was internal, now it is being exposed as public API.

We still do not have here http://www.keil.com/pack/doc/CMSIS/RTOS2/html/group__CMSIS__RTOS__TickAPI.html ? Wouldn't this API completely deprecate this SysTimer ?

How does this addition stands against RTOSTimer that is deprecated, and EventQueue, see this quote from the RTOSTimer:

@deprecated
 The RtosTimer has been superseded by the EventQueue. The RtosTimer and EventQueue duplicate
 the functionality of timing events outside of interrupt context, however the EventQueue
 has additional features to handle deferring other events to multiple contexts.

This is bringing new Timer to the user space. How does this compare to RTOSTimer, EventQueue, Timer/LowPowerTimer?

@fkjagodzinski
Copy link
Member Author

fkjagodzinski commented Nov 22, 2017

@0xc0170 This particular PR adds tests for a class named RtosTimer that was introduced with #4991 in

class RtosTimer : private TimerEvent {

Previously it was internal, now it is being exposed as public API.

This is only to make this class accessible for test code.

How does this addition stands against RTOSTimer that is deprecated

Apart from the class name -- it's unrelated.

This is bringing new Timer to the user space.

True. Maybe this could be avoided by putting class files some other place. Could anyone point the appropriate directory? Would rtos/TARGET_CORTEX/SysTimer.h be ok?

@fkjagodzinski fkjagodzinski changed the title SysTimer tests Tests for SysTimer (the idle loop timer for tickless mode) Nov 22, 2017
@theotherjimmy
Copy link
Contributor

I added a minor release version as minor releases may contain additions to the public set of API's. Patch releases may not contain additions to the public API set.

@theotherjimmy
Copy link
Contributor

I think this is waiting on clarification/review from @0xc0170

@bulislaw
Copy link
Member

Ah! I've missed the directory change. @0xc0170 good catch! Shall we move it to rtos/TARGET_CORTEX/ to separate it from RTOS APIs and in doxygen make explicit note that it's not part of the Mbed RTOS API and it's internal implementation of System Timer.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 24, 2017

Ah! I've missed the directory change. @0xc0170 good catch! Shall we move it to rtos/TARGET_CORTEX/ to separate it from RTOS APIs and in doxygen make explicit note that it's not part of the Mbed RTOS API and it's internal implementation of System Timer.

@fkjagodzinski What do you think? This would work (having it not part of public API, no inclusion besides the file that is using this internal API) and stating in the docs that this is internal detail.

@fkjagodzinski
Copy link
Member Author

Thanks for the comments! Here is the update:

  • moved SysTimer files to rtos/TARGET_CORTEX/,
  • updated doxygen -- now the docs for SysTimer will generate only if

    mbed-os/doxyfile_options

    Lines 637 to 641 in 4e22295

    # The ENABLED_SECTIONS tag can be used to enable conditional documentation
    # sections, marked by \if <section_label> ... \endif and \cond <section_label>
    # ... \endcond blocks.
    ENABLED_SECTIONS =
    contains RTOS_INTERNAL. This is my initial prposition regarding doxygen. Do you have any suggestions on how this should be handled?


/// Enable System Timer.
int32_t OS_Tick_Enable (void)
{
// Do not use SingletonPtr since this relies on the RTOS
if (NULL == os_timer) {
os_timer = new (os_timer_data) RtosTimer();
os_timer = new (os_timer_data) rtos::SysTimer();
Copy link
Member

Choose a reason for hiding this comment

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

Why did we split the constructor into 2 calls?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did that to avoid manipulating SysTick / IRQ registers while running tests. I also extracted set_irq_pending() from handler() for same reason.

#include "platform/NonCopyable.h"
#include "drivers/TimerEvent.h"

namespace rtos {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the test code, and here. This is in the rtos namespace. Is enough just docs note ?

I would propose to create own namespace for this within rtos, to show the intent, internal namespace within rtos: rtos::internal

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I added an additional internal namespace as suggested.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 30, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 30, 2017

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 30, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 30, 2017

@bulislaw
Copy link
Member

bulislaw commented Dec 1, 2017

@fkjagodzinski these tests should only be enabled for platforms defining TICKLESS macro.

@fkjagodzinski
Copy link
Member Author

Update:

  • as suggested, tests will run only for targets with MBED_TICKLESS defined,
  • rebased onto master,
  • squashed commits for readability.

Regarding test failures on NRF51_DK -- #5284 has to be resolved first.

@mbed-ci
Copy link

mbed-ci commented Feb 27, 2018

RtosTimer class introduced with tickless support in ARMmbed#4991 had to be
renamed because that name was already present in rtos namespace.
@fkjagodzinski
Copy link
Member Author

Update:

  • rebased onto master, which is now at 8b6a7aa,
  • updated tests:
    • removed test_reschedule() which duplicated test_update_tick(),
    • fixed test_update_tick(),
    • fixed test_deepsleep().

@c1728p9, @bulislaw I can see that rebase deprecated your reviews; the SysTimer class wasn't modified.

@fkjagodzinski
Copy link
Member Author

@cmonr, @0xc0170 Looks like this PR is ready. Could you trigger morph tests please?

@cmonr
Copy link
Contributor

cmonr commented Feb 28, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

1 similar comment
@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

@cmonr
Copy link
Contributor

cmonr commented Feb 28, 2018

/morph build

@cmonr
Copy link
Contributor

cmonr commented Feb 28, 2018

@fkjagodzinski Sorry about the multiple builds. Stale web pages don't auto-refresh, making me think I still need to invoke commands.

@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 28, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 1, 2018

@cmonr cmonr merged commit acad33a into ARMmbed:master Mar 1, 2018
@fkjagodzinski fkjagodzinski deleted the test-systimer branch March 1, 2018 09:05
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.

8 participants