blob: 77a8e49768752ae068d35a6643c4900da33a6632 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001LOCAL_DIR := $(GET_LOCAL_DIR)
2
3MODULE := $(LOCAL_DIR)
4
5ARCH := arm
6ARM_CPU := cortex-a9-neon
7WITH_SMP ?= 1
8SMP_MAX_CPUS := 2
9
10MODULE_DEPS := \
11 lib/bio \
12 lib/cbuf \
13 lib/watchdog \
14 dev/cache/pl310 \
15 dev/interrupt/arm_gic \
16 dev/timer/arm_cortex_a9
17
18MODULE_SRCS += \
19 $(LOCAL_DIR)/clocks.c \
20 $(LOCAL_DIR)/debug.c \
21 $(LOCAL_DIR)/fpga.c \
22 $(LOCAL_DIR)/gpio.c \
23 $(LOCAL_DIR)/platform.c \
24 $(LOCAL_DIR)/qspi.c \
25 $(LOCAL_DIR)/spiflash.c \
26 $(LOCAL_DIR)/start.S \
27 $(LOCAL_DIR)/swdt.c \
28 $(LOCAL_DIR)/uart.c \
29
30# default to no sdram unless the target calls it out
31ZYNQ_SDRAM_SIZE ?= 0
32
33# default to having the gem ethernet controller
34ZYNQ_WITH_GEM_ETH ?= 1
35
36ifeq ($(ZYNQ_WITH_GEM_ETH),1)
37MODULE_SRCS += \
38 $(LOCAL_DIR)/gem.c \
39
40GLOBAL_DEFINES += \
41 ZYNQ_WITH_GEM_ETH=1 \
42 ARM_ARCH_WAIT_FOR_SECONDARIES=1
43
44# gem driver depends on minip interface
45MODULE_DEPS += \
46 lib/minip
47endif
48
49ifeq ($(ZYNQ_USE_SRAM),1)
50MEMBASE := 0x0
51MEMSIZE := 0x40000 # 4 * 64K
52
53GLOBAL_DEFINES += \
54 ZYNQ_CODE_IN_SRAM=1
55
56ifneq ($(ZYNQ_SDRAM_SIZE),0)
57GLOBAL_DEFINES += \
58 ZYNQ_SDRAM_INIT=1
59endif
60
61else
62MEMBASE := 0x00000000
63MEMSIZE ?= $(ZYNQ_SDRAM_SIZE) # 256MB
64KERNEL_LOAD_OFFSET := 0x00100000 # loaded 1MB into physical space
65
66# set a #define so system code can decide if it needs to reinitialize dram or not
67GLOBAL_DEFINES += \
68 ZYNQ_CODE_IN_SDRAM=1
69endif
70
71# put our kernel at 0xc0000000 so we can have axi bus 1 mapped at 0x80000000
72KERNEL_BASE = 0xc0000000
73
74GLOBAL_DEFINES += \
75 SDRAM_SIZE=$(ZYNQ_SDRAM_SIZE)
76
77LINKER_SCRIPT += \
78 $(BUILDDIR)/system-onesegment.ld
79
80# python script to generate the zynq's bootrom bootheader
81BOOTHEADERBIN := $(BUILDDIR)/BOOT.BIN
82MKBOOTHEADER := $(LOCAL_DIR)/mkbootheader.py
83EXTRA_BUILDDEPS += $(BOOTHEADERBIN)
84GENERATED += $(BOOTHEADERBIN)
85
86$(BOOTHEADERBIN): $(OUTBIN) $(MKBOOTHEADER)
87 @$(MKDIR)
88 $(NOECHO)echo generating $@; \
89 $(MKBOOTHEADER) $(OUTBIN) $@
90
91include make/module.mk