{"action":"created","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2556","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2556/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2556/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2556/events","html_url":"https://github.com/ARMmbed/mbed-os/pull/2556","id":173461770,"number":2556,"title":"STM32F4 - Add STORAGE driver","user":{"login":"svastm","id":18262111,"avatar_url":"https://avatars.githubusercontent.com/u/18262111?v=3","gravatar_id":"","url":"https://api.github.com/users/svastm","html_url":"https://github.com/svastm","followers_url":"https://api.github.com/users/svastm/followers","following_url":"https://api.github.com/users/svastm/following{/other_user}","gists_url":"https://api.github.com/users/svastm/gists{/gist_id}","starred_url":"https://api.github.com/users/svastm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svastm/subscriptions","organizations_url":"https://api.github.com/users/svastm/orgs","repos_url":"https://api.github.com/users/svastm/repos","events_url":"https://api.github.com/users/svastm/events{/privacy}","received_events_url":"https://api.github.com/users/svastm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/do%20not%20merge","name":"do not merge","color":"b60205"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-08-26T14:08:05Z","updated_at":"2016-10-03T16:19:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2556","html_url":"https://github.com/ARMmbed/mbed-os/pull/2556","diff_url":"https://github.com/ARMmbed/mbed-os/pull/2556.diff","patch_url":"https://github.com/ARMmbed/mbed-os/pull/2556.patch"},"body":"### This is a work in progress, please do not merge.\r\n\r\nThis PR add a first implementation of `STORAGE` feature for STM32F4 targets.\r\n\r\nFor now, only the synchronous version pass the tests.\r\n\r\n### Concern for now :\r\n - NUCLEO_F429ZI\r\n - DISCO_F429ZI\r\n - DISCO_F469NI\r\n \r\n### TODO:\r\n\r\n - [x] syncronous version\r\n - [x] asyncronous version\r\n - [ ] port on smaller targets\r\n\r\nThere is still some points not very clear to me.\r\n\r\n---\r\n\r\n## Flash Size\r\n\r\nCompare to the K64F, the flash on STM32F4 targets is divided in big sectors. example for a `1MB` flash :\r\n\r\n```\r\n+----------------------+ <--- 0x08000000\r\n|  Sector 0  |  16kB   |\r\n+----------------------+\r\n|  Sector 1  |  16kB   |\r\n+----------------------+\r\n|  Sector 2  |  16kB   |\r\n+----------------------+\r\n|  Sector 3  |  16kB   |\r\n+----------------------+\r\n|  Sector 4  |  64kB   |\r\n+----------------------+\r\n|  Sector 5  |  128kB  |\r\n+----------------------+\r\n|  Sector 6  |  128kB  |\r\n+----------------------+\r\n|    ...     |  ...    |\r\n+----------------------+\r\n|  Sector 11 |  128kB  |\r\n+----------------------+ <--- 0x08100000\r\n```\r\nUsually the firmware is stored at the beginning of the flash and the storage at the end. That mean the cfstorage use sectors of `128kB` (= `ERASE_UNIT`). If the space needed by cfstorage does not exceed `64kB` (no FOTA ?) we could put the cfstorage in the sectors 0 to 3 and the firmware after that ? It would reduce `ERASE_UNIT` to `16kB`.\r\n\r\nSo my question is, is it mandatory to support a big cfstorage size ? Is it meant to be a file system or only to be used to store configurations ? What size should we usually keep for firmware ?\r\n\r\n## Test timeout\r\n\r\nI tried `features-storage-feature_storage-tests-flash_journal-basicapi` but it looks like greentea put a `60s` timeout on test suite. Also the test pass if it is split in two parts. I did not find a way to change timeout so maybe we should consider to split the test ?\r\n\r\n## Asynchronous\r\n\r\nIf the asynch mode is used, who is responsible for checking that no command is ongoing before starting a new one ? I have added a wait before `read()`, `program_data()` and `erase()` but it should be handle higher right ? For now, this is not handle in the tests so i think i missed something.\r\n\r\n---\r\n\r\n# Tests\r\n\r\n - **Synchronous**\r\n   * **ARM**\r\n ```\r\n +-------------------+---------------+----------------------------------------------------------+--------+--------------------+-------------+\r\n| target            | platform_name | test suite                                               | result | elapsed_time (sec) | copy_method |\r\n+-------------------+---------------+----------------------------------------------------------+--------+--------------------+-------------+\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-add_del   | OK     | 24.73              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-close     | OK     | 13.87              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-create    | OK     | 17.49              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-dump      | OK     | 19.16              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example1  | OK     | 9.37               | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example2  | OK     | 13.62              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example3  | OK     | 15.95              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example4  | OK     | 9.45               | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example5  | OK     | 9.39               | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-find      | OK     | 15.74              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-find2     | OK     | 13.75              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flash     | OK     | 14.83              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flash_set | OK     | 10.53              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush     | OK     | 8.78               | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush2    | OK     | 15.8               | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush3    | OK     | 9.7                | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-init      | OK     | 13.89              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-misc      | OK     | 15.46              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-open      | OK     | 17.67              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-read      | OK     | 14.54              | shell       |\r\n| NUCLEO_F429ZI-ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-write     | OK     | 14.32              | shell       |\r\n+-------------------+---------------+----------------------------------------------------------+--------+--------------------+-------------+\r\n ```\r\n   * **GCC_ARM**\r\n ```\r\n +-----------------------+---------------+----------------------------------------------------------+---------+--------------------+-------------+\r\n| target                | platform_name | test suite                                               | result  | elapsed_time (sec) | copy_method |\r\n+-----------------------+---------------+----------------------------------------------------------+---------+--------------------+-------------+\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-add_del   | OK      | 25.67              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-close     | OK      | 14.84              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-create    | OK      | 18.59              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-dump      | OK      | 20.13              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example1  | OK      | 17.12              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example2  | OK      | 14.52              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example3  | OK      | 17.32              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example4  | OK      | 10.31              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example5  | OK      | 10.24              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-find      | OK      | 16.5               | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-find2     | OK      | 14.56              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flash     | OK      | 15.85              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flash_set | OK      | 11.38              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush     | TIMEOUT | 69.73              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush2    | OK      | 16.74              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush3    | OK      | 10.21              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-init      | OK      | 14.75              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-misc      | OK      | 16.38              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-open      | OK      | 18.53              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-read      | OK      | 15.33              | shell       |\r\n| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-write     | OK      | 15.22              | shell       |\r\n+-----------------------+---------------+----------------------------------------------------------+---------+--------------------+-------------+\r\n ```\r\n   * **IAR**\r\n ```\r\n +-------------------+---------------+----------------------------------------------------------+--------+--------------------+-------------+\r\n| target            | platform_name | test suite                                               | result | elapsed_time (sec) | copy_method |\r\n+-------------------+---------------+----------------------------------------------------------+--------+--------------------+-------------+\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-add_del   | OK     | 24.8               | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-close     | OK     | 13.92              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-create    | OK     | 17.7               | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-dump      | OK     | 19.24              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example1  | OK     | 8.91               | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example2  | OK     | 13.78              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example3  | OK     | 16.05              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example4  | OK     | 9.4                | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-example5  | OK     | 9.47               | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-find      | OK     | 15.67              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-find2     | OK     | 13.86              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flash     | OK     | 15.16              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flash_set | OK     | 10.54              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush     | OK     | 8.82               | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush2    | OK     | 15.88              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-flush3    | OK     | 9.4                | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-init      | OK     | 13.81              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-misc      | OK     | 15.32              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-open      | OK     | 17.93              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-read      | OK     | 14.62              | shell       |\r\n| NUCLEO_F429ZI-IAR | NUCLEO_F429ZI | features-storage-feature_storage-tests-cfstore-write     | OK     | 14.26              | shell       |\r\n+-------------------+---------------+----------------------------------------------------------+--------+--------------------+-------------+\r\n ```\r\n\r\n# Results\r\n\r\nThe `features-storage-feature_storage-tests-cfstore-flush` fail only on GCC_ARM because the test suite is specific to this toolchain ? I don't know why. The test failed is named `cfstore_flush_test_02_k64f`."},"comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments/251152040","html_url":"https://github.com/ARMmbed/mbed-os/pull/2556#issuecomment-251152040","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2556","id":251152040,"user":{"login":"sg-","id":496002,"avatar_url":"https://avatars.githubusercontent.com/u/496002?v=3","gravatar_id":"","url":"https://api.github.com/users/sg-","html_url":"https://github.com/sg-","followers_url":"https://api.github.com/users/sg-/followers","following_url":"https://api.github.com/users/sg-/following{/other_user}","gists_url":"https://api.github.com/users/sg-/gists{/gist_id}","starred_url":"https://api.github.com/users/sg-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sg-/subscriptions","organizations_url":"https://api.github.com/users/sg-/orgs","repos_url":"https://api.github.com/users/sg-/repos","events_url":"https://api.github.com/users/sg-/events{/privacy}","received_events_url":"https://api.github.com/users/sg-/received_events","type":"User","site_admin":false},"created_at":"2016-10-03T16:19:26Z","updated_at":"2016-10-03T16:19:26Z","body":"Needs a lot of work as to how drivers are composed and used. This is mainly a problem with not following the mbed C hal rather bringing in a new hal. Not sure the solution ATM but this will not fly and goes against all that we're trying to do.\r\n\r\n```\r\n+#if defined(TARGET_K64F)\r\n  extern ARM_DRIVER_STORAGE ARM_Driver_Storage_MTD_K64F;\t\t  extern ARM_DRIVER_STORAGE ARM_Driver_Storage_MTD_K64F;\r\n  ARM_DRIVER_STORAGE *drv = &ARM_Driver_Storage_MTD_K64F;\t\t  ARM_DRIVER_STORAGE *drv = &ARM_Driver_Storage_MTD_K64F;\r\n +#elif defined(TARGET_STM)\r\n +extern ARM_DRIVER_STORAGE ARM_Driver_Storage_MTD_STM32;\r\n +ARM_DRIVER_STORAGE *drv = &ARM_Driver_Storage_MTD_STM32;\r\n +#else\r\n +extern ARM_DRIVER_STORAGE ARM_Driver_Storage_(0);\r\n +ARM_DRIVER_STORAGE *drv = &ARM_Driver_Storage_(0);\r\n +#endif\r\n```"}}
{"actor":{"display_login":"sg-"}}