[riot-notifications] [RIOT-OS/RIOT] stm32f4/2: add flashpage and flashpage_raw (#11681)

Francisco notifications at github.com
Wed Jun 12 16:55:25 CEST 2019

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description

Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes

This PR adds `flashpage` and `flashpage_raw` for stm32f2 and stm32f4. They both use sectors as the way of dividing flash, instead of the usual page. These sector do not have the same size, and they can vary according to the specific CPU.

This PR implements `flashpage` and `flashpage_raw` as a wrapper over sectors. To still keep the page notion, an arbitrary `page` of length 1kB has been defined. When an erase is requested the sector where this `page` is located is only erased if the `page` was in not in a erase state anymore, i.e. '0xFF'. 

NOTE1: this "wrapper" concept is only for erasing, when it comes to writing it's pretty much the same than for other STM32.

NOTE2: there is an api change since a `flashpage_init()` is introduced. Not sure if that is the best option.

NOTE3: I tried to make it work for `stm32f7` but I have problems with unexpected latency when performing flash operations, so delaying it out; but the general approach works as well for `stm32f7`.

### Testing procedure

Tested on `nucleo-f207zg`, `nucleo-f446re` & `stm32f429i-disc1`. On these or other `stm32f2` and `stm32f4` run:

`make clean -C tests/periph_flashpage/ BOARD=nucleo-f207zg flash test`
everything should pass.

Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
### Issues/PRs references

Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * stm32f4/cpu_conf: add stm32f4 flashpage config
  * periph/flashpage: add init function
  * cpu/stm32f4: add flashpage and flashpage_raw
  * stm32f2/cpu_conf: add stm32f2 flashpage and flashsector config
  * cpu/stm32f2: add flashpage and flashpage_raw

-- File Changes --

    M cpu/stm32_common/periph/flash_common.c (3)
    M cpu/stm32_common/periph/flashpage.c (108)
    M cpu/stm32f2/Makefile.features (2)
    M cpu/stm32f2/include/cpu_conf.h (30)
    M cpu/stm32f4/Makefile.features (2)
    M cpu/stm32f4/include/cpu_conf.h (35)
    M drivers/include/periph/flashpage.h (6)
    M drivers/periph_common/init.c (7)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190612/e829ee9b/attachment.html>

More information about the notifications mailing list