rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | LOCAL_DIR := $(GET_LOCAL_DIR) |
| 2 | |
| 3 | MODULE := $(LOCAL_DIR) |
| 4 | |
| 5 | ARCH := arm |
| 6 | ARM_CPU := cortex-a9-neon |
| 7 | WITH_SMP ?= 1 |
| 8 | SMP_MAX_CPUS := 2 |
| 9 | |
| 10 | MODULE_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 | |
| 18 | MODULE_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 |
| 31 | ZYNQ_SDRAM_SIZE ?= 0 |
| 32 | |
| 33 | # default to having the gem ethernet controller |
| 34 | ZYNQ_WITH_GEM_ETH ?= 1 |
| 35 | |
| 36 | ifeq ($(ZYNQ_WITH_GEM_ETH),1) |
| 37 | MODULE_SRCS += \ |
| 38 | $(LOCAL_DIR)/gem.c \ |
| 39 | |
| 40 | GLOBAL_DEFINES += \ |
| 41 | ZYNQ_WITH_GEM_ETH=1 \ |
| 42 | ARM_ARCH_WAIT_FOR_SECONDARIES=1 |
| 43 | |
| 44 | # gem driver depends on minip interface |
| 45 | MODULE_DEPS += \ |
| 46 | lib/minip |
| 47 | endif |
| 48 | |
| 49 | ifeq ($(ZYNQ_USE_SRAM),1) |
| 50 | MEMBASE := 0x0 |
| 51 | MEMSIZE := 0x40000 # 4 * 64K |
| 52 | |
| 53 | GLOBAL_DEFINES += \ |
| 54 | ZYNQ_CODE_IN_SRAM=1 |
| 55 | |
| 56 | ifneq ($(ZYNQ_SDRAM_SIZE),0) |
| 57 | GLOBAL_DEFINES += \ |
| 58 | ZYNQ_SDRAM_INIT=1 |
| 59 | endif |
| 60 | |
| 61 | else |
| 62 | MEMBASE := 0x00000000 |
| 63 | MEMSIZE ?= $(ZYNQ_SDRAM_SIZE) # 256MB |
| 64 | KERNEL_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 |
| 67 | GLOBAL_DEFINES += \ |
| 68 | ZYNQ_CODE_IN_SDRAM=1 |
| 69 | endif |
| 70 | |
| 71 | # put our kernel at 0xc0000000 so we can have axi bus 1 mapped at 0x80000000 |
| 72 | KERNEL_BASE = 0xc0000000 |
| 73 | |
| 74 | GLOBAL_DEFINES += \ |
| 75 | SDRAM_SIZE=$(ZYNQ_SDRAM_SIZE) |
| 76 | |
| 77 | LINKER_SCRIPT += \ |
| 78 | $(BUILDDIR)/system-onesegment.ld |
| 79 | |
| 80 | # python script to generate the zynq's bootrom bootheader |
| 81 | BOOTHEADERBIN := $(BUILDDIR)/BOOT.BIN |
| 82 | MKBOOTHEADER := $(LOCAL_DIR)/mkbootheader.py |
| 83 | EXTRA_BUILDDEPS += $(BOOTHEADERBIN) |
| 84 | GENERATED += $(BOOTHEADERBIN) |
| 85 | |
| 86 | $(BOOTHEADERBIN): $(OUTBIN) $(MKBOOTHEADER) |
| 87 | @$(MKDIR) |
| 88 | $(NOECHO)echo generating $@; \ |
| 89 | $(MKBOOTHEADER) $(OUTBIN) $@ |
| 90 | |
| 91 | include make/module.mk |