Skip to content

Add default block device support (SD, SPIF and FLASHIAP) documentation #685

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 22 commits into from
Sep 17, 2018

Conversation

yossi2le
Copy link
Contributor

This PR is intended to update the documentation of block devices and filesystems after the merge of PR ARMmbed/mbed-os#7774 into mbed-os.

The documentation contains

  1. Change of paths.
  2. Update new implementation of get default instance for BlockDevice and FileSystem.
  3. Importing into mbed-os and modify the documentation of external SD, SPIF, DATAFLASH and FLASHIAP drivers

Please refer to PR #7774 in the link above for all details regarding this change.

…vice FileSystem documentation for new get_default_instance implementation
@@ -30,6 +30,66 @@ The state of an erased block is **undefined**. The data stored on the block isn'

![blockdevicesectors](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/blockdevice_erase_block.png)

### BlockDevice get default instance
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 add this to the storage configuration page?

https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/reference/configuration/Storage.md

Maybe add a BlockDevice section?

Amanda Butler added 5 commits August 28, 2018 16:29
Copy edit file, mostly for grammar and style consistency.
Make initial copy edits, mostly for formatting.
Copy edit for spelling and minor style nits.
Remove extra information from user API, and copy edit remaining text.
Copy link
Contributor

@AnotherButler AnotherButler left a comment

Choose a reason for hiding this comment

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

Please address my comments.

@@ -6,6 +6,34 @@ The main purpose of a FileSystem is to be instantiated. The FileSystem's constru

The FileSystem's `file` and `dir` functions are protected because you should not use the FileSystem `file` and `dir` functions directly. They are only a convenience for implementors. Instead, the [File](file.html) and [Dir](dir.html) classes provide access to file and directory operations in a C++ class that respects [RAII](/docs/development/introduction/glossary.html#r) and other C++ conventions.

### File system get default instance
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Can we move the configuration content to the storage config page?


## FlashIAPBlockDevice class reference

