View Single Post
  #8   Spotlight this post!  
Unread 29-07-2008, 14:58
ay2b's Avatar
ay2b ay2b is offline
Registered User
AKA: Andy
FRC #2928
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 1994
Location: Seattle, WA
Posts: 211
ay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant future
Re: unknown switch: /z__MPLAB_BUILD=1

Quote:
Originally Posted by antiNeo View Post
Is there a way I can compile the code without an IDE altogether, with like a makefile or something? I'm using VIM for editing and I only use MPLAB to click the build button. A plain old command based method would make my day.
Here's the Makefile which I use (you will need to modify this):

Code:
CC  	= /opt/mcc18-3.10/bin/mcc18.exe
LINKER	= /opt/mcc18-3.10/bin/mplink.exe

# Enable/Disable optimizations with these switches and '+' or '-':
#  -O     all optimizations
#  -Oi    integer promotion
#  -Om    duplicate string merging
#  -On    banking optimizer
#  -Ou    unreachable code removal
#  -Os    code straightening
#  -Ot    tail merging
#  -Ob    branch optimizations
#  -Od    dead code removal
#  -Opa   procedural abstraction
#  -Op    copy propagation
#  -Or    redundant store elimination
#  -Oa    default data in access memory
#  -Ow    WREG tracking

PIC		= 8722
#CFLAGS	= -p=18F$(PIC) -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066
CFLAGS	= -p=18F$(PIC) -O+ -nw=2066
INCLUDE	= /i"C:\mcc18-31\h"
INCPATH = /opt/mcc18-3.10/h
DEFS	= -D_FRC_BOARD -D_DEBUG
#DEFS	= -D_FRC_BOARD

LFLAGS	= /w /l"C:\mcc18-31\lib"
LKRFILE	= "18f$(PIC).lkr"
LIBFILE	= "ifi_frc_$(PIC)_30.lib"
FRCCODE	= "Team980"

SOURCES	= \
	autonomous.c \
	disabled.c \
	encoders.c \
	ifi_frc.c \
	imu.c \
	interrupts_ajy.c \
	pid.c \
	pwm.c \
	quick_adc.c \
	robot.c \
	serial_ports.c \
	teleop.c \
	time.c \
	utils.c \

OBJS := $(patsubst %.c, %.o, $(SOURCES))
DEPS := $(patsubst %.o, %.d, $(OBJS))

default : $(FRCCODE).hex

clean :
	$(RM) *.err $(OBJS) $(FRCCODE).hex $(FRCCODE).cod $(FRCCODE).cof $(FRCCODE).lst $(FRCCODE).mcs

%.o : .deps/%.d

.c.o :
	nice gcc -nostdinc -isystem $(INCPATH) -M -MP -D__18F$(PIC) $(DEFS) $< -MF .deps/$*.d
	nice $(CC) $(INCLUDE) $(CFLAGS) $(DEFS) -fo="$@" $<

$(FRCCODE).hex : $(FRCCODE).cof

$(FRCCODE).cof : ${OBJS}
	$(LINKER) $(LFLAGS) $(LKRFILE) $(OBJS) $(FRCLIB) $(LIBFILE) /o"$@"
	@echo *.err

download : ${FRCCODE}.cof
	rigel ${FRCCODE}.hex
	tail -f /dev/ttyS0 | tee running.log

test :
	tail -f /dev/ttyS0 | tee running.log

.deps/%.d : %.c
	gcc -nostdinc -isystem $(INCPATH) -M -MP -D__18F$(PIC) $(DEFS) $< -MF .deps/$*.d

.deps/*:
	@mkdir -p .deps

-include .deps/*
I'm using this under Linux, so I'm using "gcc" to build a dependency list (i.e. so that when you modify a header file, it will recompile, and the list of which header files are included in which .c files is automatically updated). If you don't have gcc installed, you can pull that functionality out. You may also need to adjust the paths to the compiler and linker; you will certainly need to change the list of source files.
__________________

2011 - SD Quarterfinalists (980), LA Quarterfinalists (980)
2010 - LA (2404) Finalists (980), AZ Motorola Quality (980)
2009 - LA Semifinalists (980); Las Vegas Quarterfinalists (980); SD (2404); IRI #1 Seed, Finalist (980)
2008 - SD Quarterfinalists (980), LA Champions (980), LA Rookie Inspiration Award (2404); CalGames Finalists
2007 - So.Cal Finalists (980), SD Quarterfinalists (980); CalGames Finalists
2006 - So.Cal Regional Champion (4), Toronto Judge's Award Day 1 (4)
2005 - SVR Champions, Delphi "Driving Tomorrow's Technology" (980); AZ Xerox Creativity (980); So.Cal Finalists, RadioShack Innovation in Control (980); Championship Archimedes Division Semifinalists; IRI Finalists (980)
2004 - So.Cal Regional Champions, Leadership in Controls (980); AZ GM Industrial Design (980); Championship Galileo Division #2 Seed; IRI Champions
2003 - PNW Semi-finalists (488)
2002 - PNW Finalists (488)
2000 - X-bot / 488 - Mentor / Founder
1994 - Sunny Delight - Driver - champion