Commit Graph

38 Commits

Author SHA1 Message Date
Grigori Goronzy
f452ca226e frontend: return instead of exit 2015-11-23 23:48:58 +01:00
Grigori Goronzy
bc242390e7 Add packaging infrastructure
Split up single script into a package with multiple modules.
Also add a setuptools control file. With this, stcgal can be
installed like any other program. It's still possible to launch
from the sources directly. stcgal.py has been converted into a
simple launcher.

v2: fix imports
2015-11-23 22:19:06 +01:00
Grigori Goronzy
391f6433fe stc15: print wakeup timer value 2015-11-22 18:44:37 +01:00
Grigori Goronzy
d5b35cf43d Rename stc15 and stc15x protocols
The protocol originally named "stc15" is only used for two early STC15
series, i.e. STC15F104/STC15F204. All other STC15 series appear to
use a different protocol. So switch around names similary to "stc12"
vs "stc12a".

In conclusion:
- "stc15a" is used only for STC15xx04E(A)
- "stc15" is used for all other currently tested STC15 MCUs
2015-11-22 17:45:31 +01:00
Grigori Goronzy
8297904753 stc15x: add external clock handling 2015-11-22 17:36:06 +01:00
Grigori Goronzy
52b346ebfc Flush stdout in some more error cases 2015-11-22 17:36:06 +01:00
Grigori Goronzy
ed28c8ef89 stc15x: add hack for SW/HW UART differences 2015-11-22 17:36:05 +01:00
Grigori Goronzy
bf7cbb2042 Add support for new BSL 7.x STC15 parts
These use a somewhat modified protocol with support for external clock.
This should get all STC/IAP15F2/L2 etc. work correctly. Only parts with
BSL 7.1 were tested, although BSL 7.2 should work as well.

The functionality is encapsulated in the new protocol "stc15x".
2015-11-22 17:35:58 +01:00
Grigori Goronzy
6f77535673 Fix output in error cases 2015-11-22 04:27:46 +01:00
Grigori Goronzy
bb6fd8d8fb Add debug command line flag 2015-11-21 01:41:25 +01:00
Grigori Goronzy
1a0e100ab6 Update MCU database
Up to STC-ISP 6.85I. Also remove dump-mcu.txt, not really needed.
2015-11-21 00:41:30 +01:00
Grigori Goronzy
62c85d06c8 Add STC12A (early STC12) series protocol support
STC12A is my name for the mixup protocol between STC89 and
STC12 that is used by some early STC12 series MCUs (for examples
STC12C2052AD). The protocol differs in many subtle ways so there is
quite a bit of unfortunate code duplication for the moment.
2014-01-29 00:40:17 +01:00
Grigori Goronzy
033d4a4016 Documentation fixes 2014-01-24 00:30:21 +01:00
Grigori Goronzy
977fb205ed Add STC 89/90 series protocol support 2014-01-24 00:30:02 +01:00
Grigori Goronzy
ca1bd4dcab stc12: fix detection of illegal baudrates 2014-01-23 15:08:24 +01:00
Grigori Goronzy
1bd2ec9cbe Extract base class for protocols 2014-01-23 14:54:09 +01:00
Grigori Goronzy
87a257e63e Improve synchronization and timeout handling
Make sure we can safely sync to the status packet in case
garbage is received before.
2014-01-21 16:03:38 +01:00
Grigori Goronzy
5bcad70d77 Update MCU database 2014-01-17 12:08:23 +01:00
Grigori Goronzy
8d782bb626 Add mail address to license text 2014-01-15 01:09:29 +01:00
Grigori Goronzy
2695f16809 Distinguish between communication error types 2014-01-15 00:56:12 +01:00
Grigori Goronzy
407e956dfb Ignore garbage packets in synchronization state
The MCU might still be running user code and toggling the UART pins
when stcgal is started. Just ignore all garbage we see in this stage
until we get a valid package.
2014-01-15 00:55:59 +01:00
Grigori Goronzy
e54610bcf5 Add read timeouts and handle them sensibly 2014-01-15 00:20:58 +01:00
Grigori Goronzy
a1fa53456e Fix and refactor disconnect 2014-01-14 23:00:56 +01:00
Grigori Goronzy
b3230814a8 Erase flash in 512 byte blocks
This is the IAP flash memory block size, and the BSL apparently
expects erase to be done aligned to 512 byte.
2014-01-13 12:33:41 +01:00
Grigori Goronzy
9fd960f45a Tweak output and formatting 2014-01-13 12:33:41 +01:00
Grigori Goronzy
2d8d782239 Extract TODO 2014-01-13 02:52:30 +01:00
Grigori Goronzy
beae56e66a Use kHz unit for --trim option
It's simply more practical.
2014-01-13 02:05:41 +01:00
Grigori Goronzy
fad3147e71 Fix handling of incorrect option specifications 2014-01-13 02:01:43 +01:00
Grigori Goronzy
ddd5ec4e57 Misc documentation and text fixes 2014-01-13 02:01:17 +01:00
Grigori Goronzy
fd5bebb8d5 Add helper for formatted hex string output 2014-01-13 01:38:50 +01:00
Grigori Goronzy
a82b0e4633 Handle UID with more flexibility
Some BSLs only send the UID with the erase acknowledge packet,
others only send it with the program options acknowledge packet.
Handle both cases.
2014-01-13 01:25:38 +01:00
Grigori Goronzy
386f833da1 Use STC15 high-speed programming 2014-01-11 17:06:36 +01:00
Grigori Goronzy
320faa00f2 Fix code/eeprom overflow and overlap handling 2014-01-11 17:05:48 +01:00
Grigori Goronzy
ba8d26059c Add STC15 series support
So far this is only based on reverse engineering what's needed
for programming STC15F104E. It works, but it is incomplete.
2014-01-11 16:43:37 +01:00
Grigori Goronzy
903f6ca451 Add and use MCU model database 2014-01-10 13:00:29 +01:00
Grigori Goronzy
4d84d026e0 Fix small bit-mangling error 2014-01-08 08:31:27 +01:00
Grigori Goronzy
7b748dcf22 Implement sensible error handling 2014-01-07 02:55:50 +01:00
Grigori Goronzy
cdbb6eee7c Initial commit 2014-01-06 20:35:27 +01:00