vdudouyt / stm8flash

program your stm8 devices with SWIM/stlinkv(1,2)
GNU General Public License v2.0
402 stars 182 forks source link

stm8af5288: Can't flash #102

Closed AokiAhishatsu closed 6 years ago

AokiAhishatsu commented 6 years ago

$ ./stm8flash -c stlinkv2 -p stm8af528? -s flash2 -w ./myprog.hex Determine RAM area Due to its file extension (or lack thereof), "./myprog.hex" is considered as INTEL HEX format! Address 8000 + 4 is out of range at line 1

In ST Visual Develop it works without problems.

spth commented 6 years ago

Which STM8AF variant is the hardware?

Philipp

AokiAhishatsu commented 6 years ago

STM8AF5288

$ ./stm8flash -c stlinkv2 -p stm8af528? -w ./myprog.hex (no -s flash2) Works now.

Weird thing now is, if I read flash it stops the program execution on MCU and is not able to run again until write again (with the abobe command)

GavukaAlexandr commented 6 years ago

try unlocking the controller: echo "00 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > factory_defaults.bin stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w factory_defaults.bin

AokiAhishatsu commented 6 years ago

thx GavukaAlexandr! That works.

Why is this necessary after read/verify?

GavukaAlexandr commented 6 years ago

You are welcome AokiAhishatsu. Because the new stm8 is blocked for reading

spth commented 6 years ago

flash2 is not a valid memory type or address. stm8flash should have given an error message; I'll leave this item open until that bug is fixed.

Philipp

spth commented 6 years ago

Previously, when the parameter to -s was not a known string, instead the longest prefix that is a hex number was used as memory address. for "flash2", this was f. I now changed it to emit an error when the prefix is not the whole argument.

That's probably still not ideal (there is still potential for error when people assume the location to be in a base other than 16), but better than the old behaviour.

Philipp