-
Notifications
You must be signed in to change notification settings - Fork 7.7k
drivers: STM32 async flash erase and write #93173
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
base: main
Are you sure you want to change the base?
Conversation
Hello @jpowen898, and thank you very much for your first pull request to the Zephyr project! |
c34e153
to
ae67109
Compare
@nordicjm Thanks for the feedback. I made all the requested changes, let me know if there is anything else. |
030ad53
to
df9a4f8
Compare
9129568
to
b5d3812
Compare
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.
As a general comment, please follow existing code style in this driver (and zephyr code base generally): break a line between code blocks.
Then it would be interesting to introduce this new feature into doc/releases/release-notes-4.3.rst
FLASH_STM32_PRIV(dev)->async_complete = false; | ||
FLASH_STM32_PRIV(dev)->async_error = false; | ||
HAL_FLASH_Program_IT(FLASH_TYPEPROGRAM_DOUBLEWORD, offset + FLASH_STM32_BASE_ADDRESS, val); | ||
k_sem_take(&FLASH_STM32_PRIV(dev)->async_sem, K_FOREVER); | ||
if (FLASH_STM32_PRIV(dev)->async_complete) { | ||
LOG_DBG("Flash write successful. Wrote 0x%llx at 0x%lx", | ||
val, offset + FLASH_STM32_BASE_ADDRESS); | ||
rc = 0; | ||
} else { | ||
if (FLASH_STM32_PRIV(dev)->async_error) { | ||
LOG_ERR("Flash write failed %d", FLASH_STM32_PRIV(dev)->async_ret); | ||
} | ||
rc = -EIO; | ||
} |
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.
Break a line between code blocks.
Apply everywhere.
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.
I wasn't 100% sure what you were looking for but I added line breaks before #if
, and after #else
and #endif
. Let me know if that is not what you were looking for or if you wanted line breaks before and after #else
or something else.
Added optional use of the stm32 hal async flash write and erase capabilities on the l4, f4, and h7 soc families. It is implemented using semaphores to allow for other threads to take action during the erase/write actions. This feature is disabled by default and can be optionally enabled using the FLASH_STM32_ASYNC config option. Signed-off-by: Parker Owen <jpowen898@gmail.com>
|
HAL_FLASHEx_Erase_IT()
andHAL_FLASH_Program_IT()
functions with their associated interrupt handler.FLASH_STM32_ASYNC
config option.