Skip to content
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

STM32 Flash 2MB GetSector fix #5455

Merged
merged 2 commits into from
Nov 9, 2017
Merged

Conversation

LMESTM
Copy link
Contributor

@LMESTM LMESTM commented Nov 8, 2017

Description

This is a fix to issue #5450
The GetSector computation for 2MB flash topology was erroneous, and is fixed in this PR.

Status

READY

Tests

  • Test case from issue
    With the fix, the test program shared in the issue now outputs the expected data..
ram
Sector at  0x8000000 of size 16384
Sector at  0x8004000 of size 16384
Sector at  0x8008000 of size 16384
Sector at  0x800c000 of size 16384
Sector at  0x8010000 of size 65536
Sector at  0x8020000 of size 131072
Sector at  0x8040000 of size 131072
Sector at  0x8060000 of size 131072
Sector at  0x8080000 of size 131072
Sector at  0x80a0000 of size 131072
Sector at  0x80c0000 of size 131072
Sector at  0x80e0000 of size 131072
Sector at  0x8100000 of size 16384
Sector at  0x8104000 of size 16384
Sector at  0x8108000 of size 16384
Sector at  0x810c000 of size 16384
Sector at  0x8110000 of size 65536
Sector at  0x8120000 of size 131072
Sector at  0x8140000 of size 131072
Sector at  0x8160000 of size 131072
Sector at  0x8180000 of size 131072
Sector at  0x81a0000 of size 131072
Sector at  0x81c0000 of size 131072
Sector at  0x81e0000 of size 131072

End of program
  • Non regression tests
