Skip to content

Add HAL CRC test and header file #6831

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 7 commits into from
Jun 13, 2018
Merged

Add HAL CRC test and header file #6831

merged 7 commits into from
Jun 13, 2018

Conversation

mprse
Copy link
Contributor

@mprse mprse commented May 7, 2018

Description

Add CRC HAL API test and test header file.

Since the testing requirements were not provided in PR #6708 I allowed myself to define them here.

@scartmell-arm Please review the test and testing requirements and update if something is wrong or should be additionally tested.

Status

READY

Related PRs

#6708 - provides CRC HAL API definition and example driver for K64F. Needs to be merged before this one.

Pull request type

[ ] Fix
[ ] Refactor
[ ] New target
[X] Feature
[ ] Breaking change

@cmonr cmonr requested a review from a user May 7, 2018 23:00
@ghost ghost mentioned this pull request May 9, 2018
ghost
ghost previously approved these changes May 14, 2018
@cmonr
Copy link
Contributor

cmonr commented May 24, 2018

@scartmell-arm hal/crc_api.h exists in both this PR and #6708. Was that the intention, or is this PR only suppose to contain tests?

@ghost
Copy link

ghost commented May 25, 2018

@scartmell-arm hal/crc_api.h exists in both this PR and #6708. Was that the intention, or is this PR only suppose to contain tests?

This PR should only contain tests, and use the header in #6708

@mprse
Copy link
Contributor Author

mprse commented May 25, 2018

@scartmell-arm hal/crc_api.h exists in both this PR and #6708. Was that the intention, or is this PR only suppose to contain tests?

This PR should only contain tests, and use the header in #6708

This PR provides test and header file. The header file has been added since original header file (from PR #6708) dose not provide requirements section in form which is common for all other HAL APIs (e.g.

/**
* \defgroup hal_ticker_shared Ticker Hal
* Low level interface to the ticker of a target
*
* # Defined behavior
* * The function ticker_init is safe to call repeatedly - Verified by test ::ticker_init_test
* * The function ticker_init allows the ticker to keep counting and disables the ticker interrupt - Verified by test ::ticker_init_test
* * Ticker frequency is non-zero and counter is at least 8 bits - Verified by ::ticker_info_test
* * The ticker rolls over at (1 << bits) and continues counting starting from 0 - Verified by ::ticker_overflow_test
* * The ticker counts at the specified frequency +- 10% - Verified by ::ticker_frequency_test
* * The ticker increments by 1 each tick - Verified by ::ticker_increment_test
* * The ticker interrupt fires only when the ticker times increments to or past the value set by ticker_set_interrupt.
* Verified by ::ticker_interrupt_test and ::ticker_past_test
* * It is safe to call ticker_set_interrupt repeatedly before the handler is called - Verified by ::ticker_repeat_reschedule_test
* * The function ticker_fire_interrupt causes ticker_irq_handler to be called immediately from interrupt context -
* Verified by ::ticker_fire_now_test
* * The ticker operations ticker_read, ticker_clear_interrupt, ticker_set_interrupt and ticker_fire_interrupt
* take less than 20us to complete - Verified by ::ticker_speed_test
*
* # Undefined behavior
* * Calling any function other than ticker_init before the initialization of the ticker
* * Whether ticker_irq_handler is called a second time if the time wraps and matches the value set by ticker_set_interrupt again
* * Calling ticker_set_interrupt with a value that has more than the supported number of bits
* * Calling any function other than us_ticker_init after calling us_ticker_free
*
* # Potential bugs
* * Drift due to reschedule - Verified by ::ticker_repeat_reschedule_test
* * Incorrect overflow handling of timers - Verified by ::ticker_overflow_test
* * Interrupting at a time of 0 - Verified by ::ticker_overflow_test
* * Interrupt triggered more than once - Verified by ::ticker_interrupt_test
*
* @ingroup hal_us_ticker
* @ingroup hal_lp_ticker
).

I allowed myself to create such requirements for testing purposes and requested @scartmell-arm for review.

So this PR adds only testing requirements to original header file.

@ghost
Copy link

ghost commented May 25, 2018

In that case, it could be added as part of this PR being merged?

@adbridge
Copy link
Contributor

@mprse Is this going to need a rebase then once the other PR gets merged ? Also I'm not sure we should have test references in header files providing an API! @bulislaw can you comment please ?

@mprse
Copy link
Contributor Author

mprse commented May 25, 2018

Is this going to need a rebase then once the other PR gets merged ?

Probably yes.

@adbridge adbridge requested a review from bulislaw May 25, 2018 13:07
@mprse
Copy link
Contributor Author

mprse commented May 25, 2018

I have synced this PR with header file from #6708 yesterday.
But the requirements should be defined in #6708 and this PR should contains only test and test header.

I can remove this commit... And we can add them later.

@cmonr
Copy link
Contributor

cmonr commented May 25, 2018

Awaiting the rebase!

Two things. 1) Generally, tests can come in at any time. It would have probably been better to bring this in with the other PR as a single commit, but that's alright.
2) Talked with @bulislaw about the test headers being in HAL. That's apparently alright.

@cmonr cmonr added risk: A and removed risk: R labels May 25, 2018
@adbridge
Copy link
Contributor

adbridge commented May 25, 2018

  1. Talked with @bulislaw about the test headers being in HAL. That's apparently alright.

OK not sure I totally agree with this but he is tech lead for Hal so his call.

@cmonr
Copy link
Contributor

cmonr commented May 25, 2018

Taking this outside of 5.9. Build failures indicate IAR linker issues with the new test.

Tests can come in during patch releases.

@0xc0170
Copy link
Contributor

0xc0170 commented May 29, 2018

@mprse As the CRC was integrated, can you review the build failures?

@cmonr
Copy link
Contributor

cmonr commented Jun 4, 2018

@mprse Ping

@cmonr cmonr requested a review from jamesbeyond June 4, 2018 21:13
@mprse
Copy link
Contributor Author

mprse commented Jun 7, 2018

@mprse Ping

I was out of office and I returned today.
Looks like this test is too big (NUCLEO_F070RB, NUCLEO_F072RB/IAR - out of memory). I'll try to reduce its size or split it into two tests.

mprse added 7 commits June 7, 2018 10:17
…RB/IAR

Allocate test case array on stack since memory limits on some boards.
…es CRC width

It looks like the intention was to return false when CRC width is different than: {16, 32} bits.
According to the test results final XOR was incorrectly handled by the CRC driver.
This patch fixes this issue.
@mprse
Copy link
Contributor Author

mprse commented Jun 7, 2018

Provided fix for NUCLEO_F070RB, NUCLEO_F072RB/IAR - out of memory issue.
Also provided some fixes/modifications in NUCLEO and K64F CRC drivers since the tests have detected some issues. @scartmell-arm please review.

@cmonr
Copy link
Contributor

cmonr commented Jun 12, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 12, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Jun 12, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 13, 2018

Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

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

LGTM

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