custom makefile working!

stable
Penguin 5 years ago
parent 068e16b549
commit 5de15568a0

@ -0,0 +1 @@
((nil . ()))

@ -4,39 +4,25 @@
# @file
# @version 0.1
NAME=oracle_e54_ed
PNAME=oracle_e54_ed
TOOLCHAIN=arm-none-eabi-
CC=gcc
print-% : ; @echo $* = $($*)
#DIR_INCLUDES = \
#-I"./" \
-I"./config" \
-I"./hal/include" \
-I"./hal/utils/include" \
-I"./hpl/cmcc" \
-I"./hpl/core" \
-I"./hpl/dmac" \
-I"./hpl/eic" \
-I"./hpl/gclk" \
-I"./hpl/mclk" \
-I"./hpl/osc32kctrl" \
-I"./hpl/oscctrl" \
-I"./hpl/pm" \
-I"./hpl/port" \
-I"./hpl/ramecc" \
-I"./hpl/sercom" \
-I"./hpl/tc" \
-I"./hri" \
-I"./CMSIS/Core/Include" \
-I"./include"
#INC=$(shell find . -type f -name '*.h' -printf "-I\"./%h\" \\\ \n" | sort -u)
#INC=$(shell find . -type f -name '*.h' -printf "-I\"./%h\"\0" | sort -zu | sed -z 's/$/\n/')
# Output Targets
TARGET_HEX = $(PNAME).hex
TARGET_A = $(PNAME).a
TARGET_BIN = $(PNAME).bin
TARGET_LSS =$(PNAME).lss
TARGET_EEP =$(PNAME).eep
TARGET_MAP =$(PNAME).map
TARGET_SREC = $(PNAME).srec
TARGET_ELF = $(PNAME).elf
INC=$(shell find . -type f -name '*.h' -printf '-I./%h\0' | uniq -z | sort -zu | tr '\0' ' ')
OUTPUT_FILE_NAME=$(NAME)
OUTPUT_FILE_NAME=$(PNAME)
OUTPUT_FILE_PATH+=$(OUTPUT_FILE_NAME).elf
SRC:=$(shell find ./ -type f -name '*.c')
@ -50,8 +36,38 @@ all: $(OUTPUT_FILE_PATH)
$(OUTPUT_FILE_PATH): $(OBJ)
@echo Building target: $@
@echo Invoking: ARM/GNU Linker
"$(TOOLCHAIN)$(CC)" -o $(OUTPUT_FILE_NAME).elf $(OBJ)
#"$(TOOLCHAIN)$(CC)" -o $(OUTPUT_FILE_NAME).elf $(OBJ) -Wl,\
#--start-group -lm -Wl,\
#--end-group -mthumb Wl,\
#--map="./gcc/$(OUTPUT_FILE_NAME).map" \
#--specs=nano.specs -Wl, --gc-sections -mcpu=cortex-m4 \
#-T"./gcc/gcc/same54p20a_flash.ld" \
#-L"./gcc/gcc"
#"arm-none-eabi-objcopy" -O binary "$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).bin"
#"arm-none-eabi-objcopy" -O ihex -R .eeprom -R .fuse -R .lock -R .signature \
# "$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).hex"
#"arm-none-eabi-objcopy" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma \
# .eeprom=0 --no-change-warnings -O binary "$(OUTPUT_FILE_NAME).elf" \
# "$(OUTPUT_FILE_NAME).eep" || exit 0
#"arm-none-eabi-objdump" -h -S "$(OUTPUT_FILE_NAME).elf" > "$(OUTPUT_FILE_NAME).lss"
#"arm-none-eabi-size" "$(OUTPUT_FILE_NAME).elf"
"arm-none-eabi-gcc" -o $(OUTPUT_FILE_NAME).elf $(OBJS_AS_ARGS) -Wl,\
--start-group -lm -Wl,--end-group -mthumb \
-Wl,-Map="$(OUTPUT_FILE_NAME).map" --specs=nano.specs -Wl,\
--gc-sections -mcpu=cortex-m4 \
-T"./gcc/gcc/same54p20a_flash.ld" \
-L"./gcc/gcc"
@echo Finished building target: $@
"arm-none-eabi-objcopy" -O binary "$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).bin"
"arm-none-eabi-objcopy" -O ihex -R .eeprom -R .fuse -R .lock -R .signature \
"$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).hex"
"arm-none-eabi-objcopy" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma \
.eeprom=0 --no-change-warnings -O binary "$(OUTPUT_FILE_NAME).elf" \
"$(OUTPUT_FILE_NAME).eep" || exit 0
"arm-none-eabi-objdump" -h -S "$(OUTPUT_FILE_NAME).elf" > "$(OUTPUT_FILE_NAME).lss"
"arm-none-eabi-size" "$(OUTPUT_FILE_NAME).elf"
# compiler targets
%.o: %.c
@echo Building file: $<
@ -85,4 +101,11 @@ $(OUTPUT_FILE_PATH): $(OBJ)
# Detect changes in the dependent files and recompile the respective object files.
clean:
rm -f $(OBJ)
rm -f $(OUTPUT_FILE_PATH)
rm -f $(OUTPUT_FILE_NAME).a $(OUTPUT_FILE_NAME).hex $(OUTPUT_FILE_NAME).bin \
$(OUTPUT_FILE_NAME).lss $(OUTPUT_FILE_NAME).eep $(OUTPUT_FILE_NAME).map \
$(OUTPUT_FILE_NAME).srec
# end