Baud rate register (BRT) values need to be as accurate as possible, so
use nearest instead of floor. This should improve reliability at higher
programming speeds.
Implement option handling for STC8 series, based on STC8A8K64S4A12
reverse engineering.
This mostly wraps up all important parts of the STC8 implementation.
Interoperability was tested with STC-ISP V6.86O.
v2: update documentation
This is a collection of various changes:
* Also try divider of 5 (it's used by STC-ISP)
* Use the correct IAP delay for the 24 MHz programming frequency
* Also try a trim adjust value of 0x03 and adjust trim ranges
* Fix display of calibrated frequency
With the introduction of real abstract classes, it is not possible
anymore to instantiate StcBaseProtocol. Instead, extract some of the
code for autodetection into the new class StcAutoProtocol and use
that for autodetection.
Found by fuzzing. The frequency trimming functions did a bad job of
checking for possible out of bounds accesses and didn't handle various
failure cases correctly. Add suitable checks to fix the issues found.
v2: fix one check, add several new ones
Fuzzing found lots of issues when packets are cut short. This should
rarely happen, but stcgal should be able to handle it without crashing.
This adds length checks when checking the magic of packets or when
checking checksums.
Sometimes instead of DTR line some custom way (e.g SoC gpio line)
may be used to reset the device. This commit implements
automated power-cycling using a a custom shell command that can
be specified via -r option
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
This adds various tests, integrated into setuptools. These use "monkey
patching" where needed to mock the pyserial and packet reader/writer
functionality to allow for testing with no changes.
The code should be refactored to simplify testing, but this is good enough
to stop regressions for now.