Monday, January 2, 2012

Compile Code for the mbed from the LPCXpresso IDE

Recently I found myself working on an robotics system with an mbed. I was offline, and didn't want to use mbed's IDE for development. Plus, I already had LPCXpresso running on my computer. Browsing around, it seemed fairly simple to compile code for the mbed from LPCXpresso. Basically, after setting up a project with the correct target processor (in my case the LPC1768), follow these simple steps.

The Steps to Build a Binary File for mbed from LPCXpresso

  1. Build your project
  2. Browse in the Project Explorer to 'Debug' folder of your project where the .axf file can be found
  3. Right click on the .axf, then select 'Binary Utilities->Create Binary'
Pretty simple, eh? You should now see a .bin file with the same name as your .axf file that you can now throw onto your mbed via the USB Mass Storage Device bootloader already on the mbed. Great, now what about automatically building the binary file when you build your project? Easy enough!

The Steps to Automatically Generate a Binary File for mbed from LPCXpresso

  1. Open your project properties (can be done by right clicking on your project in the Project Explorer, and selecting 'Properties' from the popup menu)
  2. In the treeview on the left, select 'C/C++ General'->'Settings'
  3. Select the 'Build Steps' tab
  4. Remove/delete the '#' character in the Post-build steps Command box (thus uncommenting the already included command for generating a binary file)
  5. Repeat for all configurations desired, apply changes, and you're done!
Now, when you build your project in LPCXpresso, you will be left with a .bin file in the Debug folder that you can throw and run on an mbed!

1 comment :