Add automatic protocol detection
Created by: laborer
The model of the target MCU and its protocol is detected using model ID provided in the first packet (status packet) from the MCU.
Tested working models include, IAP15F2K61S2 (BSL version: 7.1.4S, protocol: stc15) STC15F104W (BSL version: 7.1.4Q, protocol: stc15) TC11F02E (BSL version: 6.5K, protocol: stc12) STC10F04XE (BSL version: 6.5J, protocol: stc12) STC12C5A16S2 (BSL version: 6.2I, protocol: stc12) STC12C5608AD (BSL version: 6.0G, protocol: stc12) STC12C2052 (BSL version: 5.8D, protocol: stc12a) STC90C52RC (BSL version: 4.3C, protocol: stc89) STC89C52RC (BSL version: 4.3C, protocol: stc89) STC89C54RD+ (BSL version: 4.3C, protocol: stc89)
Models that do not work at the moment, STC15F104E (BSL version: 6.7Q, protocol: stc15a)
STC15F104E shares the same model ID with STC15F104W but uses a different protocol. The automatic protocol detection fails to work with STC15F104E and likely any STC MCUs that use stc15a protocol, because their first packets are not status packets.