|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
unknown switch: /z__MPLAB_BUILD=1
I'm trying to use MPLAB 8.10 with the 2.40 version of the C18 compiler and friends. I can't use 3.20 because the Vex code doesn't compile with it. Everything compiles, but I get stuck on a silly linker error with an unknown switch.
Code:
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\mcc18\lib" "18f8520user.lkr" "user_routines_fast.o" "ifi_startup.o" "ifi_utilities.o" "main.o" "printf_lib.o" "user_routines.o" "C:\laptopVex\Vex_alltimers_wauton_jmpr.lib" /z__MPLAB_BUILD=1 /o"VexUserCode.cof" MPLINK 3.90, LinkerCopyright (c) 2004 Microchip Technology Inc. Error - unknown switch: /z__MPLAB_BUILD=1 Errors : 1 Also, I was reading on the forums that some people compile the code under other IDEs such as Bloodshed or Codeblocks. 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. ![]() |
|
#2
|
|||||
|
|||||
|
Re: unknown switch: /z__MPLAB_BUILD=1
Um, please forgive me if this is stupid, because I know little about the subject, but why are you even invoking the switch in the first place?
Scanning to the far right of the first line ("Executing...") the offending switch is there, and since it is not in quotes it's part of the command line - if you don't know why it is there, then remove it? Don. |
|
#3
|
|||
|
|||
|
Re: unknown switch: /z__MPLAB_BUILD=1
Quote:
![]() So I guess my question should be, how do I get rid of this switch? |
|
#4
|
|||||
|
|||||
|
Re: unknown switch: /z__MPLAB_BUILD=1
You can check to see if that flag is set by default in MPLAB at:
Project -> Build Options -> Project Click on the MPLINK Linker tab to see if it's listed in the global or alternate settings. If it is there, you can remove it. Another alternative of course is to run the linker manually from the DOS window without the flag. A script can run everything for you. Last edited by Mark McLeod : 23-06-2008 at 11:59. |
|
#5
|
|||||
|
|||||
|
Re: unknown switch: /z__MPLAB_BUILD=1
Oh. See, I wasn't lying about not knowing much...
|
|
#6
|
|||
|
|||
|
Re: unknown switch: /z__MPLAB_BUILD=1
I might know even less than Don, and I only have MPLAB 7.20, but hey, I'll take a stab at it. Searching thru the MPLAB Help files, I discovered:
The mcc18.exe compiler uses - command line switches, and mplink uses / command-line switches. There is also no /z command-line option listed in the help file. Also, all the switches have a space after the letter. With a space it doesn't recognize the /z at all. Dropping into the DOS command line (and getting to the correct subdirectory), I tried the /? (list help) command switch. (It was listed in the help file!) No /z listed there, either. Google has few listings, half which point to this thread and the other half to another thread with a similar problem, but asking about a different error. It did have this tidbit: /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 within the command line. It also uses MPLINK 4.15 (not 3.90). Unfortunately the error was for something else, and didn't get to the /z part at all. But that tidbit might be a clue, that the /z is actually two different switches, /z__MPLAB_BUILD and /z__MPLAB_DEBUG, both which are set to 1. Quote:
Code:
MPLINK 3.90, Linker Copyright (c) 2004 Microchip Technology Inc. Error - unknown switch: /z__MPLAB_BUILD=1 Errors : 1 Okay, my guess: the /z is for the newer linker, not the 3.90 version. Somehow you are using the older linker with the newer MPLAB, or for an even newer MPLAB. Check to make sure you installed everything. Second guess: The /z tells the linker to be backward compatable with the older MPLAB's building and debugging. New linker, but linking older files. Conclusion: Either upgrade the Linker or remove the /z. Which is what I was thinking you should have tried (once you knew how) to begin with! ![]() And please, don't forget to tell us what happened! |
|
#7
|
||||
|
||||
|
Re: unknown switch: /z__MPLAB_BUILD=1
Sorry for bringing up a dead topic...but I found a solution
This error is created because you are using MPLAB IDE v. 8.10 with an older MCC18. It thinks that you are using the most recent MCC18. Installing MCC18 4.1 fixes the problem. However, I recall that using this version with the FRC code does not work. Last time I tried (a few months ago) to compile the FRC code with MCC18 4.1, it did not work. So if that is what you are compiling, change the MPLAB that you are using to an older one. |
|
#8
|
||||
|
||||
|
Re: unknown switch: /z__MPLAB_BUILD=1
Quote:
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/*
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unknown device id (0) | paulcd2000 | Programming | 7 | 12-02-2008 19:48 |
| Unknown Device ID(0) | DavidGitz | Control System | 13 | 28-01-2008 20:28 |
| FIRST Unknown | irishninja | General Forum | 4 | 24-04-2006 08:45 |
| Need Help Wiring Micro Switch/Limiting Switch | Windward | Electrical | 2 | 07-02-2006 18:26 |