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

Initial support for STM32 FMC #29686

Merged
merged 5 commits into from
Nov 24, 2020

Conversation

gmarull
Copy link
Member

@gmarull gmarull commented Nov 1, 2020

This PR adds a new driver category for memory controller peripherals. There is no API involved as it has not been found
necessary for first implementation.

STM32 Flexible Memory Controller (FMC) is the only controller supported for now. This peripheral allows accessing multiple types of external memories, e.g. SDRAM, NAND, NOR Flash...

The initial implementation adds support for the SDRAM controller only. HAL API is used, so the implementation should be portable to other STM32 series. It has only been tested on H7 series, so it can only be enabled when working on H7.

Linker facilities have also been added in order to allow applications to easily define a variable in SDRAM, e.g.

__stm32_sdram2_section uint32_t my_big_array[800 * 600];

Tested with STM32H747I-DISCO board (SDRAM parameters have been taken from HAL examples).

To be discussed:

  • Implementation location
  • DeviceTree representation
  • Check if linker script changes are sufficient

Closes #15944

@gmarull gmarull requested review from erwango and ABOSTM November 1, 2020 20:04
@github-actions github-actions bot added area: API Changes to public APIs area: ARM ARM (32-bit) Architecture area: Boards area: Devicetree area: Devicetree Binding PR modifies or adds a Device Tree binding area: Modules platform: STM32 ST Micro STM32 labels Nov 1, 2020
@gmarull gmarull force-pushed the feature/stm32-fmc branch 3 times, most recently from c8efe97 to 3b52f82 Compare November 1, 2020 20:11
@gmarull
Copy link
Member Author

gmarull commented Nov 2, 2020

cc: @matthew-koch @k0d

@gmarull gmarull force-pushed the feature/stm32-fmc branch 2 times, most recently from ba2029f to f0f7659 Compare November 3, 2020 17:58
@galak galak self-requested a review November 5, 2020 16:57
@galak
Copy link
Collaborator

galak commented Nov 5, 2020

dev-review (Nov 5 2020): @MaureenHelm to look at this from a NXP point of view. @galak to look at this from a devicetree and common linker script view point.

@gmarull gmarull force-pushed the feature/stm32-fmc branch 4 times, most recently from 1d0ab99 to 1177076 Compare November 5, 2020 21:57
Copy link
Member

@erwango erwango 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 this great addition!

I don't have objections on the proposal.

One observation though: FMC_SDRAM_foo functions are supposed to be internal LL API (with HAL API as the unique client). I'm not opposed to using it directly, but this raises some concerns as these internal APIs do not propose the same guarantees the public APIs (portability, stability).
Can you elaborate on the arguments that made you chose this API over HAL ?

Second point is that it would be nice to add some quick test if doable (could be added under tests/boards) so this driver could be compiled in CI (and potential users can have a simple usage example)

@carlescufi carlescufi requested review from jettr and removed request for andyross, tejlmand and nvlsianpu November 13, 2020 17:29
@MaureenHelm
Copy link
Member

Looks ok to me.

@jhqian @mmahadevan108 Do you see any issues with this for SEMC on RT1xxx?

Copy link
Collaborator

@lochej lochej left a comment

Choose a reason for hiding this comment

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

LGTM, that's great contribution 👍 But I don't have HW to try this out.
Also needs rebase for the hal_stm32 PR repository to pass buildkite.

@gmarull gmarull force-pushed the feature/stm32-fmc branch 2 times, most recently from eaba078 to 1366faa Compare November 13, 2020 21:38
@carlescufi
Copy link
Member

@galak pleae revisit
@gmarull please rebase

west.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

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

LGTM

Update hal_stm32 to have access to FMC pins.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
This commit adds a new driver category for memory controller
peripherals. There is no API involved for now, as it has not been found
necessary for first implementation.

STM32 Flexible Memory Controller (FMC) is the only controller supported
for now. This peripheral allows to access multiple types of external
memories, e.g. SDRAM, NAND, NOR Flash...

The initial implementation adds support for the SDRAM controller only.
The HAL API is used, so the implementation should be portable to other
STM32 series. It has only been tested on H7 series, so for now it can
only be enabled when working on H7.

Linker facilities have also been added in order to allow applications to
easily define a variable in SDRAM.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
Add myself to memc (memory controller) drivers.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
Add integration test to check r/w operations on STM32 external SDRAM.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
Enable SDRAM on M7 core.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: ARM ARM (32-bit) Architecture area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Documentation area: Modules area: Tests Issues related to a particular existing or missing test platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stm32: New Driver for FMC/FSMC
7 participants