(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[category: LPC1768 Tutorials]]
 
=Objective=
 
=Objective=
 
In this tutorial we will see how to setup a keil project to generate .hex file for LPC1768<br><br>
 
In this tutorial we will see how to setup a keil project to generate .hex file for LPC1768<br><br>
 
 
 
 
[[File:00_Lpc7168_Keil.png]]<br><br>
 
[[File:00_Lpc7168_Keil.png]]<br><br>
  
 +
=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:Lpc1768_Keil_01.png]]<br><br>
Line 18: Line 17:
 
[[File:Lpc1768_Keil_04.png]]<br><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><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>
 
[[File:Lpc1768_Keil_05.png]]<br><br>
 
[[File:Lpc1768_Keil_05.png]]<br><br>
  
Line 27: Line 26:
 
[[File:Lpc1768_Keil_07.png]]
 
[[File:Lpc1768_Keil_07.png]]
 
<html>
 
<html>
<script src="https://gist.github.com/SaheblalBagwan/bd64798708617af14fcc.js"></script>
+
<script src="https://gist.github.com/SaheblalBagwan/cb2cf78aadc724737d79.js"></script>
 
</html>
 
</html>
 +
<br>
 +
 +
<html>
 +
<script src="https://gist.github.com/SaheblalBagwan/fe401523c97e4cb2d7e98565e1bd3b06.js"></script>
 +
</html>
 +
<br>
  
 
<b>Step8:</b> After typing the code save the file as <b>main.c</b>.<br>
 
<b>Step8:</b> After typing the code save the file as <b>main.c</b>.<br>
 
[[File:Lpc1768_Keil_08.png]]<br><br>
 
[[File:Lpc1768_Keil_08.png]]<br><br>
  
<b>Step9:</b> Add the recently saved file to the project<br><br>.
+
<b>Step9:</b> Add the recently saved file to the project.<br>
 
[[File:Lpc1768_Keil_09.png]]<br><br>
 
[[File:Lpc1768_Keil_09.png]]<br><br>
  
Line 42: Line 47:
 
[[File:Lpc1768_Keil_11.png]]<br><br>
 
[[File:Lpc1768_Keil_11.png]]<br><br>
  
<b>Step12:</b> Code is compiled with nor errors. The <b>.hex</b> file is still not generated.<br>
+
<b>Step12:</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:Lpc1768_Keil_12.png]]<br><br>
  
 +
=Enable Hex File Generation=
 
<b>Step13:</b> Click on <b>Target Options</b> to select the option for generating .hex file.<br>
 
<b>Step13:</b> Click on <b>Target Options</b> to select the option for generating .hex file.<br>
 
[[File:Lpc1768_Keil_13.png]]<br><br>
 
[[File:Lpc1768_Keil_13.png]]<br><br>
Line 51: Line 57:
 
[[File:Lpc1768_Keil_14.png]]<br><br>
 
[[File:Lpc1768_Keil_14.png]]<br><br>
  
<b>Step15:</b> Enable the option to generate the .hex file<br><br>
+
<b>Step15:</b> Enable the option to generate the .hex file<br>
 
[[File:Lpc1768_Keil_15.png]]<br><br>
 
[[File:Lpc1768_Keil_15.png]]<br><br>
  
Line 60: Line 66:
 
[[File:Lpc1768_Keil_17.png]]<br>
 
[[File:Lpc1768_Keil_17.png]]<br>
 
<br><br>
 
<br><br>
 +
 +
=Uploading the Hex file=
 +
After generating the .hex file check this tutorial for [[LPC1768: Uploading Hex and Bin files|uploading Hex and Bin files.]]
 +
<br><br>
 +
 +
= Downloads=
 +
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!
 +
{{DISQUS}}

Latest revision as of 16:36, 27 October 2017

Objective

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

00 Lpc7168 Keil.png

Keil Setup Steps

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

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

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

Step4: Select the controller(NXP:LPC1768) and click on OK.
Lpc1768 Keil 04.png

Step5: As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
Lpc1768 Keil 05.png

Step6: Create a new file to write the program.
Lpc1768 Keil 06.png

Step7: Type the code or Copy paste the below code snippet.
Lpc1768 Keil 07.png


Step8: After typing the code save the file as main.c.
Lpc1768 Keil 08.png

Step9: Add the recently saved file to the project.
Lpc1768 Keil 09.png

Step10: Add the main.c along with system_LPC17xx.c.
Lpc1768 Keil 10.png

Step11: Build the project and fix the compiler errors/warnings if any.
Lpc1768 Keil 11.png

Step12: Code is compiled with no errors. The .hex file is still not generated.
Lpc1768 Keil 12.png

Enable Hex File Generation

Step13: Click on Target Options to select the option for generating .hex file.
Lpc1768 Keil 13.png

Step14: Set IROM1 start address as 0x0000.
Lpc1768 Keil 14.png

Step15: Enable the option to generate the .hex file
Lpc1768 Keil 15.png

Step16: .Hex file is generated after a rebuild.
Lpc1768 Keil 16.png

Step17: Check the project folder for the generated .hex file.
Lpc1768 Keil 17.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: https://codeload.github.com/ExploreEmbedded/Explore-Cortex-M3-LPC1768-Stick-DVB-14001/zip/master



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