aboutsummaryrefslogtreecommitdiff
path: root/contrib/loaders/flash/sh_qspi/Makefile
blob: 2bfbad1b009ef87e9108bca17b5e13fc1695cd92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
CROSS_COMPILE=arm-linux-gnueabihf-
BIN2C = ../../../../src/helper/bin2char.sh

TGT = sh_qspi
ASRC += sh_qspi.S
LDS = sh_qspi.ld

OBJS += $(ASRC:.S=.o)

CC=$(CROSS_COMPILE)gcc
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
LD=$(CROSS_COMPILE)ld
NM=$(CROSS_COMPILE)nm
SIZE=$(CROSS_COMPILE)size

CFLAGS=-Os -Wall -nostartfiles -marm -nostdinc -ffreestanding -mabi=aapcs-linux -mword-relocations -fno-pic -mno-unaligned-access -ffunction-sections -fdata-sections -fno-common -msoft-float -pipe -march=armv7-a -mtune=generic-armv7-a
LDFLAGS=-T$(LDS) -nostdlib -Map=$(TGT).map

all: $(TGT).inc

%.o: %.S
	$(CC) $(CFLAGS) -c $^ -o $@

$(TGT).elf: $(OBJS)
	$(LD) $(LDFLAGS) $^ -o $@

$(TGT).bin: $(TGT).elf
	$(OBJCOPY) $< -O binary $@
	$(NM) -n $(TGT).elf > $(TGT).sym
	$(SIZE) $(TGT).elf

$(TGT).inc: $(TGT).bin
	$(BIN2C) < $< > $@

clean:
	rm -rf *.elf *.hex *.map *.o *.disasm *.sym