Skip to content

FlashIAP & NVStore tests: Skip test if overwriting code in flash #7212

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 2 commits into from
Aug 21, 2018

Conversation

davidsaada
Copy link
Contributor

@davidsaada davidsaada commented Jun 13, 2018

Description

The FlashIAP test erases the last two sectors in some of its test cases. NVStore test does the same. However, with boards that have small flash components (and large last sectors), this test may overwrite the code section. This fix checks that scenario and skips the test if it is indeed the case.
Resolves #7149 and #7388.

Pull request type

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

@davidsaada
Copy link
Contributor Author

@jeromecoutant Would be glad if you could test this fix on your board, as I don't have it. If you can do it on all supported three toolchains (GCC_ARM, ARM, IAR), it would be best. Note that if it works, you should see a print telling the test was skipped.

#endif

// This macro returns if flash test overwrites the code in flash.
#define RETURN_IF_TEST_OVERWRITES_CODE(ADDRESS) \
Copy link
Contributor

Choose a reason for hiding this comment

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

this would be nicer if its just a function, no need for a macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a big macro fan myself. However, in this case, macro seems like the better solution, as it includes a return inside. Turning this into a function would make the code a bit more bloated, as it would make all three tests check the return value, and return if it indicates that the code is getting overwritten. No biggie, can change if required.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Fine as it is

0xc0170
0xc0170 previously approved these changes Jun 14, 2018
@jeromecoutant
Copy link
Collaborator

Hi
It looks OK with F410 and GCC,

But I couldn't compile for L475VG and ARM...

[DEBUG] Errors: Error: L6218E: Undefined symbol Load$$LR$$LR_m_text$$Limit (referred from BUILD/tests/DISCO_L475VG_IOT01A/ARM/TESTS/mbed_drivers/flashiap/main.o).

@davidsaada
Copy link
Contributor Author

@jeromecoutant Yes I am able to reproduce this problem with the ARM compiler (the other toolchains seem to behave properly). Will probably need more time to investigate.

@davidsaada
Copy link
Contributor Author

@jeromecoutant Please retest with the ARM compiler. Made a change that depends on another open PR, so even if it works, it'll be some time until it gets merged. You only need to pull TESTS/mbed_drivers/flashiap/main.cpp (other files aren't relevant for your target).

@davidsaada davidsaada force-pushed the david_flashiap_test_small_flash branch from a7657df to 3097d66 Compare June 18, 2018 15:20
@jeromecoutant
Copy link
Collaborator

Hi

  • ARM: OK
  • GCC: OK
  • IAR: test crashes (it doesn't detect the end of code section ?)

@davidsaada davidsaada force-pushed the david_flashiap_test_small_flash branch 2 times, most recently from 908711d to dc5147f Compare June 20, 2018 12:31
@davidsaada
Copy link
Contributor Author

davidsaada commented Jun 20, 2018

IAR: test crashes (it doesn't detect the end of code section ?)

OK, I think I understand the problem (has to do with the beginning of the text section). Pushed a fix for it now. Keeps working on the boards I have.
@jeromecoutant Would appreciate retesting. I added a debug print in the beginning of the init test. Will be used if the test doesn't pass and removed if it does.

@davidsaada davidsaada force-pushed the david_flashiap_test_small_flash branch from dc5147f to 102eeaa Compare June 20, 2018 15:45
jeromecoutant
jeromecoutant previously approved these changes Jun 21, 2018
Copy link
Collaborator

@jeromecoutant jeromecoutant left a comment

Choose a reason for hiding this comment

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

As discussed by mail, test seems OK with ARM, GCC and IAR now

@davidsaada
Copy link
Contributor Author

Thanks @jeromecoutant. Just pushed a commit without the debug print.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 21, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 21, 2018

Build : FAILURE

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

@cmonr
Copy link
Contributor

cmonr commented Jun 21, 2018

@davidsaada Please review the build linker issues.

@cmonr
Copy link
Contributor

cmonr commented Aug 15, 2018

@ARMmbed/mbed-os-storage Mind taking a quick look at the test changes? Should be fine.

Copy link
Contributor

@offirko offirko left a comment

Choose a reason for hiding this comment

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

Looks great to me

@mbed-ci
Copy link

mbed-ci commented Aug 16, 2018

@davidsaada
Copy link
Contributor Author

Test needs to be rerun. Failure is on a timeout after flashing the image. Tried myself with the same board and it works OK.

@cmonr
Copy link
Contributor

cmonr commented Aug 16, 2018

/morph test

David Saada added 2 commits August 16, 2018 21:59
Remove unnecessary manual inclusion of tmpm64b_fc object file in linker script
@mbed-ci
Copy link

mbed-ci commented Aug 17, 2018

@cmonr
Copy link
Contributor

cmonr commented Aug 17, 2018

Welp, at least now the test that caused this PR to fail is not longer in the repo.

/morph test

@cmonr
Copy link
Contributor

cmonr commented Aug 17, 2018

/morph test

@davidsaada davidsaada force-pushed the david_flashiap_test_small_flash branch from 7fddba1 to 876b5f7 Compare August 17, 2018 13:12
@davidsaada
Copy link
Contributor Author

davidsaada commented Aug 17, 2018

@cmonr Rebased following merge of #7670 (as both modify the NVstore tests). Please rerun morph build when done.

@cmonr
Copy link
Contributor

cmonr commented Aug 17, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Aug 17, 2018

Build : SUCCESS

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

Triggering tests

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

@cmonr
Copy link
Contributor

cmonr commented Aug 17, 2018

/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Aug 17, 2018

@mbed-ci
Copy link

mbed-ci commented Aug 17, 2018

@davidsaada
Copy link
Contributor Author

@cmonr Don't know what this failure is about, probably not related to this PR. Regardless, please note that this PR is depending on #7791. As both PRs are on the verge of merging (after uVisor test failure gets sorted out), I don't think we should rebase this one and go through the entire morph build process again. Please just take this into consideration if and when both PRs get merged.

@cmonr
Copy link
Contributor

cmonr commented Aug 19, 2018

It's possible that a commit that was merged caused the uVisor test to break in a strange way. We've been keeping an eye on it this weekend since it's blocking a whole slew of PRs from being merged :(

@NirSonnenschein
Copy link
Contributor

/morph uvisor-test

@cmonr cmonr merged commit c10ad7f into ARMmbed:master Aug 21, 2018
@davidsaada davidsaada deleted the david_flashiap_test_small_flash branch August 22, 2018 09:09
pan- pushed a commit to pan-/mbed that referenced this pull request Aug 22, 2018
…mall_flash

FlashIAP & NVStore tests: Skip test if overwriting code in flash
@cmonr
Copy link
Contributor

cmonr commented Aug 23, 2018

Retagging for 5.10 since FLASHIAP_ROM_END is not in a patch release.

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.

FLASH test for small targets
7 participants