Closed zerog2k closed 8 years ago
the blinky example I'm using for ref: https://gist.github.com/zerog2k/f10777fc538f3b6789db
from the other issue, found ref to stc15f programming routine in c in what looks like making one mcu program anouther, with some google translate: https://gist.github.com/zerog2k/0a8182562d071fe0cc9f
Hi,
I don't think I ever tested this MCU. I'm not sure I have one of these. Unfortunately, there is no single protocol for a series, STC seems to change or modify protocols on a whim...
If I get around to redoing my reverse engineering setup, I'll see what I can do to get this chip and the other new ones working.
If you get it working, please submit a PR!
Oh, just a wild guess: the STC15F104 I used to RE the protocol only has 128 bytes of RAM. That is why the BSL uses smaller block size (64 bytes) for programming. Other STC MCUs with more RAM all seem to use 128 byte blocks. Maybe try to adjust this:
https://github.com/grigorig/stcgal/blob/master/stcgal.py#L1965
Thanks for the response, and suggestion. I tried that and it actually hung after erase and start of user program download.
After poking around in the code, I noticed that you dont ever try to do any intel hex unpacking/conversion routine and just use the raw binary bytes, and then it occurred to me to try using raw binary image (sdcc spits out ihex by default which is also supported by stc-isp program).
I was able to simply convert ihex to bin with:
objcopy -I ihex -O binary main.hex main.bin
and now it works! Yay.
Looking back at the stcgal readme, I didn't see any specific mention of this, so perhaps you can make a small note in the readme about using binary vs ihex image (and how to easily convert). If I get some time, I might work on a pr to support ihex input format as an option.
Thanks Grigori!
alternatively, included with sdcc is makebin:
makebin -p main.hex main.bin
which seems to work also for me.
OK, thanks for the suggestion, I added a note now.
FYI, there's HEX support now.
Opening an issue here to document, as I would much prefer to using native python solution for programming as opposed to the stc-isp in wine.
stcgal seems like it is programming but the program never seems to start up, and no serial console output seen. I'm using sdcc 3.5.0. The exact same program is programmed and working OK with latest stc-isp (6.85I) in wine.
stcgal output:
stc-isp output: