forked from dhansel/pigfx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.standalone
68 lines (48 loc) · 1.79 KB
/
Makefile.standalone
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ARMGNU ?= arm-none-eabi
CFLAGS = -Wall -Wextra -O0 -g -nostdlib -nostartfiles -fno-stack-limit -ffreestanding -mfloat-abi=hard -march=armv6j -mtune=arm1176jzf-s -mhard-float -mfpu=vfp -DSTANDALONE_TERMINAL
## Important!!! asm.o must be the first object to be linked!
OOB = asm.o pigfx.o uart.o irq.o utils.o timer.o framebuffer.o postman.o console.o gfx.o dma.o nmalloc.o uspios_wrapper.o ee_printf.o raspihwconfig.o stupid_timer.o binary_assets.o bell.o
BUILD_DIR = build
SRC_DIR = src
BUILD_VERSION = RunCPM#$(shell git describe --all --long | cut -d "-" -f 3)
OBJS=$(patsubst %.o,$(BUILD_DIR)/%.o,$(OOB))
LIBGCC=$(shell gcc -print-libgcc-file-name)
LIBUSPI=uspi/lib/libuspi.a
all: pigfx.elf pigfx.hex kernel
# ctags src/
@echo "Standalone terminal version"
$(SRC_DIR)/pigfx_config.h: pigfx_config.h.in
@sed 's/\$$VERSION\$$/$(BUILD_VERSION)/g' pigfx_config.h.in > $(SRC_DIR)/pigfx_config.h
@echo "Creating pigfx_config.h"
run: pigfx.elf
./launch_qemu.bash
kernel: pigfx.img
cp pigfx.img bin/kernel.img
debug: pigfx.elf
cd JTAG && ./run_gdb.sh
dump: pigfx.elf
@$(ARMGNU)-objdump --disassemble-zeroes -D pigfx.elf > pigfx.dump
@echo "OBJDUMP $<"
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.c
@$(ARMGNU)-gcc $(CFLAGS) -c $< -o $@
@echo "CC $<"
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.s
@$(ARMGNU)-as -mfloat-abi=hard -march=armv6j -mfpu=vfp -defsym STANDALONE_TERMINAL=1 $< -o $@
@echo "AS $<"
%.hex : %.elf
@$(ARMGNU)-objcopy $< -O ihex $@
@echo "OBJCOPY $< -> $@"
%.img : %.elf
@$(ARMGNU)-objcopy $< -O binary $@
@echo "OBJCOPY $< -> $@"
pigfx.elf : $(SRC_DIR)/pigfx_config.h $(OBJS) $(LIBUSPI)
@$(ARMGNU)-ld $(OBJS) $(LIBGCC) $(LIBUSPI) -T memmap -o $@
@echo "LD $@"
.PHONY clean :
rm -f $(SRC_DIR)/pigfx_config.h
rm -f $(BUILD_DIR)/*.o
rm -f *.hex
rm -f *.elf
rm -f *.img
rm -f *.dump
rm -f tags