Using CodeLite with the LPC1343: Part 1
How to setup a new project and build your firmware using GCC and the CodeLite IDE
This tutorial will walk you through the process of opening a copy of the LPC1343 Code Base in CodeLite, making some small changes to the code, and then building and deploying the compiled firmware to the board using either a Segger J-Link or the USB bootloader.
Step One: Open the Workspace in CodeLite
Once you have downloaded a copy of the LPC1343 Code Base to your PC, you can load the CodeLite IDE and open the pre-configured workspace by selecting the 'Workspace > Switch to Workspace ...' menu item. Browse to the '/build/codelite' folder in the LPC1343 Code Base and open the file with a .workspace extension.
You should see a handful of folders in the Workspace tab which contain all of the files that are part of the LPC1343 Code Base, such as the peripheral and additional hardware drivers, the Make and startup files, etc.
Step Two: Make Sure that Custom Build is Properly Configured
By default, the project is configured to work with the free Yagarto toolchain. The Yagarto Tools and Yagarto Toolchain packages includes all of the tools you need to build your firmware, including Make and the GNU GCC cross-compiler, linker, etc. for ARM. The entire build process is controlled by a single Makefile in the root directory of the LPC1343 Code Base called "Makefile". You can see (and modify) this file in the "root" folder in CodeLite.
To make sure that the project is configured to use the right tools, right-click on the project name (LPC1343_CodeBase) in the left-hand Workspace tab, and select 'Settings...' from the popup menu. Inside the Project Settings dialogue, switch to the 'Custom Build' tab, as seen below:
Make sure that the 'Working Directory' is set to '$(WorkspacePath)/../../'. This is necessary since the actual Makefile and working directory are both two levels higher than the CodeLite project (located at '/build/codelite').
If you get an errors when building that some variant of "make.exe" could not be found (likely mingw) you can fix this by going into the "Settings > Build Settings ..." menu and selecting the Build Systems tab. Change the Build Tool to 'make.exe' (see the image below), and you should be able to build and clean your projects normally:
Step Three: Build Your Project
In order to test the firmware, we will make a small change in main.c, adjusting the delay of the blinking LED from 1 second to 3 seconds. This can be done by opening 'main.c' in the root folder, and changing the following code:
Changing the LED Blink Delay
// Toggle LED @ 1 Hz
// Blink LED every three seconds
Note: In order for this test to work, you will need to make sure that "#define CFG_INTERFACE" is commented out in projectconfig.h before compiling.
Next, you can save the file by typing CTRL+S, or with the 'File > Save all files' menu item. To build the entire project, simply right-click on the project name in the left-hand workspace explorer and select 'Build' from the popup-menu:
This will cause 'make' to interpret and execute the Makefile located in the project root, and you should be able to see the results of the compilation process in the build output window:
If you look in the root folder of your project, you should find a number of temporary files as well as the compiled .bin, .elf and .hex binaries. (Three difference formats of compiled code are provided since different tools use different file formats. The .bin file is used by the USB bootloader, the .hex file can be used by FlashMagic to flash the device over UART, and .elf is the native format created by the GCC toolchain.)