Skip to content

Conversation

@martinjaeger
Copy link
Member

Tested with STM32G030 microcontroller.

Implementation based on STM32G4 series.

This is a preparation to enable reading and writing the RDP bits.

Signed-off-by: Martin Jäger <[email protected]>
Allows to set readout protection bits for this series at runtime.

Signed-off-by: Martin Jäger <[email protected]>
@sonarqubecloud
Copy link

}

/* Force the option byte loading */
regs->CR |= FLASH_CR_OBL_LAUNCH;
Copy link
Member Author

Choose a reason for hiding this comment

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

This may need to be adjusted based on the outcome of #91945.

@erwango erwango added this to the v4.3.0 milestone Jul 16, 2025
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

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.

Apologies for this late review

FLASH_TypeDef *regs = FLASH_STM32_REGS(dev);
int rc;

if (regs->CR & FLASH_CR_OPTLOCK) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be if (regs->CR & FLASH_CR_OPTLOCK != 0) (despite other STM32 drivers don't do this).
Non-blocking comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

0U if we wanted to be pedantic 😉 (And I'd add parentheses to ensure no ambiguity about order of evaluation)

@cfriedt cfriedt merged commit 866dff0 into zephyrproject-rtos:main Oct 8, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants