Line 5: Line 5:
 
=Keil Setup Steps=
 
=Keil Setup Steps=
 
<b>Step1:</b> Open the Keil software and select the New Microvision project from Project Menu as shown below.<br>
 
<b>Step1:</b> Open the Keil software and select the New Microvision project from Project Menu as shown below.<br>
[[File:Lpc1768_Keil_01.png]]<br><br>
+
[[File:LPC2148KeilSetup01.png]]<br><br>
  
 
<b>Step2:</b> Browse to your project folder and provide the project name and click on save.<br>
 
<b>Step2:</b> Browse to your project folder and provide the project name and click on save.<br>
[[File:Lpc1768_Keil_02.png]]<br><br>
+
[[File:LPC2148KeilSetup02.png]]<br><br>
  
<b>Step3:</b> Once the project is saved a new pop up “Select Device for Target” opens, Select the controller(NXP:LPC1768) and click on OK.<br>
+
<b>Step3:</b> Once the project is saved a new pop up “Select Device for Target” opens, Select the controller(NXP:LPC2148) and click on OK.<br>
[[File:Lpc1768_Keil_03.png]]<br><br>
+
[[File:LPC2148KeilSetup03.png]]<br><br>
  
<b>Step4:</b> Select the controller(NXP:LPC1768) and click on OK.<br>
 
[[File:Lpc1768_Keil_04.png]]<br><br>
 
  
<b>Step5:</b> As LPC1768 needs the startup code, click on <b>Yes</b> option to include the <b>LPC17xx Startup</b> file.<br>
+
<b>Step4:</b> As LPC2148 needs the startup code, click on <b>Yes</b> option to include the <b>Startup</b> file.<br>
[[File:Lpc1768_Keil_05.png]]<br><br>
+
[[File:LPC2148KeilSetup04.png]]<br><br>
  
<b>Step6:</b> Create a new file to write the program.<br>
+
<b>Step5:</b> Create a new file to write the program.<br>
[[File:Lpc1768_Keil_06.png]]<br><br>
+
[[File:LPC2148KeilSetup05.png]]<br><br>
  
<b>Step7:</b> Type the code or Copy paste the below code snippet.<br>
+
<b>Step6:</b> Type the code or Copy paste the below code snippet.<br>
[[File:Lpc1768_Keil_07.png]]
+
[[File:LPC2148KeilSetup06.png]]
 
<html>
 
<html>
 
<script src="https://gist.github.com/SaheblalBagwan/cb2cf78aadc724737d79.js"></script>
 
<script src="https://gist.github.com/SaheblalBagwan/cb2cf78aadc724737d79.js"></script>
Line 29: Line 27:
 
<br>
 
<br>
  
<b>Step8:</b> After typing the code save the file as <b>main.c</b>.<br>
+
<b>Step7:</b> After typing the code save the file as <b>main.c</b>.<br>
[[File:Lpc1768_Keil_08.png]]<br><br>
+
[[File:LPC2148KeilSetup07.png]]<br><br>
  
<b>Step9:</b> Add the recently saved file to the project.<br>
+
<b>Step8:</b> Add the recently saved file to the project.<br>
[[File:Lpc1768_Keil_09.png]]<br><br>
+
[[File:LPC2148KeilSetup08.png]]<br><br>
  
<b>Step10:</b> Add the main.c along with system_LPC17xx.c.<br>
+
<b>Step9:</b> Add the main.c along with system_LPC17xx.c.<br>
[[File:Lpc1768_Keil_10.png]]<br><br>
+
[[File:LPC2148KeilSetup09.png]]<br><br>
  
<b>Step11:</b> Build the project and fix the compiler errors/warnings if any.<br>
+
<b>Step10:</b> Build the project and fix the compiler errors/warnings if any.<br>
[[File:Lpc1768_Keil_11.png]]<br><br>
+
[[File:LPC2148KeilSetup10.png]]<br><br>
  
<b>Step12:</b> Code is compiled with no errors. The <b>.hex</b> file is still not generated.<br>
+
<b>Step11:</b> Code is compiled with no errors. The <b>.hex</b> file is still not generated.<br>
[[File:Lpc1768_Keil_12.png]]<br><br>
+
[[File:LPC2148KeilSetup11.png]]<br><br>
  
 
=Enable Hex File Generation=
 
=Enable Hex File Generation=
<b>Step13:</b> Click on <b>Target Options</b> to select the option for generating .hex file.<br>
+
<b>Step12:</b> Click on <b>Target Options</b> to select the option for generating .hex file.<br>
[[File:Lpc1768_Keil_13.png]]<br><br>
+
[[File:LPC2148KeilSetup12.png]]<br><br>
  
<b>Step14:</b> Set IROM1 start address as 0x0000.<br>
+
<b>Step13:</b> Set IROM1 start address as 0x0000.<br>
[[File:Lpc1768_Keil_14.png]]<br><br>
+
[[File:LPC2148KeilSetup13.png]]<br><br>
  
<b>Step15:</b> Enable the option to generate the .hex file<br>
+
<b>Step14:</b> Enable the option to generate the .hex file<br>
[[File:Lpc1768_Keil_15.png]]<br><br>
+
[[File:LPC2148KeilSetup14.png]]<br><br>
  
<b>Step16:</b> .Hex file is generated after a rebuild.<br>
+
<b>Step15:</b> .Hex file is generated after a rebuild.<br>
[[File:Lpc1768_Keil_16.png]]<br><br>
+
[[File:LPC2148KeilSetup15.png]]<br><br>
  
<b>Step17:</b> Check the project folder for the generated .hex file.<br>
+
<b>Step16:</b> Check the project folder for the generated .hex file.<br>
[[File:Lpc1768_Keil_17.png]]<br>
+
[[File:LPC2148KeilSetup16.png]]<br>
 
<br><br>
 
<br><br>
  
Line 67: Line 65:
 
= Downloads=
 
= Downloads=
 
Download the complete project folder from the below link:  
 
Download the complete project folder from the below link:  
https://codeload.github.com/ExploreEmbedded/Explore-Cortex-M3-LPC1768-Stick-DVB-14001/zip/master<br><br><br>
 
  
  
Have a opinion, suggestion , question or feedback about the article let it out here!
+
Have an opinion, suggestion , question or feedback about the article let it out here!
 
{{DISQUS}}
 
{{DISQUS}}

Revision as of 12:12, 18 July 2016

In this tutorial we will see how to setup a keil project to generate .hex file for LPC2148

00 Lpc7168 Keil.png

Keil Setup Steps

Step1: Open the Keil software and select the New Microvision project from Project Menu as shown below.
LPC2148KeilSetup01.png

Step2: Browse to your project folder and provide the project name and click on save.
LPC2148KeilSetup02.png

Step3: Once the project is saved a new pop up “Select Device for Target” opens, Select the controller(NXP:LPC2148) and click on OK.
LPC2148KeilSetup03.png


Step4: As LPC2148 needs the startup code, click on Yes option to include the Startup file.
LPC2148KeilSetup04.png

Step5: Create a new file to write the program.
LPC2148KeilSetup05.png

Step6: Type the code or Copy paste the below code snippet.
LPC2148KeilSetup06.png

Step7: After typing the code save the file as main.c.
LPC2148KeilSetup07.png

Step8: Add the recently saved file to the project.
LPC2148KeilSetup08.png

Step9: Add the main.c along with system_LPC17xx.c.
LPC2148KeilSetup09.png

Step10: Build the project and fix the compiler errors/warnings if any.
LPC2148KeilSetup10.png

Step11: Code is compiled with no errors. The .hex file is still not generated.
LPC2148KeilSetup11.png

Enable Hex File Generation

Step12: Click on Target Options to select the option for generating .hex file.
LPC2148KeilSetup12.png

Step13: Set IROM1 start address as 0x0000.
LPC2148KeilSetup13.png

Step14: Enable the option to generate the .hex file
LPC2148KeilSetup14.png

Step15: .Hex file is generated after a rebuild.
LPC2148KeilSetup15.png

Step16: Check the project folder for the generated .hex file.
LPC2148KeilSetup16.png


Uploading the Hex file

After generating the .hex file check this tutorial for uploading Hex and Bin files.

Downloads

Download the complete project folder from the below link:


Have an opinion, suggestion , question or feedback about the article let it out here!