~increscent/rk3128-brom

ref: fa29de59579d123e2d47f6938bb41cb818e548f3 rk3128-brom/uart/Makefile -rw-r--r-- 1.1 KiB
fa29de59 — Robert Williams Created DRAM version 4 months ago
                                                                                
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
38
39
40
41
42
43
44
45
46
47
48
49
CROSS_COMPILE=arm-none-eabi-
CC=$(CROSS_COMPILE)gcc
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
ARM_ELF_FLAGS = -Og -g -marm -Wall -nostdlib -mcpu=cortex-a7

all: uart.bin uart_dram.bin

uart_dram.bin: uart_dram.elf uart_dram.list
	$(OBJCOPY) -O binary \
		--only-section .text \
		--only-section .rodata \
		uart_dram.elf uart_dram.bin

uart.bin: uart.elf uart.list
	$(OBJCOPY) -O binary \
		--only-section .text \
		--only-section .rodata \
		uart.elf uart.bin

uart.list: uart.elf
	$(OBJDUMP) -D uart.elf > uart.list

uart_dram.list: uart_dram.elf
	$(OBJDUMP) -D uart_dram.elf > uart_dram.list

uart.o: uart.rs bits.rs
	rustc --emit obj -C opt-level=2 --target=armv7a-none-eabi -o uart.o uart.rs

uart.elf: uart.o entry.S uart.lds
	$(CC) $(ARM_ELF_FLAGS) uart.o entry.S -o uart.elf -T uart.lds

uart_dram.elf: uart.o entry.S uart_dram.lds
	$(CC) $(ARM_ELF_FLAGS) uart.o entry.S -o uart_dram.elf -T uart_dram.lds

.PHONY: reset
reset:
	nrfjprog --family nrf52 -r

.PHONY: flash
flash: uart.bin
	nrfjprog --family nrf52 -e
	nrfjprog --family nrf52 --program uart.bin
	nrfjprog --family nrf52 -r

.PHONY: clean
clean:
	rm -f *.o *.elf *.list *.bin