-
Notifications
You must be signed in to change notification settings - Fork 518
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
[gen3] fix internal -> external flash writes #2843
Conversation
…gned_and_unaligned_writes_from_internal_flash_work. coalesce gen3/gen4 flash_common implementation
…ymbols from COMMON section, which are essentially .bss
@@ -172,3 +205,17 @@ test(EXFLASH_02_rtl872x_validate_mode) { | |||
assertEqual((uint32_t)SPIC->baudr, (uint32_t)1); | |||
} | |||
#endif // HAL_PLATFORM_RTL872X | |||
|
|||
test(EXFLASH_03_aligned_and_unaligned_writes_from_internal_flash_work) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What part of this test is from_internal_flash
? Does gen3 execute this code as XIP?
hal_storage_write()
is the external OTA flash section for both platforms right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static uint8_t dummy[8192 + 4] __attribute((aligned(4))) = {0xff, 0xff, 0xff, 0xff};
is internal on gen 3, RAM on Gen 4, but the test is still kind of valid for gen 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that needs to be static const
now that you mention it.
Problem
External flash writes must be performed from RAM and can't be done directly from internal flash due to DMA requirements.
Solution
If data address is not in RAM, force
hal_flash_common_write
to perform writes through an intermediate 256 byte on-stack aligned buffer.Steps to Test
Example App
N/A
References
#2840
Completeness