OCFreaks!

Create Keil uVision5 Project for LPC2148 ARM7 MCU

Many of us who are into embedded programming want to migrate or use the latest version of KEIL MDK which is uVision5 at the time of this post. In this tutorial we see how to create LPC214x ARM7 projects in KEIL uVision5. Time is whizzing by fast, and along the years we have programmed lpc2100 ARM7 devices (lpc2148,etc..) using Keil uVision 2, uv3 then uv4 and now Keil uVision 5. But many times upgrading your IDE or toolchain might bring in the need for some necessary tweaks or ‘change of settings’ so that your code compiles and executes properly as it use to on previous IDEs. Last time we saw how to fix the interrupt issue in Keil uVision4 for ARM7 MCUs where interrupts won’t trigger even if your code was correct @ Keil uVision ARM7 Interrupt Problem and Issue fix. This time we take a look on how to build your LPC2148 ARM7 projects properly in Keil uVision5. ARM9 & ARM7 based Microcontrollers like LPC2148, and other LPC3000 series MCUs etc.. are now “legacy stuff” in Keil uVision5 and is not available in default installation. To enable support for ARM7 LPC2148 and similar devices you need to install Legacy Support pack for ARM7, ARM9 & Cortex-R after which you can create projects for the legacy MCU without any fuzz. This will also enable backwards compatibility for projects made using Keil MDK v4. Just follow the steps mentioned below to create a new project in Keil MDK uv5 or if your project is not working properly:

1. Download latest Keil MDK uVision5 from Keil’s website.
2. Install Keil MDK uv5 to default path.
3. Download Legacy Support pack for ARM7, ARM9 & Cortex-R based Microcontroller for your Keil Version from MDK v4 Legacy Support page.
4. Next install the legacy pack to default path. You are ready to create projects for LPC214x, LPC3000 series Microcontroller in uv5 now.
5. Open the Keil IDE, under main menu goto “Project->New uVision Project…” and a window prompt will open asking to save the new project. Type your desired project name and save.

6. After that, a new window will appear as shown below. Click on the drop-down menu which reads “Software Packs”. Select “Legacy Device Database [no RTE]”

7. Now in the search box below type: “lpc2148” or the MCU which you want to create project on. In the Tree below the search box select “LPC2148” under “NXP” and click OK.

8. Next the following dialog box will appear. Click “Yes” to proceed.

9. Now click on “Options for Target” button as shown below:

10. Next the following window will appear and now click the “Linker” tab:

11. Under the Linker Tab put a tick on the checkbox option which says “Use Memory Layout from Target Dialog” and click OK.

For some guys including me the compiled code doesn’t not work as expected. By checking the above option your program must run as usual when you flash it to your microcontroller. Also in case if interrupts are not working in your keil this will most probably solve the issue as mentioned here : Keil uVision ARM7 Interrupt Problem and Issue fix

12. Now under the “Output” tab click on the check box that reads “Create HEX File”.

13. Now, in the source navigation pane on the left area, right click on “Source Group 1” and select “Add New Item to Group ‘Source Group 1′”.

14. A new window will pop-up to add an item as shown below. Select C++ File (.cpp), then enter the name of the file in the text box to the left of “Name:” and click “Add”.

15. Now you can write your program in the editor. To compile your program Press “F7” key or in the main menu goto “Project->Build Target”. To check for any compilation errors you can have a look at the build output at the bottom of main window. A screenshot of the Keil uVision 5 is given below. The top red box shows the Source Tree Navigation and the bottom red box shows the build output.

After this you are now ready to create your own LPC2148 ARM7 projects in Keil uVision5. If you are facing any problems/issues creating or compiling projects for lpc2148 in Keil uVision4 or uVision5 let me know by commenting to this post below. Best of Luck!