Skip to content
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

provision.sh.in: accept STM32_Programmer -otp displ failure #1048

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function usage {
# [...]

stm32prog_otp_refresh_values () {
otp_displ=$(STM32_Programmer_CLI -c port=USB1 -otp displ)
otp_displ=$(STM32_Programmer_CLI -c port=USB1 -otp displ || echo "STM32_Programmer_CLI -otp displ returned an error")
Copy link
Contributor

Choose a reason for hiding this comment

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

I would change it to

otp_displ=$(STM32_Programmer_CLI -c port=USB1 -otp displ) || echo "STM32_Programmer_CLI -otp displ returned an error"

So that the error is shown to a user instead of appending to otp_displ variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tested your proposal: it works with bash and dash. But I am not so sure it is want we want.

The purpose of the otp_displ=$(...) assignment is, in my view, to retrieve the information once, so that we can parse it and know the OTP state. In my view, a closed STM32MP15x with an unreadable OTP is something perfectly normal and supported. So I wanted something that just negates the code 1 returned by STM32_Programmer_CLI. I could have written something as || /usr/bin/true, but I think we could be more explicit with a sort of comment that would be written in the $otp_displ content. Those who inspect it will know more about the OTP state.
My intention was not to issue a warning, nothing is malfunctioning.
Your proposal will generate a visible warning when the STM32MP15x is closed. My code consider a closed STM32MP15x as a feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, it looks reasonable.

# Make some validity tests on the "STM32_Programmer_CLI"
# output. Match the version after "STM32CubeProgrammer v":
stm32prog_vers=$(echo "$otp_displ" | sed -n -e '/.*[[:blank:]]*STM32CubeProgrammer v\([0-9][0-9]*\.[0-9][0-9\.]*\)[[:blank:]]*$/s//\1/p')
Expand Down