HC6800-ES 單片機 Linux 燒錄
在淘寶買了一台新的單片機 HC6800-ES (STC12C2052) 但附送的都是 Win 平台的東西, 所以要找方法在 Linux 下燒錄
-
Install sdcc either from website or by “apt” (Debian/Ubuntu) or “dnf” (Fedora)
-
Install python-serial package
-
Install STCFlash (Python tool for flashing to STC12C2052) from repository
-
Write a simple blink.c for testing
#include <8052.h> __sbit __at 0x80 LED; // or // #define LED P0_0 void main() { unsigned int i=0; while (1) { for (i=0; i<10000; i++) LED = 0; for (i=0; i<10000; i++) LED = 1; } }
-
Compile to BIN file
sdcc blink.c
-
Convert the format to HEX
objcopy -Iihex -Obinary blink.hex blink.bin
-
Flash to the device after plugging in USB and reset
python stcflash.py blink.hex