From 4d46c1907f993211f8cb4871c7c4f12f8b18eea6 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 21 Sep 2021 13:50:01 +0200 Subject: [PATCH] Added CROSS_CC and similar args for maintainers, see Maintainers.md --- CHANGELOG.md | 1 + armsrc/Makefile | 16 ++++++++-------- bootrom/Makefile | 4 ++-- common_arm/Makefile.common | 17 ++++++++--------- doc/md/Development/Maintainers.md | 4 ++-- recovery/Makefile | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb7b89091..5364c2b2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Added `CROSS_CC` and similar args for maintainers, see Maintainers.md (@doegox) - crack5opencl: fix deadlock in wu_queue_destroy() + minor changes on threads.c (@matrix) ## [crimson.4.14434][2021-09-18] diff --git a/armsrc/Makefile b/armsrc/Makefile index 219b176c1..3c2219b96 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -159,7 +159,7 @@ FPGA_COMPRESSOR = ../tools/fpga_compress/fpga_compress all: showinfo $(OBJS) showinfo: - $(info compiler version: $(shell $(CC) --version|head -n 1)) + $(info compiler version: $(shell $(CROSS_CC) --version|head -n 1)) .DELETE_ON_ERROR: @@ -174,7 +174,7 @@ fpga_version_info.c: $(FPGA_BITSTREAMS) $(FPGA_COMPRESSOR) $(OBJDIR)/fpga_all.o: $(OBJDIR)/fpga_all.bit.z $(info [-] GEN $@) - $(Q)$(OBJCOPY) -O elf32-littlearm -I binary -B arm --prefix-sections=fpga_all_bit $^ $@ + $(Q)$(CROSS_OBJCOPY) -O elf32-littlearm -I binary -B arm --prefix-sections=fpga_all_bit $^ $@ $(OBJDIR)/fpga_all.bit.z: $(FPGA_BITSTREAMS) | $(FPGA_COMPRESSOR) $(info [-] GEN $@) @@ -190,19 +190,19 @@ $(FPGA_COMPRESSOR): $(OBJDIR)/fullimage.stage1.elf: $(VERSIONOBJ) $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ) $(info [=] LD $@) - $(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) + $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) $(OBJDIR)/fullimage.nodata.bin: $(OBJDIR)/fullimage.stage1.elf $(info [-] GEN $@) - $(Q)$(OBJCOPY) -O binary -I elf32-littlearm --remove-section .data $^ $@ + $(Q)$(CROSS_OBJCOPY) -O binary -I elf32-littlearm --remove-section .data $^ $@ $(OBJDIR)/fullimage.nodata.o: $(OBJDIR)/fullimage.nodata.bin $(info [-] GEN $@) - $(Q)$(OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=stage1_image $^ $@ + $(Q)$(CROSS_OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=stage1_image $^ $@ $(OBJDIR)/fullimage.data.bin: $(OBJDIR)/fullimage.stage1.elf $(info [-] GEN $@) - $(Q)$(OBJCOPY) -O binary -I elf32-littlearm --only-section .data $^ $@ + $(Q)$(CROSS_OBJCOPY) -O binary -I elf32-littlearm --only-section .data $^ $@ $(OBJDIR)/fullimage.data.bin.z: $(OBJDIR)/fullimage.data.bin | $(FPGA_COMPRESSOR) $(info [-] GEN $@) @@ -214,12 +214,12 @@ endif $(OBJDIR)/fullimage.data.o: $(OBJDIR)/fullimage.data.bin.z $(info [-] GEN $@) - $(Q)$(OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=compressed_data $^ $@ + $(Q)$(CROSS_OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=compressed_data $^ $@ $(OBJDIR)/fullimage.elf: $(OBJDIR)/fullimage.nodata.o $(OBJDIR)/fullimage.data.o ifeq (,$(findstring WITH_NO_COMPRESSION,$(APP_CFLAGS))) $(info [=] LD $@) - $(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-e,_osimage_entry,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ + $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-e,_osimage_entry,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ else $(Q)$(CP) $(OBJDIR)/fullimage.stage1.elf $@ endif diff --git a/bootrom/Makefile b/bootrom/Makefile index 255ebeb1c..0910efe7e 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -44,7 +44,7 @@ version_pm3.c: default_version_pm3.c all: showinfo $(OBJS) showinfo: - $(info compiler version: $(shell $(CC) --version|head -n 1)) + $(info compiler version: $(shell $(CROSS_CC) --version|head -n 1)) tarbin: $(OBJS) $(info [=] GEN $@) @@ -52,7 +52,7 @@ tarbin: $(OBJS) $(OBJDIR)/bootrom.elf: $(VERSIONOBJ) $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ) $(info [=] LD $@) - $(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript-flash,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) + $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -Wl,-T,ldscript-flash,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) clean: $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.o diff --git a/common_arm/Makefile.common b/common_arm/Makefile.common index f5fad1401..50b1eaac5 100644 --- a/common_arm/Makefile.common +++ b/common_arm/Makefile.common @@ -25,10 +25,9 @@ ifeq ($(DEFSBEENHERE),) $(error Can't find Makefile.defs) endif -CC = $(CROSS)gcc -AS = $(CROSS)as -LD = $(CROSS)ld -OBJCOPY = $(CROSS)objcopy +CROSS_CC = $(CROSS)gcc +CROSS_LD = $(CROSS)gcc +CROSS_OBJCOPY = $(CROSS)objcopy OBJDIR = obj @@ -107,21 +106,21 @@ VERSIONOBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(VERSIONSRC))) $(THUMBOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES) $(info [-] CC $<) - $(Q)$(CC) $(CROSS_CFLAGS) $(DEPFLAGS) -mthumb -o $@ $< + $(Q)$(CROSS_CC) $(CROSS_CFLAGS) $(DEPFLAGS) -mthumb -o $@ $< $(Q)$(POSTCOMPILE) $(ARMOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES) $(info [-] CC $<) - $(Q)$(CC) $(CROSS_CFLAGS) $(DEPFLAGS) -o $@ $< + $(Q)$(CROSS_CC) $(CROSS_CFLAGS) $(DEPFLAGS) -o $@ $< $(Q)$(POSTCOMPILE) $(ASMOBJ): $(OBJDIR)/%.o: %.s $(info [-] CC $<) - $(Q)$(CC) $(CROSS_CFLAGS) -o $@ $< + $(Q)$(CROSS_CC) $(CROSS_CFLAGS) -o $@ $< $(VERSIONOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES) $(info [-] CC $<) - $(Q)$(CC) $(CROSS_CFLAGS) -mthumb -o $@ $< + $(Q)$(CROSS_CC) $(CROSS_CFLAGS) -mthumb -o $@ $< # This objcopy call translates physical flash addresses to logical addresses # without touching start address or RAM addresses (.bss and .data sections) @@ -132,7 +131,7 @@ OBJCOPY_TRANSLATIONS = --no-change-warnings \ --change-section-address .commonarea+0 $(OBJDIR)/%.s19: $(OBJDIR)/%.elf $(info [=] GEN $@) - $(Q)$(OBJCOPY) -Osrec --srec-forceS3 --strip-debug $(OBJCOPY_TRANSLATIONS) $^ $@ + $(Q)$(CROSS_OBJCOPY) -Osrec --srec-forceS3 --strip-debug $(OBJCOPY_TRANSLATIONS) $^ $@ # easy printing of MAKE VARIABLES print-%: ; @echo $* = $($*) diff --git a/doc/md/Development/Maintainers.md b/doc/md/Development/Maintainers.md index 9af92bf72..234d2445e 100644 --- a/doc/md/Development/Maintainers.md +++ b/doc/md/Development/Maintainers.md @@ -51,9 +51,9 @@ For verbose usage and see the actual commands being executed, add `V=1`. `CFLAGS` and `LDFLAGS` can be overriden by environment variables for client-side components. -`CROSS_CFLAGS` and `CROSS_LDFLAGS` can be overriden by environment variables for ARM-side components. +Default compiler is gcc but you can use clang for the non-ARM parts with e.g. `make client CC=clang CXX=clang++ LD=clang++`. Note that `CC`, `CXX` and `LD` must be provided as explicit arguments, they won't be overriden by environment variables. -Default compiler is gcc but you can use clang for the non-ARM parts with e.g. `make client CC=clang CXX=clang++ LD=clang++`. +Similarly, for ARM-side components, `CROSS_CFLAGS` and `CROSS_LDFLAGS` can be overriden by environment variables and `CROSS_CC`, `CROSS_LD` and `CROSS_OBJCOPY` can be provided as explicit arguments. If your platform needs specific lib/include paths for the client, you can use `LDLIBS` and `INCLUDES_CLIENT` *as envvars*, e.g. `LDLIBS="-L/some/more/lib" INCLUDES_CLIENT="-I/some/more/include" make client ...` diff --git a/recovery/Makefile b/recovery/Makefile index e6e3f7041..efa7b4af9 100644 --- a/recovery/Makefile +++ b/recovery/Makefile @@ -21,11 +21,11 @@ all: $(BINS) bootrom.bin: ../bootrom/obj/bootrom.elf $(info [=] GEN $@) - $(Q)$(OBJCOPY) --gap-fill=0xff --pad-to 0x00102000 -O binary $^ $@ + $(Q)$(CROSS_OBJCOPY) --gap-fill=0xff --pad-to 0x00102000 -O binary $^ $@ fullimage.bin: ../armsrc/obj/fullimage.elf $(info [=] GEN $@) - $(Q)$(OBJCOPY) --gap-fill=0xff -O binary $^ $@ + $(Q)$(CROSS_OBJCOPY) --gap-fill=0xff -O binary $^ $@ proxmark3_recovery.bin: bootrom.bin fullimage.bin $(info [=] GEN $@)