In this tutorial we will see how to setup a keil project to generate .bin file for LPC1768
Keil Setup Steps
Step1: Open the Keil software and select the New Microvision project from Project Menu as shown below.
Step2: Browse to your project folder and provide the project name and click on save.
Step3: Once the project is saved a new pop up “Select Device for Target” opens, Select the controller(NXP:LPC2148) and click on OK.
Step4: As LPC2148 needs the startup code, click on Yes option to include the Startup file.
Step5: Create a new file to write the program.
Step6: Type the code or Copy paste the below code snippet.
Step7: After typing the code save the file as main.c.
Step8: Add the recently saved file to the project.
Step9: Add the main.c to the project.
Step10: Build the project and fix the compiler errors/warnings if any.
Step11: Code is compiled with no errors. The .bin file is still not generated.
Setup Bin File Generation
Step13: Click on Target Options to select the option for generating .bin file.
Step14: Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so application should start from 0x2000
Step15: Write the command to generate the .bin file from .axf file
Command: fromelf --bin LedBlink.axf --output LedBlink.bin
Step16: Now enable the linker option to use the IROM1 address from target settings
Step17: .Bin file is generated after a rebuild.
Step18: Check the project folder for the generated .Bin<ER_ROM1> file.
Uploading the Bin file
After generating the .bin 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!