-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for writing option bytes on STM32F0/F1/F3 #1112
Support for writing option bytes on STM32F0/F1/F3 #1112
Conversation
debug log:
st-flash 1.6.1-216-gcc9bedd-dirty read again: Same result with correct option byte 0x00ffff00 for level 1. |
@2a17 OB support for F0 is great. But it is worth noting that the STLINK_FLASH_TYPE_F0 flash type also has F1 and F3 series. F1 series have all same, but F3 series has slight differences in the OB registers. |
I now have a STM32F0 Discovery Board to allow for testing within the next two weeks. |
I added option byte erase: works.
|
Oh, i didn't mean to close the merge, sorry. I have checked all steps with the reference manual (RM0091) and the HAL implementation. It should work. |
Not sure really, @Ant-ON may have an idea. |
@2a17 The |
Sorry, I removed all my debug outputs before commit...and the line with |
@2a17 |
... which we do have already for F0 targets, but not for F1 and F3 ... |
@Ant-ON: I get the following output with my STM32VLDicsovery board
|
@Nightwalker-87 In my opinion, you are using a branch other than |
@Ant-ON: I'm rather sure it's the correct one, but will check again later to let you know. |
@Nightwalker-87 An error from the log occurs when the Lines 4375 to 4378 in 939998d
But the detected target must have filled the option_base field:stlink/src/stlink-lib/chipid.c Lines 246 to 257 in 939998d
ps I added patch for security warning |
I've seen and approved it already. Looks good to me. |
@Ant-ON With commit 939998d I get the following output when cross-compiling though all CI tests have passed before. I ran
|
Shouldn't happen by now, really - I mean how can a remote cross-build CI pass while a very similar local cross-build is failing?!? |
@Nightwalker-87 This is most likely due to different versions of the gcc/clang. #define __STDC_WANT_LIB_EXT1__ 1
#include <time.h> and change the #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# if defined (_WIN32) || (defined(__STDC_LIB_EXT1__)
localtime_s(&tt, &mytt);
# else
localtime_r(&mytt, &tt);
# endif
#else
# error need backport old code
#endif |
I understood that writing is complex. That is why I did not manage. ;) |
@2a17 The protection bits are outside the first four bytes. There is no way to write them down separately now. It is possible to write only the entire of option bytes area, as it is required to erase the area before writing. |
@Nightwalker-87 I tried to fix the compilation issue. Could you check the compilation? |
I'll check during the weekend and let you know. |
@Ant-ON compilation now succeeds on my side. |
I didn't use the STM32VLDiscovery this time because it gives:
Here is the result for my CKS32F103C8T6: Read:
Write:
As one can see the commands seem to run now, but the memory address was just the example from our tutorial - without any reference of being somehow reasonable. I'll need to find out correct addresses for my device. |
Someone else should try with an appropriate F0 / F1 / F3 board as well. |
@Nightwalker-87
|
@Ant-ON: Seems to work now 👍 Read:
Write:
|
Implementation to write option bytes for STM32F0/F1/F3.
(Closes #346, Closes #458, Closes #808, Closes #1084)