Experiment No 2
Experiment No 2
Experiment No 2
Title: Introduction to arm lab software and study Keil IDE overview of project creation and
downloading and debugging
Aim: - Study of Keil IDE overview (Project creation, downloading & debugging)
Theory-
There are various development environments available in the market for ARM processors.
Some of these are mentioned below:
• Cross Works for Arm
• Keil µVision MDK
• IAR Embedded Workbench
We will see how to install and setup the µVision IDE by Keil.
We will see the steps that need to be followed for installing this software correctly.
When this is done, we will setup the environment for LPC2148 and write a basic code for LED
blinking.
2. Go to the Project tab. Select New µVision Project ...from that menu.
3. Create New Project window will pop up. Select the folder where you want to create
project and give a suitable name to the project. Then click on Save.
4. Select Device for Target: ‘Target1’...window will pop up next. It has a select window to
choose between Software Packs or Legacy Device Database. As LPC2148 is in Legacy
Device Database, choose Legacy Device Database.
Type in LPC2148 in search and select the device under NXP with the name LPC2148 and click
on OK.
5. A window will pop up asking whether to copy Startup.s to project folder and add file to
project. Click on Yes.
6. The project name and its folders can be seen on the left side in the project window after the
previous step is completed as shown below.
7. Now go to File tab and add New file from the menu.
8. Save the file from the previous step with a specific name. Add .c extension to the file
name.
9. Add this file to Source Group folder in the project window by right clicking on Source
Group1 folder and selecting Add Existing Files to Group ‘Source Group1’...
Select the previously saved file from the window that pops up and add it to the Source Group1.
In our case, LED Blinking.c
10. Now click on the Options for Target ‘Target1’... symbol shown in red box in the image
below or press Alt+F7 or right click on Target1 and click on Options for Target
‘Target1’....
Options for target window will open. Go to the Output tab in that window. Tick ‘√’ Create
HEX File option. We need to produce HEX file to burn it into the microcontroller.
In the options for target window, go to the Linker tab. Select the Use Memory Layout from
Target Dialogue option.
int main(void)
{
IO0DIR = 0x000000FF; /* Set P0.0 to P0.7 bits as output bits by writing 1 in IO0DIR
register corresponding to those bits. */ while(1)
{
IO0PIN = IO0PIN | 0x000000FF; /* Make P0.0 to P0.7 HIGH while keeping other bits
unchanged. */
delay_ms(300);
IO0PIN = IO0PIN & 0xFFFFFF00; /* Make P0.0 to P0.7 LOW while keeoing other bits
unchanged. */
delay_ms(300);
}
}
12. Once the code is written, Build the code by clicking on the button shown in red in the
image below. You can also build the project from the Build Target option in the Project tab or
by pressing F7 on the keyboard.
You can see creating hex file ... in the Build Output window as shown in the image.
13. Once the project is built, a hex file is created in the Objects folder inside the folder of
your project. Use Flash Magic software to burn this hex file in your microcontroller.
3. Once your project is created, click on "Library" -> "Pick Devices" in the main menu.
4. In the "Device Selection" dialog box, search for "LPC2148" in the search bar.
13. Finally, save your project by clicking on "File" -> "Save" in the main menu.
1. Download Flashmagic Tool: Firstly, download and install Flashmagic Tool from the official
website (https://www.flashmagictool.com/).
2. Connect the LPC2148: Connect the LPC2148 board to your computer via a USB cable.
3. Configure the Serial Port: Open the Flashmagic Tool and select the serial port that the LPC2148
board is connected to.
4. Configure the device: Select the LPC2148 device from the device list in the Flashmagic Tool. You
can also set other parameters like baud rate, oscillator frequency, etc.
5. Load Hex File: Click on the "Browse" button and select the Hex file that you want to program into
the LPC2148 device.
6. Erase the Flash: Before programming, it is essential to erase the flash memory of the LPC2148
device. In the "Operations" menu, select "Erase Device" and click on "Start".
7. Program the Device: After erasing the flash memory, select the "Program Device" option from the
"Operations" menu. Flashmagic will program the hex file onto the LPC2148 device.
8. Verify the programmed Hex File: Once programming is complete, select the "Verify Device"
option to ensure that the LPC2148 device has been programmed correctly.
9. Reset the device: After verification, reset the LPC2148 device to ensure that the new code runs
correctly.
Open the flash magic software and follow the below steps.
Conclusion- In this experiment we have studied Keil IDE overview (Project creation,
downloading & debugging)