Under Linux, there is no IDE that is as easy to use as Keli to develop 51 SCMs. The development environment can only be built by itself. a) Install SDCC Sudo apt-get install sdcc b) Test whether the SDCC is available. This is a simple water flow code test.c that is found on the Internet. It is used for testing. #include "8051.h" #define uint unsigned int #define uchar unsigned char Uchar tab[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; Void Delay(uint xms) { Uint i,j; For(i=xms;i>0;i--) For(j=110;j>0;j--); } Void main() { Uchar i; While(1) { For(i=0;i<8;i++) { P1 = tab[i]; Delay(100); } } } 12345678910111213141516171819202122232425 Compile it: sdcc test.c Will generate so many files: Test.lk test.map test.rel test.sym test.asm test.ihx test.lst test.mem test.rst We only need the test.ihx Packihx file.ihx >file.hex converted to hex file Then download the hex2bin file at http://sourceforge.net/projects/hex2bin/files/latest/download. Command: hex2bin sourcefile.hex. The sourcefile.bin file will be generated later. Hextobin file.hex generates bin file Note: To facilitate calling hex2bin later, you can add the path to the .bashrc file Add the location of Hex2bin in the last line of ~/.bashrc PATH=$PATH:/home/leo/workspace/c51/Hex2bin-2.31 Can write a makefile, the compiler is more convenient Here is the makefile I wrote: Test.hex : test.c Sdcc test.c Packihx test.ihx > test.hex Hex2bin test.hex Clean: Rm -rf *.asm *.lst *.mem *.rst *.lnk *.rel *.sym *.ihx *.hex *.map ~ 1234567 Step Two: Installing a Write Tool a) Download stcflash:github.com/laborer/stcflash, which is a software written in python to write the bin file to the MCU. b) Installation environment: sudo apt-get install python-serial c) Write: sudo python ./stcflash.py test.bin Breaker Rcbo,Rcbo Protection,Leakage Protection Rcbo,Leakage Protection Switch ZHEJIANG QIANNA ELECTRIC CO.,LTD , https://www.traner-elec.com
Step One: Install Cross Compilation Tools