OpenCores
URL https://opencores.org/ocsvn/softavrcore/softavrcore/trunk

Subversion Repositories softavrcore

[/] [softavrcore/] [trunk/] [build/] [Makefile] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 apal
SHELL=/bin/sh
2
 
3
CC=avr-gcc
4
AS=avr-as
5
AR=avr-ar
6
OBJCOPY=avr-objcopy
7
OBJDUMP=avr-objdump
8
CHMOD=chmod
9
 
10
ARCH = avr2
11
ARCH_LIB = crt0.o
12
 
13
AFLAGS=-mmcu=$(ARCH)
14
#CFLAGS=-mmcu=$(ARCH) -D__COMPILING_AVR_LIBC__ -Wall -pedantic -O3
15
CFLAGS=-mmcu=$(ARCH) -D__COMPILING_AVR_LIBC__ -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wno-unused-function -O3
16
LDFLAGS=-mmcu=$(ARCH)
17
 
18
PMEM_DEPTH=10
19
PMEM_WORDS=$(shell echo $$((1<<$(PMEM_DEPTH))))
20
PMEM_SIZE=$(shell echo $$((2<<$(PMEM_DEPTH))))
21
 
22
PROGMEM=../util/progmem-ice40.sh
23
#PROGMEM=../util/progmem-generic.sh
24
 
25
.PHONY: all clean
26
 
27
TARGETS=main.disasm main.mem flash_array.v main.instr main.v
28
 
29
all: $(TARGETS)
30
 
31
crt0.o: crt0.s
32
        $(AS) $(AFLAGS) -o crt0.o crt0.s
33
 
34
main.o: main.c
35
        $(CC) $(CFLAGS) -c main.c
36
 
37
main.elf: main.o $(ARCH_LIB)
38
        $(CC) $(LDFLAGS) -o main.elf main.o $(ARCH_LIB)
39
 
40
main.hex: main.elf
41
        $(OBJCOPY) -j .text -j .data -O ihex main.elf main.hex
42
 
43
main.bin: main.elf
44
        $(OBJCOPY) -j .text -j .data -O binary main.elf main.bin
45
        $(CHMOD) -x main.bin
46
 
47
main.mem: main.bin
48
        cat main.bin /dev/zero | head -c $(PMEM_SIZE) | hexdump -v -e '/2 "%.4x\n"' > main.mem
49
 
50
flash_array.v: main.mem
51
        awk '{ printf("flash_array[%d]=16%ch%s;\n",n,39,$$1);n++; }' < main.mem > flash_array.v
52
 
53
main.disasm: main.elf
54
        $(OBJDUMP) -s -m $(ARCH) -d main.elf > main.disasm
55
 
56
main.instr: main.disasm
57
        expand < main.disasm | grep -v "file format" | awk '{ if ( substr($$1,length($$1))==":" ) print substr($$0,25,8); }' | sort | uniq | awk '{ print $$1; }' > main.instr
58
 
59
main.v: main.bin
60
        $(PROGMEM) --depth $(PMEM_DEPTH) --name flash main.bin > main.v
61
 
62
clean:
63
        rm -f $(TARGETS) *.o *.elf *.mem *.disasm *.hex *.bin

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.