[![View code](https://www.mbed.com/embed/?type=library)](<Should be added after doxygen run>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Do we have an example for this yet? If not, can you create one?

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, but I will add a code snippet to help people understand how to use it.

@@ -0,0 +1,17 @@
## FlashIAPBlockDevice

The flash IAP block device is a block device driver built on top of the FlashIAP API.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add more description of what this API does and its use cases.


The flash IAP block device is a block device driver built on top of the FlashIAP API.

## Warning
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to have Product review this warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This warning should be removed.

- The file system code (hosted in `mbed-os`) is composed of 2 parts: the FAT file system implementation code and the file system classes that present a consistent API to the retarget module for different (third-party) file system implementations.
- The Block API. The SDCard block device is a persistent storage block device.
- The SPI module provides the Mbed OS SPI API.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a section here linking to our Doxygen.

Please note that while a default block device exists an application is not enforced to use it and can create its own one.

### Overriding default block device implementation
The get default instance is implemented as MBED_WEAK at features/storage/system_storage/SystemStorage.cpp. That means that it can be overridden by implementing the function without MBED_WEAK and change the default block device for a given application.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a link to -> this will be useful ?? it's not immediately clear to me what the macro means..

@yossi2le
Copy link
Contributor Author

Hi @AnotherButler. I will update the PR today with changes addressing all comments.
@ashok-rao I am moving the configuration and overriding to storage configuration guide. I will add the link you ask over there.
Thank you all, stay tuned.

….md config. Adding info regarding FlashIAPBlockDevice.
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.

No comments, looks great.

Amanda Butler added 6 commits August 30, 2018 12:33
Copy edit file, mostly for consistent tense across docs.
Copy edit file, mostly for active voice.
Delete duplicate content.
Delete duplicate content.
Copy edit file for clarity.
Copy edit file for active voice, present tense and other grammar.

#### Configuring components

Adding "components": ["???"] in targets.json:
Copy link
Contributor

Choose a reason for hiding this comment

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

@theotherjimmy As it's the weekend in Israel, could you please tell me what should go here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's going to be one of "SD", "SPIF" or "FLASHIAP"

Copy link
Contributor

Choose a reason for hiding this comment

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

This should just say "for example, the following entry in targets.json enables the SD component". The following example should be trimmed to only identifying info and the important information.

Copy link
Contributor

Choose a reason for hiding this comment

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

 "K64F": {
        "components": ["SD"],
        "core": "Cortex-M4F",
        "supported_toolchains": ["ARM", "GCC_ARM", "IAR"],
        "inherits": ["Target"],
        "features": ["STORAGE"],
        "release_versions": ["2", "5"],
        ...
    },

Is probably enough to get the point across.

},
```

Adding "target.components_add": ["???"] in application config file:
Copy link
Contributor

Choose a reason for hiding this comment

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

@theotherjimmy As it's the weekend in Israel, could you please tell me what should go here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor

Choose a reason for hiding this comment

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

So could I change it to

Adding "target.components_add": [""] in application config file:

For clarity?

Copy link
Contributor

Choose a reason for hiding this comment

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

No. That particular line is somewhat nonsense, somewhat leads to unexpected behavior.

Copy link
Contributor

@theotherjimmy theotherjimmy Aug 31, 2018

Choose a reason for hiding this comment

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

I recommend:
"The following mbed_app.json snippet enables the Spi flash component when compiling for the MTB_ADV_WISE_1570 target.

       "MTB_ADV_WISE_1570": {
            "target.components_add": ["SPIF"]
       }

(removed unrelated lines from the example)

Copy link
Contributor

Choose a reason for hiding this comment

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

@theotherjimmy Let's keep the comments professional and kind. I know @yossi2le and I both appreciate your help streamlining the example, but it doesn't mean the redundant lines are "garbage".

Copy link
Contributor

@theotherjimmy theotherjimmy Sep 4, 2018

Choose a reason for hiding this comment

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

As in "things to be thrown out"? I could have picked a more constructive word for sure. That word may have been in poor taste. Edited.

Personally I think unrelated lines take away from an example as they have the potential to distract or misdirect the reader and I find that having them is a determent to the example.

I meat no ill will or disparaging remarks to anyone or their writing skills/style.


Honestly, The beginning of that comment was really worse so I edited that out too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@theotherjimmy No hard feelings;)


### DataFlashBlockDevice class reference

[![View code](https://www.mbed.com/embed/?type=library)](<Should be added after doxygen run>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: Add link after code merges.


## FlashIAPBlockDevice class reference

[![View code](https://www.mbed.com/embed/?type=library)](<Should be added after doxygen run>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: Add link after code merges.


### SDBlockDevice class reference

[![View code](https://www.mbed.com/embed/?type=library)](<Should be added after doxygen run>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: Add link after code merges.


### SPIFBlockDevice class reference

[![View code](https://www.mbed.com/embed/?type=library)](<Should be added after doxygen run>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: Add link after code merges.

Update snippets with recommended changes for clarity.
@yossi2le
Copy link
Contributor Author

yossi2le commented Sep 2, 2018

@AnotherButler Thanks for the changes.

@AnotherButler
Copy link
Contributor

@yossi2le I can't find the code in the Doxygen: https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/annotated.html

Could you please help me?

@yossi2le
Copy link
Contributor Author

yossi2le commented Sep 4, 2018

@yossi2le I can't find the code in the Doxygen: https://os-doc->builder.test.mbed.com/docs/development/mbed-os-api-doxy/annotated.html

Could you please help me?

I wish I could. I am puzzled, are we looking at the correct build.
its written at the end of the BlockDevice documentation:

The documentation for this class was generated from the following file:
mbed-os/features/filesystem/bd/BlockDevice.h

However, this file has been moved to mbed-os/features/storage/blockdevice/BlockDevice.h

I have a feeling this Doxygen output is before #7774

@AnotherButler
Copy link
Contributor

@kegilbert Is this something you can help with?

@AnotherButler
Copy link
Contributor

@yossi2le @kegilbert I'm going to comment out the broken links until we can fix them. That way, I can merge this, so OOB can start reviewing the descriptions and examples. Please do not stop working to figure out why these links don't work just because this PR is closing.

Amanda Butler added 2 commits September 4, 2018 06:50
Temporarily comment out missing link.
@yossi2le
Copy link
Contributor Author

yossi2le commented Sep 4, 2018

@AnotherButler
Like I wrote before I am guessing the links are broken because the Doxygen generated not from the most updated master.

Amanda Butler added 2 commits September 4, 2018 06:52
Comment out missing link.
Comment out missing link.
@AnotherButler
Copy link
Contributor

@yossi2le @kegilbert I've updated the Doxygen, and these classes still aren't appearing: https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/annotated.html

Should they be under Data Structures, where I'm looking? Or are they somewhere else?

Amanda Butler added 4 commits September 17, 2018 15:30
Fix broken link now that Doxygen's fixed.
Add link now that Doxygen's fixed.
Add link now that Doxygen's fixed.
Add link now that Doxygen's fixed.
@AnotherButler AnotherButler merged commit 1becbc4 into ARMmbed:development Sep 17, 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.

5 participants