Skip to content

Add FlashIAP block device as default block device for WISE 1570 #8317

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 3 commits into from
Oct 15, 2018

Conversation

yossi2le
Copy link
Contributor

@yossi2le yossi2le commented Oct 3, 2018

…AP as default block device for wise 1570

Description

This PR is adding FlashIAP block device component as the default block device for Wise 1570 board.
To accomplish this the deprecated constructor was reverted and used by calculating the start address at the first sector after the code address zone and the end address at the last sector before nvstore address zone.
This way the FlashIAP default block device does not overwrite any code or nvstore data.

Fix both issues MBEDOSTEST-209 and MBEDOSTEST-208 as they have been found to be related.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

@yossi2le yossi2le changed the title Add flashiap bd as default Add flashiap block device as default Oct 4, 2018
@yossi2le yossi2le changed the title Add flashiap block device as default Add flashiap block device as default block device for WISE 1570 Oct 4, 2018
@yossi2le yossi2le changed the title Add flashiap block device as default block device for WISE 1570 Add FlashIAP block device as default block device for WISE 1570 Oct 4, 2018
@0xc0170 0xc0170 requested a review from a team October 4, 2018 09:35
*
* @address Physical address where the block device start
* @size The block device size
*/
FlashIAPBlockDevice(uint32_t address, uint32_t size = 0);
Copy link
Contributor

@0xc0170 0xc0170 Oct 4, 2018

Choose a reason for hiding this comment

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

Why ? can you add details to the commit message why this is not deprecated anymore? And also changes in FlashIAPBlockDevice ctor - part of the revert or?

This will need to get into release notes if that is the case

Copy link
Contributor

Choose a reason for hiding this comment

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

We originally deprecated this constructor in the external repo, as this would have required the user to either keep a list of absolute addresses or to use FlashIAP driver to query the flash parameters (which would have been "ugly" if we already use FlashIAPBlockDevice). However, it turned out that this had actually broke those who used this block device and finally reverted that change in the external repo. In addition, there was no escape from using FlashIAP to query flash parameters before instantiating FlashIAPBlockDevice, as we needed to query sector sizes in order to calculate the partial file system location in flash.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some of these details to the commit msg?

@yossi2le yossi2le force-pushed the add-flashiap-bd-as-default branch 2 times, most recently from 2d6d256 to bb79a63 Compare October 9, 2018 15:09
size_t area_size;
FlashIAP flash;
NVStore &nvstore = NVStore::get_instance();
nvstore.get_area_params(0, top_address, area_size); //Find where nvstore begins
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work if NVStore is not present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. However, if there is flash so there is also NVStroe.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that true? I thought you need to call NVStore::init to create NVStore on disk.

Actually looking at get_area_params, by calling this function we are indirectly formatting the disk with NVStore. Which means we also have to pull in the NVStore logic.

Copy link
Contributor

@geky geky Oct 9, 2018

Choose a reason for hiding this comment

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

With call to nvstore.get_area_params():

Module .text .data .bss
[fill] 131(+0) 4(+0) 17(+0)
[lib] 20671(+0) 2488(+0) 117(+0)
components 902(+0) 0(+0) 0(+0)
drivers 764(+0) 4(+0) 140(+0)
features 2530(+0) 0(+0) 128(+0)
hal 1460(+0) 4(+0) 68(+0)
main.o 10(+0) 0(+0) 0(+0)
platform 1624(+0) 256(+0) 133(+0)
rtos 8293(+0) 168(+0) 6053(+0)
targets 11687(+0) 8(+0) 912(+0)
Subtotals 48072(+0) 2932(+0) 7568(+0)

Without call to nvstore.get_area_params():

Module .text .data .bss
[fill] 123(-8) 4(+0) 21(+4)
[lib] 20671(+0) 2488(+0) 117(+0)
components 902(+0) 0(+0) 0(+0)
drivers 764(+0) 4(+0) 140(+0)
features 140(-2390) 0(+0) 44(-84)
hal 1460(+0) 4(+0) 68(+0)
main.o 10(+0) 0(+0) 0(+0)
platform 1620(-4) 256(+0) 133(+0)
rtos 8055(-238) 168(+0) 6053(+0)
targets 11687(+0) 8(+0) 912(+0)
Subtotals 45432(-2640) 2932(+0) 7488(-80)

That's an extra 2.6KiB on platforms that just want internal flash not NVStore. Could we instead use config options specify the flash region? That's what we're currently doing for SPIF and SD pins.

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 have removed nvstore and added back the configuration option.
If no configuration supplied and still FlashIAP block device is enabled the block device will take the address of the first sector after code section till the end of the flash.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for that 👍

Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

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

See above comment, this shouldn't be pulling in the NVStore codebase

Revert deprecation of FlashIAPBlockDevice 2 argument constructor has this was a breaking change. This follows a similar change in the external flashiap-driver repo.
@yossi2le yossi2le force-pushed the add-flashiap-bd-as-default branch from bb79a63 to b84f377 Compare October 10, 2018 14:17
Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

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

Thanks for the fix 👍

Looks good to me. Though the use of the ROM_END makes me wonder what applications should do if they want to update (and grow in size) in the future. Should they be expected to specify a flash region with the config?

@yossi2le
Copy link
Contributor Author

Looks good to me. Though the use of the ROM_END makes me wonder what applications should do if they want to update (and grow in size) in the future. Should they be expected to specify a flash region with the config?

This is a known limitation for now and I guess if they want to be able to update they should specify the config parameters.

@cmonr
Copy link
Contributor

cmonr commented Oct 11, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2018

Build : FAILURE

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

@cmonr
Copy link
Contributor

cmonr commented Oct 12, 2018

Huh. Gonna see if this is was just a glitch.
/morph build

@cmonr cmonr removed the needs: work label Oct 12, 2018
@mbed-ci
Copy link

mbed-ci commented Oct 12, 2018

Build : FAILURE

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

@NirSonnenschein
Copy link
Contributor

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 14, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Oct 14, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 14, 2018

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.

9 participants