Error: invalid value for -march = switch

I wrote a Makefile and I cannot get it to work. I have an option that should choose which processor to compile. However, when I run make from the command line, it says:

 tandex@tandex-P-6860FX :~/emulators/nintendo sdks/3DS SDK [HomeBrew]$ make gcc -march=arm7tdmi -static -fexceptions -fnon-call-exceptions -fstack-check test.c -c test.c:1:0: error: bad value (arm7tdmi) for -march= switch make: *** [ALL] Error 1 

But the man pages for gcc indicate that arm7tdmi is a valid value. Did I miss something?

Makefile:

 #3DS Compilation Makefile (c) TanDex (TEQ)RunawayFreelancers # #Version 0.99 (Alpha) For *nix Devices # #Please Check Back Soon for 3rd SDK #SELECT THE COMPILER TO USE! GCC RECOMMENDED! #FOR SANITY SAKE, USE C FILES WITH GCC AND CPP FILES WITH G++ CC=gcc #CC=g++ #OBJECTCOPY REFERENCE, DO NOT REMOVE OBJC=objcopy OBJREFS= -O Binary #SELECT THE PROCESSOR TO TUNE IT TO. ARMV7 (Nintendo DS) or ARMV9(Nintendo DS (Graphical Support)) #or ARM11 Core ARM1176JZ-S and ARM1176JZF-S (3DS Processor? Not Sure if Correct. Try and see if they Work?) # #NOTE: DS GAMES REQUIRE BOTH A ARM7 AND ARM9 BINARY. RUN THIS TWICE (ONCE FOR EACH) # #UNCOMMENT FOR PROCESOR PROCESSOR=arm7tdmi #PROCESSOR=arm946e-s #PROCESSOR=arm1176jz-s #PROCESSOR=arm1176jzf-s #FILES # #PLACE ALL OF THE FILES HERE, THAT ARE BEING COMPILED! FILES=test.c #SET BIN FILE NAME BASED ON PROCESSOR SELECTED ifeq($(PROCESSOR),arm7tdmi)\ NAME=ARM7.BIN ifeq($(PROCESSOR), arm946e-s)\ NAME=ARM9.BIN ifeq($(PROCESSOR), arm1176jz-s)\ NAME=ARM11.BIN ifeq($(PROCESSOR), arm1176jzf-s)\ NAME=ARM11.BIN #CREATE OBJECTS ifeq($(CC), gcc)\ OBJECTS=$(FILES:.c=.o) ifeq($(CC), g++)\ OBJECTS=$(FILES:.cpp=.o) #FLAGS! DO NOT CHANGE THESE!!!!!!!!!!! THAT MEANS YOU!!!!! # #FOR THOSE WHO WANT TO KNOW WHAT THESE DO, HERE THEY ARE: #-mtune=$(PROCESSOR) FORE THE COMPILER TO TUNE OUTPUT TO THE SPECIFIED PROCESSOR #-static REQUIRED FOR CLEAN BINARY OUTPUT?? (NOT SURE WHAT THIS DOES, BUT WAS SUGESTED ON A POST ON STACKOVERFLOW) #-fexceptions FORCE EXCEPTIONS #-fnon-call-exceptions FORCE EXCEPTIONS TO ONLY BE RETURNED BY THE SYSTEM (MEMORY AND FPU INSTRUTIONS FOR EXAMPLE) #-fstack-check FORCE STACK CHECKING (DS / 3DS USE AWKWARD STACK IMPLEMENTATION) CFLAGS=-march=$(PROCESSOR) -static -fexceptions -fnon-call-exceptions -fstack-check ALL: $(CC) $(CFLAGS) $(FILES) -c .co: $(OBJC) $(OBJREFS) $(OBJECTS) $(NAME) .cpp.o: $(OBJC) $(OBJREFS) $(OBJECTS) $(NAME) 
+4
source share
2 answers

You probably are not calling the correct gcc. It seems you are calling gcc installed on your system, not the one that comes with SDS 3DS.

+5
source

It looks like the problem is related to -march=arm7tdmi .

I think a workaround is to avoid using -march=arm7tdmi ; and use -march=cpu-type , where cpu-type is one of those listed in 3.17.4 GCC ARM Options .

Here is the part of the page:

-march = name

Specifies the name of the target ARM architecture. GCC uses this name to determine what instructions it can emit when generating assembly code. This option can be used in combination with or instead of the -mcpu = parameter. Valid names are: armv2, "Armv2a", "armv3", "armv3m", "armv4", "armv4t", "armv5", "armv5t", "Armv5e", "armv5te", "armv6", "armv6j", "armv6t2", "armv6z", "Armv6kz", "armv6-m", "armv7", "armv7-a", "armv7-r", armv7-m, "Armv7e-m", "armv7ve", "armv8 -a ", armv8-a + crc," iwmmxt ", iwmmxt2," Ep9312.

+1
source

All Articles