+-----------------------+---------------+-----------------------------+--------+--------------------+-------------+
| target                | platform_name | test suite                  | result | elapsed_time (sec) | copy_method |
+-----------------------+---------------+-----------------------------+--------+--------------------+-------------+
| DISCO_F413ZH-ARM      | DISCO_F413ZH  | tests-mbed_drivers-flashiap | OK     | 18.95              | default     |
| DISCO_F413ZH-ARM      | DISCO_F413ZH  | tests-mbed_hal-flash        | OK     | 18.56              | default     |
| DISCO_F413ZH-GCC_ARM  | DISCO_F413ZH  | tests-mbed_drivers-flashiap | OK     | 19.19              | default     |
| DISCO_F413ZH-GCC_ARM  | DISCO_F413ZH  | tests-mbed_hal-flash        | OK     | 18.61              | default     |
| DISCO_F429ZI-ARM      | DISCO_F429ZI  | tests-mbed_drivers-flashiap | OK     | 17.96              | default     |
| DISCO_F429ZI-ARM      | DISCO_F429ZI  | tests-mbed_hal-flash        | OK     | 18.1               | default     |
| DISCO_F429ZI-GCC_ARM  | DISCO_F429ZI  | tests-mbed_drivers-flashiap | OK     | 18.36              | default     |
| DISCO_F429ZI-GCC_ARM  | DISCO_F429ZI  | tests-mbed_hal-flash        | OK     | 18.61              | default     |
| DISCO_F469NI-ARM      | DISCO_F469NI  | tests-mbed_drivers-flashiap | OK     | 17.63              | default     |
| DISCO_F469NI-ARM      | DISCO_F469NI  | tests-mbed_hal-flash        | OK     | 18.03              | default     |
| DISCO_F469NI-GCC_ARM  | DISCO_F469NI  | tests-mbed_drivers-flashiap | OK     | 18.21              | default     |
| DISCO_F469NI-GCC_ARM  | DISCO_F469NI  | tests-mbed_hal-flash        | OK     | 18.19              | default     |
| NUCLEO_F401RE-ARM     | NUCLEO_F401RE | tests-mbed_drivers-flashiap | OK     | 18.7               | default     |
| NUCLEO_F401RE-ARM     | NUCLEO_F401RE | tests-mbed_hal-flash        | OK     | 17.47              | default     |
| NUCLEO_F401RE-GCC_ARM | NUCLEO_F401RE | tests-mbed_drivers-flashiap | OK     | 18.91              | default     |
| NUCLEO_F401RE-GCC_ARM | NUCLEO_F401RE | tests-mbed_hal-flash        | OK     | 17.71              | default     |
| NUCLEO_F410RB-ARM     | NUCLEO_F410RB | tests-mbed_drivers-flashiap | OK     | 15.88              | default     |
| NUCLEO_F410RB-ARM     | NUCLEO_F410RB | tests-mbed_hal-flash        | OK     | 16.13              | default     |
| NUCLEO_F410RB-GCC_ARM | NUCLEO_F410RB | tests-mbed_drivers-flashiap | OK     | 16.32              | default     |
| NUCLEO_F410RB-GCC_ARM | NUCLEO_F410RB | tests-mbed_hal-flash        | OK     | 16.41              | default     |
| NUCLEO_F411RE-ARM     | NUCLEO_F411RE | tests-mbed_drivers-flashiap | OK     | 18.27              | default     |
| NUCLEO_F411RE-ARM     | NUCLEO_F411RE | tests-mbed_hal-flash        | OK     | 17.61              | default     |
| NUCLEO_F411RE-GCC_ARM | NUCLEO_F411RE | tests-mbed_drivers-flashiap | OK     | 18.47              | default     |
| NUCLEO_F411RE-GCC_ARM | NUCLEO_F411RE | tests-mbed_hal-flash        | OK     | 17.83              | default     |
| NUCLEO_F412ZG-ARM     | NUCLEO_F412ZG | tests-mbed_drivers-flashiap | OK     | 18.74              | default     |
| NUCLEO_F412ZG-ARM     | NUCLEO_F412ZG | tests-mbed_hal-flash        | OK     | 18.0               | default     |
| NUCLEO_F412ZG-GCC_ARM | NUCLEO_F412ZG | tests-mbed_drivers-flashiap | OK     | 18.82              | default     |
| NUCLEO_F412ZG-GCC_ARM | NUCLEO_F412ZG | tests-mbed_hal-flash        | OK     | 18.13              | default     |
| NUCLEO_F429ZI-ARM     | NUCLEO_F429ZI | tests-mbed_drivers-flashiap | OK     | 17.77              | default     |
| NUCLEO_F429ZI-ARM     | NUCLEO_F429ZI | tests-mbed_hal-flash        | OK     | 18.27              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_drivers-flashiap | OK     | 18.35              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal-flash        | OK     | 18.61              | default     |
| NUCLEO_F439ZI-ARM     | NUCLEO_F439ZI | tests-mbed_drivers-flashiap | OK     | 17.89              | default     |
| NUCLEO_F439ZI-ARM     | NUCLEO_F439ZI | tests-mbed_hal-flash        | OK     | 18.13              | default     |
| NUCLEO_F439ZI-GCC_ARM | NUCLEO_F439ZI | tests-mbed_drivers-flashiap | OK     | 18.19              | default     |
| NUCLEO_F439ZI-GCC_ARM | NUCLEO_F439ZI | tests-mbed_hal-flash        | OK     | 18.16              | default     |
| NUCLEO_F446ZE-ARM     | NUCLEO_F446ZE | tests-mbed_drivers-flashiap | OK     | 17.77              | default     |
| NUCLEO_F446ZE-ARM     | NUCLEO_F446ZE | tests-mbed_hal-flash        | OK     | 18.26              | default     |
| NUCLEO_F446ZE-GCC_ARM | NUCLEO_F446ZE | tests-mbed_drivers-flashiap | OK     | 18.38              | default     |
| NUCLEO_F446ZE-GCC_ARM | NUCLEO_F446ZE | tests-mbed_hal-flash        | OK     | 18.66              | default     |
+-----------------------+---------------+-----------------------------+--------+--------------------+-------------+

The computation of the sector number in GetSector for 2MB flash sizes
consists in adding an extra constant for 2MB dual bank (12 as in
ADDR_FLASH_SECTOR_12), then going through the same address check as if it
was an address of the first sector.

That means that we need to modify tmp and address as if it was a first bank
address, which we're doing here by sub_stracting 0x100000 delta.
@0xc0170
Copy link
Contributor

0xc0170 commented Nov 8, 2017

@paviitan @kylestein-arm Please review, this fix should address the problems you were having

cc @andreaslarssonublox

Copy link

@paviitan paviitan left a comment

Choose a reason for hiding this comment

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

@LMESTM @0xc0170
Reviewed locally. Works!

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 9, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 9, 2017

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Nov 9, 2017

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.

4 participants