Tuesday , October 23 2018

Create New Keil Project for ARM7 LPC2148

In previous tutorial, we have quickly gone through how to load or program HEX file onto LPC2148 MCU using Flash Magic. This post is all about how to Create new Keil project for ARM7 LPC2148 Microcontroller. We’ll cover each and every step one by one. To keep simplicity we’ve provided text as well as video. You can follow anyone according to your comfort. Installation of MDK-ARM Keil uVision4 is pretty straight forward. We just have to fill form and get setup file. Evaluation version of Keil for ARM is available to download click here.

MDK-ARM Keil µVision:

This is free software (evaluation version) which solves many of the pain points for an embedded system developer. This software is an Integrated Development Environment(IDE), which integrated text editor to write program, a compiler and it will convert your source code into HEX file. Here is simple guide to start working with Keil µVision which can be used for:

  • Writing programs in C/C++ or Assembly
  • Compiling and assembling programs
  • Debugging programs
  • Creating HEX, AXF and BIN file
  • Test program without real hardware

Here is step by step guide to create fresh new project for ARM7 LPC2148 Microcontroller using MDK-ARM µVision4.

  • Once we’ve installed Keil, click on Keil µVision4 icon. This will appear on desktop after installation Keil.
  • Click on Project menu, and then hit on New uVision Project
create_new_project_keil_lpc2148
Create New Project Keil LPC2148
  • Create new project folder named as Blinky.
give_name_to_new_keil_project
Give Name to New Keil Project
  • Select target Device vendor. In this case NXP (founded by Phillips)
select_device_in_keil
Select Device in Keil
  • Expand NXP icon and select specific chip i.e. LPC2148 After this, a dialog box will pop-up on screen. This will ask you whether to copy startup code for LPC2148. Click on Yes.
add_startup_file_lpc2148
Add Startup File For LPC2148
  • Then we’ll get basic workplace to get start with writing code in. When we expand Target1 in left project pane. We see Startup.s is already added which is necessary for running code in Keil.
ready_workplace_for_lpc2148
Ready Workplace For LPC2148

NOTE:

code will not run without Startup.s file. Because startup code executes immediately upon reset of the target system and performs the following listed operations.

  1. Defines interrupt and exception vectors
  2. Configures the CPU clock source (on same device)
  3. Initializes the external bus controller
  4. Copies the exception vectors from ROM and RAM for systems with memory remapping
  5. Initializes other low level peripherals, if necessary
  6. Reserves and initializes the stack for all modes
  7. Reserves the heap
  8. Transfers control to the main C function
  • Now click on File menu and hit on New.
create_new_file_keil
Create New File Keil
  • Write code to blink LED in C and FileName.c Save. NOTE:Don’t forget to save as with .c extension
add_c_file_to_keil_project
Add C File To Keil Project
  • Once we save file as blinky.c. We’ll quickly get complete code with syntax highlighted.
code_highlighted_in_keil_lpc2148
Code Highlighted In Keil LPC2148
  • Now we can add blinky.c file by adding it to Group Source 1.
add_source_file_to_project_lpc2148
Add Source File To Project LPC2148
  • Add blinky.c file
add_file_to_keil_project
Add File To Keil Project
  • Now right click on Target 1 and hit on Options for target “Target 1”
set_options_for _target_lpc2148
Set Options For Target LPC2148
  • In Options for target “Target 1”. In output tab, click on check box Create HEX File.
set_output_keil_lpc2148
Set Output Keil LPC2148
  • Then go to Linker tab. Click on Use Memory Layout for Target Dialog
setup_linker_option_keil_lpc2148
Setup Linker Option Keil LPC2148
  • Then hit on Rebuild All target files
rebuild_the_keil_project_lpc2148
Rebuild The Keil Project LPC2148
  • Now we can see Build output. If we check project directory at this point. We’ll find generated HEX file. Later on we’ll use it to load or burn into LPC2148 MCU using Flash Magic.
build_output_keil_lpc2148
Build Output Keil LPC2148
hex_file_generated_keil_lpc2148
HEX File Generated Using Keil LPC2148
The only part left here is to setup Flash Magic and load HEX file into LPC2148 Microcontroller. Here are some pictures or I recommend you to watch video on this post to see step by step configuration and final output.
basic_setting_flashmagic_lpc2148
Basic Setting FlashMagic LPC2148

STEP-2

setup_options for_flashmagic_lpc2148
Setup Options For Flash Magic LPC2148

STEP-3

setup_hardware_configuration_flashmagic
Setup Hardware Configuration FlashMagic

STEP-4 Finally It’s Done….!!!!

flashmagic_loading_finished_lpc2148
FlashMagic Loading Finished LPC2148

We hope this post will provide you all information needed to create new keil project for ARM7 LPC2148.

[amazon_link asins=’B01LX5AN08,B077QLPCMZ’ template=’ProductCarousel’ store=’wwwbinaryupda-21′ marketplace=’IN’ link_id=’e8ed84e6-2ab4-11e8-ab36-971acfcfcc74′]

About Umesh Lokhande

Umesh Lokhande holds a Master degree in Scientific Instrumentation from University of Applied Sciences Jena, Germany. and has previously worked at Orbotech, Alere Technologies etc. Umesh is also a founder and first author of BINARYUPDATES.COM

7 comments

  1. am not getting nxp founded by philips project file how to get it ?
    please replay for me [email protected]

  2. Hello Srinath
    I am not getting your question completely. As far as what I understood from your question, first I want to know whether you’re using uVsion4 or uVision5.
    Bcause this is often ask question with uVision5. If you’re having this problem with uVision4 then you may have incomplete installation…..!!!

    Please write more detail about your problem. Its hard to answer with incomplete question.

    Happy Programming…..Good Day….!!!!

  3. Parmeshwar Sahu

    Thank you very much sir..
    I’ve got really impressed with your work..

    Warm regards,
    Parmeshwar Sahu

  4. Sir i want to program in lpc2148 in c for developing an project i have differnt sensors to work on i want to take data from sensor and use it for some operation to work and i want know that how it can be done what should i learn to write programme in c

  5. please mention procedure to run embeded c program without interface to real hardware adding 2 numbers and display result using port

  6. can u please explain steps to Test program without real hardware

  7. Nice article ! Thank you..

Login

Register | Lost your password?