Mac搭建51开发环境
作者:互联网
普中科技51开发板实验
Mac搭建51开发环境
1.安装CH340驱动(www.wch.cn)
2.安装sdcc(交叉编译器)
brew install sdcc
3.安装烧录工具stcgal
sudo pip3 install stcgal
4.插入usb口,查看设备串口号
ls /dev/tty.wchusbser*
5.编写代码,编译
插一句:普中开发板原理图在www.prechin.net下载,原理图可以找到引脚的对应关系
cd 代码目录
sdcc xxx.c
6.烧录
stcgal -P stc89 -p /dev/tty.wchusbserialxxxxxxx xxx.ihx(上一步生成的文件)
按一下电源键(按reset键没用)
命令行显示
Switching to 19200 baud: checking setting testing done
Erasing 2 blocks: done
Writing flash: 640 Bytes [00:00, 1810.19 Bytes/s]
Setting options: done
7.附录:测试例程(提供的是二进制文本,保存为.bin文件直接烧录即可)(LED闪烁)
template.bin
70 69 00 FF 26 43 35 31 20 22 6D 61 69 6E 2E 63 22 20 42 52 4F 57 53 45 20 44 45 42 55 47 20 4F 42 4A 45 43 54 45 58 54 45 4E 44 00 00 8F 15 CC 60 08 6D 61 69 6E 2E 4F 42 4A 01 00 CB B9 87 60 06 6D 61 69 6E 2E 63 02 00 CD 02 EF 5D 1D 44 3A 5C 59 5A 5C 4B 45 49 4C 43 35 31 5C 43 35 31 5C 49 4E 43 5C 52 45 47 35 32 2E 48 36 70 6C 00 FF 13 42 4C 35 31 20 40 74 65 6D 70 6C 61 74 65 2E 6C 6E 70 20 00 00 90 15 CC 60 08 74 65 6D 70 6C 61 74 65 03 00 8F 15 CC 60 0C 74 65 6D 70 6C 61 74 65 2E 6C 6E 70 04 00 8F 15 CC 60 08 6D 61 69 6E 2E 6F 62 6A 04 00 A8 37 83 4B 1E 44 3A 5C 59 5A 5C 4B 45 49 4C 43 35 31 5C 43 35 31 5C 4C 49 42 5C 43 35 31 53 2E 4C 49 42 DD 02 08 00 04 4D 41 49 4E FF 00 CE 10 07 00 00 04 4D 41 49 4E C0 24 0B 00 00 00 00 06 4D 41 49 4E 2E 43 35 22 13 00 00 00 00 00 00 05 0B 5F 49 43 45 5F 44 55 4D 4D 59 5F 41 20 14 00 23 0B 00 20 01 00 06 00 05 06 74 65 6E 5F 75 73 23 0B 21 8F 22 66 00 01 00 02 A0 00 03 02 50 32 00 04 A0 00 01 04 4C 45 44 31 00 02 A8 00 03 02 49 45 00 02 B8 00 03 02 49 50 00 02 D8 00 03 04 43 43 4F 4E 00 00 03 00 20 04 6D 61 69 6E 00 02 98 00 03 04 53 43 4F 4E 00 02 88 00 03 04 54 43 4F 4E 00 00 23 00 22 0B 5F 64 65 6C 61 79 5F 31 30 75 73 00 02 D0 00 03 03 50 53 57 69 10 0E 00 02 0B 5F 44 45 4C 41 59 5F 31 30 55 53 9F 22 0E 00 00 00 02 06 00 05 06 74 65 6E 5F 75 73 2F 06 0F 00 00 23 00 EF 1F AC 06 70 01 1E 4C 70 F6 22 A5 22 16 00 03 00 23 00 14 00 00 23 00 15 00 00 23 00 16 00 00 2D 00 17 00 D9 10 0E 00 05 0B 5F 44 45 4C 41 59 5F 31 30 55 53 9C 10 07 00 02 04 4D 41 49 4E BE 06 18 00 00 03 00 C2 A0 7F 50 7E C3 12 00 23 D2 A0 7F 50 7E C3 12 00 23 80 EC 15 22 2F 00 03 00 03 00 1F 00 00 03 00 20 00 00 03 00 21 00 00 03 00 22 00 00 03 00 23 00 00 05 00 24 00 00 0C 00 25 00 00 0E 00 26 00 00 15 00 27 00 2E 10 07 00 05 04 4D 41 49 4E BB 10 07 00 03 04 4D 41 49 4E BD 60 34 00 00 02 01 00 07 00 00 00 08 00 00 05 69 64 61 74 61 05 78 64 61 74 61 05 70 64 61 74 61 04 64 61 74 61 04 63 6F 64 65 05 65 64 61 74 61 05 68 64 61 74 61 E4 61 0E 00 CB B9 87 60 01 00 06 6D 61 69 6E 2E 63 E9 61 25 00 CD 02 EF 5D 02 00 1D 44 3A 5C 59 5A 5C 4B 45 49 4C 43 35 31 5C 43 35 31 5C 49 4E 43 5C 52 45 47 35 32 2E 48 37 62 0A 00 01 00 00 00 04 6D 61 69 6E EA 63 0D 00 08 00 05 00 11 00 01 00 01 00 00 00 70 64 35 00 03 00 00 00 02 00 01 00 1F 00 00 00 00 00 00 00 E8 C8 4B 00 03 00 01 00 24 00 00 00 00 00 00 00 04 00 00 00 03 00 01 00 26 00 00 00 00 00 00 00 04 00 00 00 ED 62 08 00 01 00 00 00 02 75 38 E6 63 0D 00 40 00 00 00 03 00 00 00 01 00 00 00 4C 64 15 00 01 00 00 00 02 00 01 00 0A 00 00 00 00 00 00 00 FF FF FF FF 7D 62 0A 00 01 00 00 00 04 4C 45 44 31 89 63 0D 00 02 00 04 00 01 00 03 00 01 00 00 00 85 64 35 00 03 00 00 00 02 00 01 00 0C 00 00 00 00 00 00 00 FF FF FF FF 01 00 01 00 23 00 00 00 02 00 00 00 FF FF FF FF 01 00 01 00 25 00 00 00 02 00 00 00 FF FF FF FF 11 62 0C 00 01 00 00 00 06 74 65 6E 5F 75 73 FD 63 0D 00 02 00 04 00 05 00 00 00 01 00 00 00 84 64 25 00 02 00 00 00 02 00 01 00 14 00 00 00 00 00 00 00 FF FF FF FF 01 00 01 00 16 00 00 00 03 00 00 00 FF FF FF FF 4B 62 10 00 01 00 00 00 0A 64 65 6C 61 79 5F 31 30 75 73 CC 63 0D 00 08 00 05 00 11 00 01 00 01 00 00 00 70 64 55 00 05 00 00 00 02 00 01 00 14 00 00 00 00 00 00 00 E8 C8 4B 00 01 00 01 00 24 00 00 00 00 00 00 00 E8 C8 4B 00 04 00 01 00 24 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 26 00 00 00 00 00 00 00 E8 C8 4B 00 04 00 01 00 26 00 00 00 00 00 00 00 00 00 00 00 98 62 09 00 01 00 00 00 03 75 31 36 B5 63 0D 00 40 00 00 00 05 00 00 00 01 00 00 00 4A 64 25 00 02 00 00 00 02 00 01 00 09 00 00 00 00 00 00 00 FF FF FF FF 01 00 01 00 14 00 00 00 00 00 00 00 FF FF FF FF 5B 62 0E 00 01 00 00 00 08 5F 72 65 67 35 31 5F 48 DD 63 0D 00 01 00 00 00 00 00 00 00 01 00 00 00 8E 64 15 00 01 00 00 00 02 00 02 00 02 00 00 00 00 00 00 00 FF FF FF FF 84 06 07 00 00 00 00 02 00 17 DA 06 10 00 00 17 00 78 7F E4 F6 D8 FD 75 81 07 02 00 03 2B 04 0A 00 04 4D 41 49 4E 00 00
标签:02,03,00,01,51,61,Mac,FF,搭建 来源: https://www.cnblogs.com/qsbye/p/16542308.html