-
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
[STM32U5x5]: Last bytes are not written (flashed) when len(<binary>)%16 <= 8 #1303
Comments
@victor-dryad I do have this board available for testing. Can you provide your binary somewhere (temporary webspace) for testing on a second instance? You can paste your logs here https://pastebin.com/ (perpetual distribution is not necessary). |
https://drive.google.com/file/d/1LFVCN6ZWUORAQ7jgWgm-1zXwkEbeCyxC/view?usp=sharing |
@victor-dryad: I'm on this topic now, but certainly would need a few days to analyse the observed behaviour.
Here is the current output (shortened) I get:
|
... in
This appears to be the relevant code snippet. |
@victor-dryad Would you propose a fix based on your idea and the relevant code part? |
You are the driver. If you see it logical from point of view of the code, why not? I cannot estimate the code because it is full of details I have no knowledge. |
@victor-dryad My knowledge to the implementation is limited here as well, because I'm not the author of the code, nor have I gained the complete overview of original implementation - to be honest nobody has, as several people contributed with different attempts to implement certain functionalities. I have stepped in as a maintainer and try to resolve bugs and find my way through the source code, just as many others. 😉 |
Ok. |
I had a look before weekend to be able to play with the h/w.
(a purpose of uint32_t data is not clear for me) |
@victor-dryad As I read it |
@victor-dryad This code has an error related to array dereferencing (the I would rewrite line write_uint32((unsigned char *)&data, *(uint32_t *)(base + off)); to data = 0;
memcpy(&data, base + off, (len - off) < 4 ? (len - off) : 4); |
@Nightwalker-87
Tested successfully with len%16 = 1..8 (file size 0xba061..0xba068) One more question comes to my mind: |
@victor-dryad Thanks. I'll test this on my Nucleo-U575ZI-Q as well. |
@Ant-ON I've included your proposal into my working copy for testing. |
Minimal improvement:
:-D |
@victor-dryad As to our common practise this will be listed in I know it is a kind of a struggle to gain an overview of the available functions, but I'll try to do my very best to improve and unify the appearance. Thus for the first (even though off topic) I'll make sure that all existing functions are correctly declared in the related header files. Then I'll check the header includes and do the testing with the provided binary, to which I've added a few zeros at the end. Otherwise I can not rule out any strange side effects during compilation. 😕 |
I've just mentioned a topic "inline documentation". Definitely, changelog and release notes are out of this topic. |
@victor-dryad You may have a look at the |
With the change from @Ant-ON, we can skip the following:
I have tested the changes successfully with my Nucleo-U575ZI-Q using the
However I'd prefer to have someone checking the other refactoring which has taken place to verify that we do not accidentally introduce any errors. As mentioned before, we should run it on Windows as well. |
Tested native MinGW building on windows (Windows 10), board detection and basic toolset commands in the meanwhile. |
Actually, a blind workaround for the issue is simple:
Full --debug printout is about 35Mb, if it is needed - just tell me the best way to share them (failed and successful ones)
Binary to flash:
This error message appears time to time, but seems is not important
2023-04-14T16:36:49 DEBUG usb.c: READDEBUGREG error (0x18)
Last bytes of the binary are flashed, and seems confirmed as successful
However during verification these last bytes are not found in the memory.
(This fact also checked and confirmed using official STM flasher)
(I have edited a little the code of debug printout, so do not be surprised)
You can see, that last 8 bytes are 8FF instead of 400 and 4*77
FF - these were written during erase step and were not replaced during binary flash.
The text was updated successfully, but these errors were encountered: