|Speaking about healthier, the Texas air was sooooooooo much cleaner than NJ air, I felt my life expectancy being extended another 5 years. - The Chinese Guy [more]|
|Thread Tools||Rate Thread||Display Modes|
Using Eclipse IDE & makefile as MPLAB replacement
Sorry for the long post, but I hope this is useful to someone who wants to use Eclipse to develop their robot software. It would have helped me.
To configure the open source Eclipse IDE as a replacement for MPLAB on a Windows platform, here are the steps I used:
- Download and install the Eclipse Platform SDK (3.0 or greater) from http://www.eclipse.org. This is the basic IDE which is only setup for Java code development.
- Download and install the Eclipse C/C++ Development Tools (CDT) from http://www.eclipse.org/cdt/. This is a plug-in that will tailor Eclipse for C code development.
- Download and install a copy of a "make" utility. I used GNU make that somebody compiled for windows (http://www.steve.org.uk/software/make/), but you might find other versions. Microsoft's nmake might also work, but I
haven't tried it.
- Set your "path" environment variable for mpasm, mcc18\bin and gmake. I used: C:\Progra~1\mcc18\mpasm;C:\Progra~1\mcc18\bin;C:\P rogra~1\gmake. Note that make sometimes has problems with spaces in path names, so it is best to use the DOS 8.3 alias (i.e. "Progra~1" instead of "Program Files").
- Create a file called "makefile" in the folder with your C source code. You can tailor the one below (also attached) to your liking. Be sure to replace multiple spaces at the beginning of lines with <tabs> if you cut and paste. A make manual is located at: http://www.gnu.org/software/make/manual/make.html
- Verify your makefile is working well from a DOS command prompt by trying "make clean" and "make all" commands.
- Start Eclipse and create a new Standard Make C Project and select options as follows:
- Fill in project name and uncheck the "Use default" box to set the directory to point to your robot code.- Try a Project > Clean and a Project > Build All commands and see if your code builds properly. Any code errors should show up in the Problems tab of the console window and you can click on an error and be taken to that point in the code just like in MPLAB. If you have makefile problems, you can edit it from within Eclipse.
That's it. I know everybody has their favorite IDE, but for those who like Eclipse, this will give you all the functionality of MPLAB with the exception of the simulator.
Software Mentor / Volunteer
Team 1329: GO ROBOREBELS!
#************** Example Makefile ***********************
# Manual makefile to go with Eclipse
# NOTE: enviornment variables must be set to find linker & compiler.
# NOTE: runs with GNU Make. Might also run with Microsoft nmake
# with tweaks.
# This Makefile will compile any .c file in the current directory and link the
# objects into a .hex file to load into the robot.
# Rename this file "makefile" and put in your C source code folder.
# The OBJFILES variable is filled with .o targets using the wildcard
# command and patsubst. The $(wildcard *.c) will retrieve any .c
# file in the current directory and store it in a variable. The patsubstr
# functions is used to convert a file from one format to another. In
# this case each .c file is converted into a .o extension and then
# stored into OBJFILES. This variable is then used to compile each .c file.
# The rule %.o: %.c rebuilds any .o file if the cooresponding .c file has
# In the compile line you will see two variables $@ and $<.
# $@ will match the target and the $< will match the dependency. So, for
# example, $< will contain main.c whenever $@ contains main.o.
# Note: makefiles are counterintuitive in that the rules don't run in the order
# listed in the file, but instead run whenever they are matched.
# Also be careful with tabs and spaces. Rules need a tab (not spaces)
# before each action.
#RENAME AS NEEDED
#del for windows, rm for unix
RM := del /F
LINKER = mplink
CC = mcc18
CFLAGS = -i"C:PROGRA~1\mcc18\h" -nw=2066
DEFINES = -D_FRC_BOARD -D_PRIORY_CAMERA
#optimization parameters (default = full optimization)
OPT_DEBUG=-Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
#make a list of object files that match all C files
OBJFILES := $(patsubst %.c,%.o,$(wildcard *.c))
COMPILE=$(CC) $(PICFLAG) $< -fo=$@ $(CFLAGS) $(DEFINES) $(OPT)
#re-link if any object file changed
$(LINKER) "18f8520user.lkr" $(OBJFILES) "FRC_library.lib" /l $(LIB_PATH) /m $(PROJECT).map /o $(PROJECT).hex# Recompile a file if it's c-file changes,
# OR recompile everything if ANY header file changes
%.o: %.c *.h
$(COMPILE)#delete all the build files so you can start from scratch.
|Display Modes||Rate This Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|MPLAB IDE HELP||Idaman323||Programming||2||02-16-2005 06:01 PM|
|MPLAB IDE 6.60 Error||mchan1111||Programming||8||11-08-2004 08:17 PM|
|Error message in MPLAB IDE||dddriveman||Programming||11||03-18-2004 06:34 AM|
|MPLAB IDE Project Specs||Raven_Writer||Programming||18||01-19-2004 03:53 PM|
|using the MPLAB IDE MPLAB SIM simulator||WizardOfAz||Programming||1||11-03-2003 01:24 AM|