31 lines
1.6 KiB
Makefile

#ARM thumb mode
TOOLCHAIN_ARM_T := $(TOOLCHAINENV)/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-
CC_T = $(TOOLCHAIN_ARM_T)gcc
AS_T = $(TOOLCHAIN_ARM_T)as
OBJCOPY_T = $(TOOLCHAIN_ARM_T)objcopy
LD_T = $(TOOLCHAIN_ARM_T)ld.bfd
#For building in thumb mode
CFLAGS_THUMB := -Wall -Werror -MMD -Wno-unused-variable \
-march=armv4t -mthumb -Os -ffreestanding -fno-common \
-fomit-frame-pointer -nostdlib -fno-builtin-printf \
-fno-asynchronous-unwind-tables -fPIE -fno-builtin \
-Idevices/nvidia_shield_t/ \
-fno-exceptions -Wl,--no-dynamic-linker,--build-id=none
all: nvidia_shield_t nvidia_shield_t_reloc
nvidia_shield_t:
[ -d bin/nvidia_shield_t ] || mkdir -p bin/nvidia_shield_t/
$(CC_T) armT_stub.S -c -o bin/nvidia_shield_t/entry.o
$(CC_T) debugger.c -c -o bin/nvidia_shield_t/debugger.o $(CFLAGS_THUMB)
$(LD_T) -T devices/nvidia_shield_t/linkscript.ld bin/nvidia_shield_t/entry.o bin/nvidia_shield_t/debugger.o -o bin/nvidia_shield_t/debugger.elf --just-symbols=devices/nvidia_shield_t/symbols.txt
$(OBJCOPY_T) -O binary bin/nvidia_shield_t/debugger.elf bin/nvidia_shield_t/debugger.bin
nvidia_shield_t_reloc:
[ -d bin/nvidia_shield_t ] || mkdir -p bin/nvidia_shield_t/
$(CC_T) armT_stub.S -c -o bin/nvidia_shield_t/entry.o
$(CC_T) debugger.c -c -o bin/nvidia_shield_t/debugger_reloc.o $(CFLAGS_THUMB)
$(LD_T) -T devices/nvidia_shield_t/linkscript_reloc.ld bin/nvidia_shield_t/entry.o bin/nvidia_shield_t/debugger.o -o bin/nvidia_shield_t/debugger_reloc.elf --just-symbols=devices/nvidia_shield_t/symbols_reloc.txt
$(OBJCOPY_T) -O binary bin/nvidia_shield_t/debugger_reloc.elf bin/nvidia_shield_t/debugger_reloc.bin