Single Chip microcomputer growth path (51 basics)-006 development of 51 single-chip microcomputer under Linux burning and writing environment

Source: Internet
Author: User
Tags xms

There is no IDE like Keli in Linux to develop 51 single-chip microcomputer, development environment can only build themselves.

First step: Install the cross-compilation tool
A) Install SDCC
sudo apt-get install SDCC
b) Test SDCC is available, this is a simple test.c on the Internet to find the code of the running lights, to test

1#include"8051.h"2 3 #defineUINT unsigned int4 #defineUchar unsigned char5Uchar tab[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};6 7 voidDelay (UINTXMS) {8         UINTi,j;9          for(i=xms;i>0; i--)Ten          for(j= the;j>0; j--); One } A  - voidMain () { - Uchar i; the      while(1){ -          for(i=0;i<8; i++){ -P1 =Tab[i]; -Delay ( -); +         } -     } +}

Compile it:

Will generate so many files (we only need test.ihx in them):

test.lk test.map test.rel test.sym test.asm test.ihx test.lst test.mem Test.rst

file. ihx >file. hex to hex file

Then download the Hex2bin file, url (http://sourceforge.net/projects/hex2bin/files/latest/download).

Hex2bin Sourcefile.hex. The Sourcefile.bin file is then generated.

Note: To make it easier to call Hex2bin later, you can add the path to the. bashrc file in the last line of ~/.BASHRC plus the folder location where Hex2bin is located:

Path= $PATH:/home/jikexianfeng/wuyi-demo/hex2bin-2.5

Can write a makefile file, compile more convenient
This is the makefile I wrote:

1 test.hex:test.c 2     SDCC test.c3     packihx test.ihx > test.hex4    hex2bin Test.hex5clean:6     rm -rf *.asm *.lst *.mem *.rst *.lnk *.rel *. Sym *.IHX *.hex *.map

Step Two: Install the burn-write tool
A) download Stcflash:http://github.com/laborer/stcflash, a python-written software that writes bin files to a single-chip microcomputer
b) Installation environment: sudo apt-get install python-serial
c) Burn write: sudo python./stcflash.py test.bin

Single Chip microcomputer growth path (51 basics)-006 development of 51 single-chip microcomputer under Linux burning and writing environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.