In this tutorial we will see how to setup a keil5 project to generate .bin file for Explore M3(LPC1768)

Check this link to setup keil4 from generating .bin file.

Keil5 Setup00.png

Keil5 software can be downloaded form Keil website. Along with Keil5 you need to install Legacy support for ARM Cortex-M devices.
Once the softwares are installed, follow the below steps to setup Keil project.


Keil Setup Steps

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

Step2: Browse to your project folder and provide the project name and click on save.
Keil5 Setup02.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.
Keil5 Setup03.png

Step4: Select the controller(NXP:LPC1768) and click on OK.
Keil5 Setup04.png

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

Step6: Create a new file to write the program.
Keil5 Setup06.png

Step7: Type the code or Copy paste the below code snippet.
Keil5 Setup07.png

Step8: After typing the code save the file as main.c.
Keil5 Setup08.png

Step9: Add the recently saved file to the project.
Keil5 Setup09.png

Step10: Add the main.c along with system_LPC17xx.c.
Keil5 Setup10.png

Step11: Build the project and fix the compiler errors/warnings if any.
Keil5 Setup11.png

Step12: Code is compiled with no errors. The .bin file is still not generated.
Keil5 Setup12.png

Setup Bin File Generation

Step13: Click on Target Options to select the option for generating .bin file.
Keil5 Setup13.png

Step14: Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so application should start from 0x2000
Keil5 Setup21.png

Step15: Write the command to generate the .bin file from .axf file
Command: fromelf --bin LedBlink.axf --output LedBlink.bin
Keil5 Setup22.png

Step16: Now enable the linker option to use the IROM1 address from target settings
Keil5 Setup23.png

Step17: .Bin file is generated after a rebuild.
File:Keil5 Setup24.png

Step18: Check the project folder for the generated .Bin<ER_ROM1> file.
File:Keil5 Setup25.png


Uploading the Bin file

After generating the .bin file check this tutorial for Uploading Hex and Bin files..

Downloads

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