Objective

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


00 Lpc7168 Keil.png

  1. Open the Keil software and select the New Microvision project from Project Menu as shown below.

Lpc1768 Keil 01.png

  1. Browse to your project folder and provide the project name and click on save.

Lpc1768 Keil 02.png

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

  1. Select the controller(NXP:LPC1768) and click on OK.

Lpc1768 Keil 04.png

  1. As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.

Lpc1768 Keil 05.png

  1. Create a new file to write the program.

Lpc1768 Keil 06.png

  1. Type the code or Copy paste the below code snippet.

Lpc1768 Keil 07.png

  1. After typing the code save the file as main.c.

Lpc1768 Keil 08.png

  1. Add the recently saved file to the project
    .

Lpc1768 Keil 09.png

  1. Add the main.c along with system_LPC17xx.c.

Lpc1768 Keil 10.png

  1. Build the project and fix the compiler errors/warnings if any.

Lpc1768 Keil 11.png

  1. Code is compiled with nor errors. The .hex file is still not generated.

Lpc1768 Keil 12.png

  1. Click on Target Options to select the option for generating .hex file.

Lpc1768 Keil 13.png

  1. Set IROM1 start address as 0x0000.

Lpc1768 Keil 14.png

  1. Enable the option to generate the .hex file

Lpc1768 Keil 15.png


  1. .Hex file is generated after a rebuild.

Lpc1768 Keil 16.png

  1. Check the project folder for the generated .hex file.

Lpc1768 Keil 17.png