轉載時請註明出處:
https://hi.baidu.com/%B5%FB%CF%FE%C3%CE/blog/item/1aa1050958898c2e6a60fbd0.html
蝶曉夢(vowstar@gmail.com)
今天總算摸清楚了在 Linux 下燒錄 AT89S52 的做法。以下是我的解法,相信還有更好的方式。這裡以 Ubuntu 為例。
sudo apt-get install gcc-avr binutils-avr avrdude avr-libc
sudo gedit /etc/avrdude.conf
在檔案最後加上這段(原作者為 Joy Shukla):
#------------------------------------------------------------
# Below chips by added by me .. Joy Shukla(joy_shukla@yahoo.in)
# these chips can be programmed with my usbasp programmer(changed atmega8 program)
# after adding avrdude support in this file ..
#------------------------------------------------------------
#------------------------------------------------------------
# AT89S52
#------------------------------------------------------------
part
id = "8052";
desc = "AT89S52";
signature = 0x1E 0x52 0x06;
chip_erase_delay = 20000;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
"x x x x x x x x x x x x x x x x";
timeout = 200;
stabdelay = 100;
cmdexedelay = 25;
synchloops = 32;
bytedelay = 0;
pollindex = 3;
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
pollmethod = 0;
memory "flash"
size = 8192;
paged = no;
min_write_delay = 4000;
max_write_delay = 9000;
readback_p1 = 0xff;
readback_p2 = 0xff;
read = " 0 0 1 0 0 0 0 0",
" x x x a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
write = " 0 1 0 0 0 0 0 0",
" x x x a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
mode = 0x21;
delay = 12;
;
memory "signature"
size = 3;
read = "0 0 1 0 1 0 0 0 x x x 0 0 0 a1 a0",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
;
#------------------------------------------------------------
存檔之後,就可以開始燒錄了。以下以桌面上編譯好的跑馬燈程式為例:
sudo avrdude -p 8052 -c usbasp -e -U flash:w:'/home/vowstar/桌面/跑馬燈.hex'
執行結果如下,開發板上的燈也如預期跑了起來。
開發板上的實測效果: