Go to Post When the going gets tough, the smart keep their GP. - Libby K [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-06-2008, 00:44
antiNeo antiNeo is offline
Registered User
FRC #1569
 
Join Date: Jan 2008
Location: Pocatell, Idaho
Posts: 17
antiNeo has a spectacular aura aboutantiNeo has a spectacular aura about
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
I don't get this error in MPLAB 7.20, but I don't want to have to install 7.20 because I also need to be able to compile code based on Kevin's FRC framework. Is there some way I could get rid of this switch? What does it do anyway?

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   Spotlight this post!  
Unread 22-06-2008, 17:03
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,998
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
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.
__________________

I am N2IRZ - What's your callsign?
  #3   Spotlight this post!  
Unread 22-06-2008, 23:21
antiNeo antiNeo is offline
Registered User
FRC #1569
 
Join Date: Jan 2008
Location: Pocatell, Idaho
Posts: 17
antiNeo has a spectacular aura aboutantiNeo has a spectacular aura about
Re: unknown switch: /z__MPLAB_BUILD=1

Quote:
Originally Posted by Don Rotolo View Post
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?
Uh... MPLAB put it there and... umm... I'm not sure how to remove it.

So I guess my question should be, how do I get rid of this switch?
  #4   Spotlight this post!  
Unread 23-06-2008, 11:47
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 23-06-2008 at 11:59.
  #5   Spotlight this post!  
Unread 23-06-2008, 19:32
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,998
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: unknown switch: /z__MPLAB_BUILD=1

Quote:
Originally Posted by antiNeo View Post
Uh... MPLAB put it there and... umm... I'm not sure how to remove it.
Oh. See, I wasn't lying about not knowing much...
__________________

I am N2IRZ - What's your callsign?
  #6   Spotlight this post!  
Unread 24-06-2008, 09:11
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 685
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
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:
Originally Posted by antiNeo
I don't get this error in MPLAB 7.20
I did get the error, and as a matter of fact, it's the same linker:
Code:
MPLINK 3.90, Linker
Copyright (c) 2004 Microchip Technology Inc.
Error - unknown switch: /z__MPLAB_BUILD=1
Errors    : 1
(I like to check everything, just to be sure. Now added to the list: If Don says sun rises in east, check to be sure! (sorry Don!) )

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   Spotlight this post!  
Unread 25-07-2008, 13:18
Los Frijoles's Avatar
Los Frijoles Los Frijoles is offline
Stormin' Mormon
AKA: Kevin Cuzner
FRC #2062 (C.O.R.E.)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Waukesha, WI
Posts: 27
Los Frijoles has a spectacular aura aboutLos Frijoles has a spectacular aura about
Send a message via AIM to Los Frijoles
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.
__________________
Community Of Robotic Engineers 2062





Blender totally pwns 3DS Max...

My life is here and here.

Cuznersoft Hardware and Software Development
  #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
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 00:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi