Concept of compiler: -
Compilers are programs used to convert a High Level Language to object code. Desktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors.So if one wants to define a compiler then compiler is a program that translates source code into object code.
Concept of cross compiler: -
A cross compiler is similar to the compilers but we write a program for the target processor (like 8051 and its derivatives) on the host processors (like computer of x86).It means being in one environment you are writing a code for another environment is called cross development. And the compiler used for cross development is called cross compiler.So the definition of cross compiler is a compiler that runs on one computer but produces object code for a different type of computer.
Cross compilers are very popular for embedded development, where the target probably couldn't run a compiler. Typically an embedded platform has restricted RAM, no hard disk, and limited I/O capability. Code can be edited and compiled on a fast host machine (such as a PC or Unix workstation) and the resulting executable code can then be downloaded to the target to be tested.
Keil C Compiler is one such compiler that supports a huge number of host and target combinations. It supports as a target to 8 bit microcontrollers like Atmel and Motorola etc.
Now after going through the concept of compiler and cross compilers lets we start with Keil C cross compiler.
Keil C cross compiler: -
Keil is a German based Software development company. It provides several development tools like
- IDE (Integrated Development environment)
- Project Manager
- Simulator
- Debugger
- C Cross Compiler , Cross Assembler, Locator/Linker
Keil Software provides you with software development tools for the 8051 family of microcontrollers. With these tools, you can generate embedded applications for the multitude of 8051 derivatives. Keil provides following tools for 8051 development
- C51 Optimizing C Cross Compiler,
- A51 Macro Assembler,
- 8051 Utilities (linker, object file converter, library manager),
- Source-Level Debugger/Simulator,
- µVision for Windows Integrated Development Environment.
The keil 8051 tool kit includes three main tools, assembler, compiler and linker.
An assembler is used to assemble your 8051 assembly program
A compiler is used to compile your C source code into an object file
A linker is used to create an absolute object module suitable for your in-circuit emulator.
8051 project development cycle: -
these are the steps to develop 8051 project using keil
- Create source files in C or assembly.
- Compile or assemble source files.
- Correct errors in source files.
- Link object files from compiler and assembler.
- Test linked application.
now let us start how to work with keil.
Keil MicroVision is a free software which solves many of the pain points for an embedded program developer. This software is an integrated development environment (IDE), which integrated a text editor to write programs, a compiler and it will convert your source code to hex files too.
Here is simple guide to start working with Keil uVision which can be used for
- Writing programs in C/C++ or Assembly language
- Compiling and Assembling Programs
- Debugging program
- Creating Hex and Axf file
- Testing your program without Available real Hardware (Simulator Mode)
This is simple guide on Keil uVision 4 though also applicable on previous versions also.
These are the simple steps to get off the mark your inning!
Step 1: After opening Keil uV4, Go to Project tab and
Create new uVision project
Now Select new folder and give name to Project.
Step 2: After Creating project now Select your device model. Example. :AT89c51
Step 3: so now your project is created and Message window will appear to add startup file of your Device click on Yes so it will be added to your project folder
Step 4: Now go to File and create new file and save it with .C extension if you will write program in C language or save with .asm for assembly language.
i.e., Led.c
Step 5: Now write your program and save it again.
Step 6: After that on left you see project window [if it’s not there….go to View tab and click on project window]
Now come on Project window.
Step 7: Now Expand target and you will see source group
Right click on group and click on Add files to source group
Step 8: Now Click on Build target.You can find it under Project tab or in toolbar.It can also be done by pressing F7 key.
Step 9: you can see Status of your program in Build output window
[If it’s not there go to view and click on Build output window]
Step 5: Now write your program and save it again.
Step 6: After that on left you see project window [if it’s not there….go to View tab and click on project window]
Now come on Project window.
Right click on target and click on options for target
Here you can change your device also.
Click output tab here & check create Hex file if you want to generate hex file
Now click on ok so it will save changes.
Step 7: Now Expand target and you will see source group
Right click on group and click on Add files to source group
Now add your program file which you have written in C/assembly.
You can see program file added under source group.
Step 9: you can see Status of your program in Build output window
[If it’s not there go to view and click on Build output window]








No comments:
Post a Comment