Thursday, July 26, 2012

Generating HEX files in Keil uVision IDE




If you are new to Keil uVision IDE, you may have noticed that whether you use ASM code or C code, the HEX files are not generated when you compile your programs. This is because Keil does not generate the HEX file by default. In case you are wondering what HEX file is, HEX file is the output of Keil that is generated after compilation and linking of your application and this is the file that is 'burned' or programmed into your microcontroller or microprocessor.

So, to enable generation of the HEX file follow these steps:

Step 1) Create the Keil project by adding your ASM and/or C source files

Step 2) Open the project options. Use any of the three methods given below:

- Click on Project->Options for Target  (Fig. 1) 
OR 
- Right-click on the Target 1 in the project window on the left side of the IDE   (Fig. 2) 
OR 
- Simply press ALT-F7 to open the project options:

Fig. 1



 Fig. 2


Step 3) Once the project options window is visible, first click on the Output tab and then click on the empty check box next to Create HEX File. The Output tab should look like Fig. 3. Click on OK and then click on Files->Save All.
  
Fig. 3


Step 4) Now if you build your target, you will see the associated HEX file in the output directory.

IMPORTANT - You must repeat this process for each new project that you create.