-
Notifications
You must be signed in to change notification settings - Fork 184
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
Incorrect reading from the s-record format files #162
Comments
There is a bug in how srec.c handles the records. with larger files the data being read is shifted by one. |
Your pull request #164 solves this issue. I tested it. Thanks. |
...but S1 records are processed incorrectly. The error |
Is the incorrect processing of S1 records a regression in that pull request? |
Yes, I ran |
Ill take another look at it later this week. In the meantime you can just use objcopy to convert your srec to ihex bofre feeding stm8flash, since srec support is broken. |
I just rewrote the srec parser. It can handle both files you posted and should be much more robust than the previous implementation. |
I tried to test it but got an error at the
|
appologies... fixed. |
Thanks. No more error. I will test the functionality later today. |
An error occurs when reading from srec file: address out of range on last line. |
nice catch. fixed. Also reading the verification code I can see that when the return of the srec_read function is not checked for failure. So if you ask for a verify of a corrupt srec file it will verify 0 bytes instead... super cool |
I tested stm8flash with ST-LINK/V2 and STM8S207CB
First I wrote to the MCU's flash memory area
test_flash.bin
and then successfully verified it.Next I read flash memory into
test_flash.s19
and then try to verify content of flash memory with the sametest_flash.s19
but the verifing was failed.When I wrote
test_flash.s19
into the MCU's flash and verified it with the same file, program reported a successfull verification. But after this I verified MCU's flash withtest_flash.bin
and the verifing was failed.Then I read MCU's flash into
test_flash_1.bin
and compare it with originaltest_flash.bin
. I saw that the flash content intest_flash_1.bin
was shifted by 1 byte.This bug happens with Motorola S-record format and flash memory area only. With .bin and .hex formats the writing and verifying works fine. And with eeprom area all the formats work correctly. Maybe because the eeprom s-record file contains S1 records, whereas flash area file is S2.
It seems that the reason is the incorrect reading from the Motorola s-record format into memory for the files containing the flash area.
My files are attached.
My log is bellow:
test_flash.zip
The text was updated successfully, but these errors were encountered: