Getting started with ARM LPC2148 using Keil uVision IDE

Using Keil µVision IDE to start writing codes for LPC2148

70.1k views4 min readUpdated Jan 2, 2023

There are various development environments available in the market for ARM processors.

Some of these are mentioned below :

  • CrossWorks for Arm
  • Keil µVision
  • 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.

 

Downloading and installation

Follow the steps given below:

1.  Download the MDK-lite (Microcontroller Development Kit) by Keil from their website. Here is the link to the page from where you can download this : http://www2.keil.com/mdk5/install

Click on Download MDK-Core.

Download Page

Install the software by following the simple instructions provided during installation process.

 

2.  The new version µVision5 does not support many of the devices that were supported in the older versions yet. LPC2148 is one of the devices that are not supported. Hence, we need to add this device after successfully installing µVision5.

To do this, go to the following link and download the executable file for Legacy Support for ARM7, ARM9, and Cortex-R: http://www2.keil.com/mdk5/legacy

Download the Legacy support for the version of MDK downloaded and installed.

Legacy Download

Install the executable file that will be downloaded. Follow the simple instructions provided during the installation process.

 

When the above described steps are completed, we will have the IDE installed and ready to use with support for the device we intend to use, i.e. LPC2148.

 

Using µVision IDE

We will create a simple LED blinking project. Following are steps which show how to create and built project using the Keil uVision IDE:

1.  Open Keil µVision from the icon created on your desktop.

Open Keil

2.  Go to the Project tab. Select New µVision Project ...from that menu.

New Project

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.

Create Project

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.

Target Device

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.

Add Startup

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.

Project Details

7.  Now go to File tab and add New file from the menu.

New File

8.  Save the file from the previous step with a specific name. Add .c extension to the file name.

C File

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’...

Add Existing File
Select File

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.

Build Options 1

In the options for target window, go to the Linker tab. Select the Use Memory Layout from Target Dialogue option.

Build Options 2

Then click on OK.

11.  Now write the code for LED Blinking.

/*
   LED Blinking on LPC2148(ARM7)
   http://www.electronicwings.com/arm7/getting-started-with-arm-lpc2148-using-keil-uvision-ide
*/

#include <lpc214x.h>
#include <stdint.h>

void delay_ms(uint16_t j) /* Function for delay in milliseconds */
{
    uint16_t x,i;
	for(i=0;i<j;i++)
	{
    for(x=0; x<6000; x++);    /* loop to generate 1 millisecond delay with 12MHz Fosc. */
	}
}

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.

Created Hex File

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.

Download Flash Magic from the following Link : http://www.flashmagictool.com​​​

Components Used

Powered byMouser Electronics

Downloads

Comments13

Join the discussion — share a question or tip.

  • SO
    sourabhpatyal111

    Rebuild started: Project: first *** Target 'Target_1' uses ARM-Compiler 'Default Compiler Version 5' which is not available. *** Please review the installed ARM Compiler Versions: 'Manage Project Items - Folders/Extensions' to manage ARM Compiler Versions. 'Options for Target - Target' to select an ARM Compiler Version for the target. *** Rebuild aborted. solution please guide me

  • MA

    Product: MDK-ARM Lite 5.36 Component: ARM Compiler 5.06 update 7 (build 960) Tool: ArmCC [4d365d] Fatal error: C3903U: Argument 'ARM7TDMI' not permitted for option 'cpu'. assembling Startup.s... Startup.s: Error: A9580E: ARM7 is not available with the current toolkit and license. Check that ARM_TOOL_VARIANT is set correctly. Startup.s: Check that your license details are correct in the License Management dialog of MDK. Additional information is available at: Startup.s: http://www.keil.com/support/man/docs/license/license_management.htm Startup.s: If you need further help, provide this complete error report to your supplier or license.support@arm.com. Startup.s: - ARMLMD_LICENSE_FILE: unset Startup.s: - LM_LICENSE_FILE: unset Startup.s: - ARM_TOOL_VARIANT: unset Startup.s: - ARM_PRODUCT_PATH: unset Startup.s: - Product location: C:\Keil_v5\ARM\sw\mappings Startup.s: - Toolchain location: C:\Keil_v5\ARM\ARMCC\Bin Startup.s: - Selected tool variant: mdk_lite Startup.s: Product: MDK-ARM Lite 5.36 Startup.s: Component: ARM Compiler 5.06 update 7 (build 960) Startup.s: Tool: ArmAsm [4d35fa] Startup.s: error: A3903U: Argument 'ARM7TDMI' not permitted for option 'cpu'. ".\Objects\lpc2138_interefence with lcd.axf" - 4 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:01 this is the error I am facing. Please help to resolve it

  • AN
    anamaybelekar

    Build started: Project: ARM_first *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Build target 'Target 1' assembling Startup.s... Startup.s: Error: A9580E: ARM7 is not available with the current toolkit and license. Check that ARM_TOOL_VARIANT is set correctly. Startup.s: Check that your license details are correct in the License Management dialog of MDK. Additional information is available at: Startup.s: http://www.keil.com/support/man/docs/license/license_management.htm Startup.s: If you need further help, provide this complete error report to your supplier or license.support@arm.com. Startup.s: - ARMLMD_LICENSE_FILE: unset Startup.s: - LM_LICENSE_FILE: unset Startup.s: - ARM_TOOL_VARIANT: unset Startup.s: - ARM_PRODUCT_PATH: unset Startup.s: - Product location: C:\Keil_v5\ARM\sw\mappings Startup.s: - Toolchain location: C:\Keil_v5\ARM\ARMCC\Bin Startup.s: - Selected tool variant: mdk_lite Startup.s: Product: MDK-ARM Lite 5.30 Startup.s: Component: ARM Compiler 5.06 update 6 (build 750) Startup.s: Tool: ArmAsm [4d35ec] Startup.s: error: A3903U: Argument 'ARM7TDMI' not permitted for option 'cpu'. compiling ARM_first.c... Error: C9580E: ARM7 is not available with the current toolkit and license. Check that ARM_TOOL_VARIANT is set correctly. Check that your license details are correct in the License Management dialog of MDK. Additional information is available at: http://www.keil.com/support/man/docs/license/license_management.htm If you need further help, provide this complete error report to your supplier or license.support@arm.com. - ARMLMD_LICENSE_FILE: unset - LM_LICENSE_FILE: unset - ARM_TOOL_VARIANT: unset - ARM_PRODUCT_PATH: unset - Product location: C:\Keil_v5\ARM\sw\mappings - Toolchain location: C:\Keil_v5\ARM\ARMCC\Bin - Selected tool variant: mdk_lite Product: MDK-ARM Lite 5.30 Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637] Fatal error: C3903U: Argument 'ARM7TDMI' not permitted for option 'cpu'. ".\Objects\ARM_first.axf" - 4 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:00

    • SN
      SnehdeepDas

      use a lower version of keil

    • VI
      VikramGNVR

      Replying to @SnehdeepDas

      Where to get older versions of the keil?

  • GO
    gobalkrishnan

    Build started: Project: lod *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'E:\Software\Keil_v5\ARM\ARMCC\Bin' Build target 'Target 1' assembling Startup.s... Startup.s: Error: A9580E: ARM7 is not available with the current toolkit and license. Check that ARM_TOOL_VARIANT is set correctly. Startup.s: Check that your license details are correct in the License Management dialog of MDK. Additional information is available at: Startup.s: http://www.keil.com/support/man/docs/license/license_management.htm Startup.s: If you need further help, provide this complete error report to your supplier or license.support@arm.com. Startup.s: - ARMLMD_LICENSE_FILE: unset Startup.s: - LM_LICENSE_FILE: unset Startup.s: - ARM_TOOL_VARIANT: unset Startup.s: - ARM_PRODUCT_PATH: unset Startup.s: - Product location: E:\Software\Keil_v5\ARM\sw\mappings Startup.s: - Toolchain location: E:\Software\Keil_v5\ARM\ARMCC\Bin Startup.s: - Selected tool variant: mdk_lite Startup.s: Product: MDK-ARM Lite 5.30 Startup.s: Component: ARM Compiler 5.06 update 6 (build 750) Startup.s: Tool: ArmAsm [4d35ec] Startup.s: error: A3903U: Argument 'ARM7TDMI' not permitted for option 'cpu'. ".\Objects\lod.axf" - 2 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:15

  • GO
    gobalkrishnan

    Startup.s: error: A3903U: Argument 'ARM7TDMI' not permitted for option 'cpu'.

    • SU
      subharicardokaka

      how you were able to solve this issue? any help will be appreciated.

    • GA
      GaganaV

      Same issue even I am facing

  • NN
    nnguyenvnhi

    Can I use LPC2103 to research according to your material?

  • NN
    nnguyenvnhi

    Can you tell me where to buy this kit?

  • PR
    progujar26

    Can you please add the interfacing of GLCD (128x64) with LPC2148