divers: flash: flash_stm32: add flash configuration check
Add weak function to check flash configuration. On stm32g4: single bank configuration not supported when dual bank capable. Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
This commit is contained in:
parent
7f62a92917
commit
522cda3f7d
2 changed files with 26 additions and 0 deletions
|
@ -233,3 +233,16 @@ void flash_stm32_page_layout(const struct device *dev,
|
|||
*layout = stm32g4_flash_layout;
|
||||
*layout_size = ARRAY_SIZE(stm32g4_flash_layout);
|
||||
}
|
||||
|
||||
/* Override weak function */
|
||||
int flash_stm32_check_configuration(void)
|
||||
{
|
||||
#if defined(FLASH_OPTR_DBANK)
|
||||
if (READ_BIT(FLASH->OPTR, FLASH_OPTR_DBANK) == 0U) {
|
||||
/* Single bank not supported when dualbank is possible */
|
||||
LOG_ERR("Single bank configuration not supported");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue