Skip to content

[HAL][NOR] Fix support for 8-bit NOR that uses the AMD command set. C… #15

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

StephenPPEng
Copy link

…hanges should be backwards compatible.
In reference to this issue, #14
TThe previous version of the HAL_NOR did not accurately handle 16-bit and 8-bit NOR devices. There were many instances of typecasting to a 16-bit pointer which, when used with 8-bit addressing, results in Misalligned Memory Access faults.
Additionally, the NOR_ADDR_SHIFT already handles the address shifting; There does not need to be 2 different address values for 8-bit vs 16-bit.
I also turned the NOR_WRITE into a wrapper for a function pointer; This ensures backwards compatibility, while ensuring the correct NOR_WRITE is used in all circumstances.

Do note: I was unable to find any Coding Standard for contributing, so i attempted to follow existing code.
Additionally, there are still potential issues in HAL_NOR that I could not adequately address without rewriting; HAL_NOR_ReadCFI, anything in the NOR_INTEL_SHARP_EXT_COMMAND_SET.

Finally, I am not overly happy with exposing the extern WriteNORFunc NORWriteFunction; /* Function Pointer to active NOR_Write*/. I'd much rather have that function pointer be private to the HAL_NOR .c file. But to support backwards compatibility with projects that use NOR_WRITE, it has to be exposed.

IMPORTANT INFORMATION

Contributor License Agreement (CLA)

  • The Pull Request feature will be considered by STMicroelectronics after the signature of a Contributor License Agreement (CLA) by the submitter.
  • If you did not sign such agreement, please follow the steps mentioned in the CONTRIBUTING.md file.

@ALABSTM ALABSTM added hal HAL-LL driver-related issue or pull-request. enhancement New feature or request nor external NOR flash memory controller labels Apr 16, 2025
@ALABSTM ALABSTM added the fmc Flexible Memory Controller label Apr 16, 2025
@ALABSTM ALABSTM linked an issue Apr 16, 2025 that may be closed by this pull request
@StephenPPEng
Copy link
Author

Please note that I do not have a 16-bit NOR chip to test.
THese changes SHOULD be compatible with all 16-bit NOR chips, in both x8 and x16 mode.

@KRASTM
Copy link
Contributor

KRASTM commented Apr 17, 2025

Hello @StephenPPEng,

We already linked this Pull Request to the issue #14, and I will keep you informed of our team's decision.

With regards,

@KRASTM KRASTM moved this from To do to Analyzed in stm32cube-mcu-hal-dashboard Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fmc Flexible Memory Controller hal HAL-LL driver-related issue or pull-request. nor external NOR flash memory controller
Projects
Development

Successfully merging this pull request may close these issues.

8-Bit NOR devices cause hard fault on Hal_Nor_Init
3 participants