|
| 1 | +ARCH?=ARM |
| 2 | +TARGET?=zynq7000 |
| 3 | +SIGN?=ECC256 |
| 4 | +HASH?=SHA256 |
| 5 | + |
| 6 | +# Cortex-A9 Zynq-7000 SD-card boot variant. Uses the generic SDHCI driver |
| 7 | +# (src/sdhci.c) with HAL hooks in hal/zynq7000.c that translate between the |
| 8 | +# driver's Cadence SD4HC register layout and the Arasan SDHCI v2.0 standard |
| 9 | +# layout used by the Zynq-7000 controller (same IP family as ZynqMP's v3.0, |
| 10 | +# just an older revision; the translation is reused from hal/zynq.c). |
| 11 | +# |
| 12 | +# wolfBoot replaces U-Boot in the Z7 boot flow (BootROM -> FSBL -> wolfBoot |
| 13 | +# -> kernel/app, no U-Boot stage). This single config supports both |
| 14 | +# bare-metal and Linux payloads from SD card -- see the LINUX_PAYLOAD/MMU/ |
| 15 | +# ELF block below. |
| 16 | +DEBUG?=0 |
| 17 | +DEBUG_UART?=1 |
| 18 | +V?=0 |
| 19 | +SPMATH?=1 |
| 20 | + |
| 21 | +# SD card boot - swaps update_ram.o for update_disk.o + GPT/disk support. |
| 22 | +DISK_SDCARD=1 |
| 23 | +NO_XIP=1 |
| 24 | + |
| 25 | +# Linux payload support (no-op for plain bare-metal payloads): |
| 26 | +# LINUX_PAYLOAD=1 -> do_boot uses ARM Linux boot ABI (r0=0, r1=~0, |
| 27 | +# r2=DTB_phys, r3=0). Bare-metal apps don't read |
| 28 | +# these registers, so the same ABI is fine for them. |
| 29 | +# MMU=1 -> pulls in src/fdt.o for FDT-aware paths in |
| 30 | +# update_disk.c. wolfBoot does NOT manage page |
| 31 | +# tables; it inherits FSBL's flat 1:1 DDR mapping. |
| 32 | +# ELF=1 -> wolfBoot understands ELF inputs (e.g. vmlinux) and |
| 33 | +# loads only their LOAD segments. Flat binaries |
| 34 | +# (zImage, bare-metal .bin) fall through to raw- |
| 35 | +# binary boot. |
| 36 | +# For Linux from SD use tools/scripts/zynq7000/prepare_linux.sh APPENDED=1 |
| 37 | +# (DTB concatenated to zImage and signed as one image). update_disk.c does |
| 38 | +# not read a separate PART_DTS_BOOT partition; the appended-DTB path is |
| 39 | +# what carries the device tree to the kernel via CONFIG_ARM_APPENDED_DTB. |
| 40 | +LINUX_PAYLOAD=1 |
| 41 | +MMU=1 |
| 42 | +ELF=1 |
| 43 | + |
| 44 | +# Stage payload at low DDR (clear of wolfBoot at 0x04000000-0x040FFFFF). |
| 45 | +WOLFBOOT_LOAD_ADDRESS=0x10000000 |
| 46 | + |
| 47 | +# DTB load address (Linux only, used by update_disk.c when a FIT image |
| 48 | +# carries a DTB). Ignored for bare-metal and for the appended-DTB Linux |
| 49 | +# flow. 16 MB clear of WOLFBOOT_LOAD_ADDRESS. |
| 50 | +WOLFBOOT_LOAD_DTS_ADDRESS=0x11000000 |
| 51 | + |
| 52 | +# MBR partition layout on the SD card. Pure MBR (no GPT) - the Zynq-7000 |
| 53 | +# BootROM (UG821 ch.6.3) only accepts MBR with the first partition as |
| 54 | +# FAT32 and the Active flag set. wolfBoot's src/disk.c falls back to MBR |
| 55 | +# parsing when no protective-GPT entry is present. |
| 56 | +# MBR p1 (wolfBoot idx 0): FAT32-LBA Active - holds BOOT.BIN for BootROM. |
| 57 | +# MBR p2 (wolfBoot idx 1): Linux raw (0x83) - signed boot image. |
| 58 | +# MBR p3 (wolfBoot idx 2): Linux raw (0x83) - signed update image. |
| 59 | +# tools/scripts/zynq7000/prepare_sdcard.sh lays this out; BOOT_PART_A/B tell |
| 60 | +# update_disk.c which MBR entries (0-indexed) to use for boot/update. |
| 61 | +CFLAGS_EXTRA+=-DBOOT_PART_A=1 -DBOOT_PART_B=2 |
| 62 | + |
| 63 | +# Arasan SDHCI v2.0 on Zynq-7000 is 3.3V-only, no UHS-I. The generic |
| 64 | +# driver tries to push the card to UHS-I SDR25 / 50 MHz / High Speed mode |
| 65 | +# which is invalid for our v2.0 + 3.3V combo and causes DTOE on the first |
| 66 | +# data transfer (MBR read). Cap the post-init clock at SD default-speed |
| 67 | +# 25 MHz; the HSE bit is also masked in hal/zynq7000.c sdhci_reg_write so |
| 68 | +# the controller stays in single-edge timing the card matches. |
| 69 | +# Cap the post-init SDHCI clock at 6 MHz. The Arasan SDHCI v2.0 on |
| 70 | +# Zynq-7000 has a clock-dependent state-cleanup issue: at 12 MHz multi- |
| 71 | +# block reads (CMD18) work, but a single-block read (CMD17) issued |
| 72 | +# immediately after a CMD18+CMD12 sequence times out (DTOE) on the first |
| 73 | +# data block. At 24 MHz even the very first CMD17 fails. 6 MHz / 4-bit |
| 74 | +# bus is plenty fast for boot-time loading (~3 MB/s) and is well below |
| 75 | +# the v2.0 quirk threshold; raise this if a future fix in src/sdhci.c |
| 76 | +# adds an explicit DAT-line reset between transfers. |
| 77 | +CFLAGS_EXTRA+=-DSDHCI_CLK_50MHZ=6000 -DSDHCI_CLK_25MHZ=6000 |
| 78 | + |
| 79 | +# update_disk.c reads images in DISK_BLOCK_SIZE chunks. Default 512 B = one |
| 80 | +# disk_read = one CMD17 per 512 B, which makes a multi-MB Linux load issue |
| 81 | +# thousands of CMDs and stall the card with per-CMD overhead. Bump to |
| 82 | +# 512 KB so each disk_read pulls 1024 blocks via one CMD18 SDMA (matches |
| 83 | +# ZynqMP). Verified on ZC702 with a 4.76 MB appended-DTB zImage: 9 CMD18s |
| 84 | +# complete in well under a second. The default 4 KB SDMA buffer boundary |
| 85 | +# is left in place -- overriding it to 512 KB stalled SDMA on Arasan v2.0. |
| 86 | +CFLAGS_EXTRA+=-DDISK_BLOCK_SIZE=0x80000 |
| 87 | + |
| 88 | +# Uncomment for verbose SDHCI driver logging when bringing up new boards |
| 89 | +# or debugging timing issues. |
| 90 | +#CFLAGS_EXTRA+=-DDEBUG_SDHCI |
| 91 | + |
| 92 | +# Image-header partition addresses are unused for disk boot (kept for the |
| 93 | +# Makefile sanity checks). update_disk.c finds images by GPT entry, not by |
| 94 | +# memory address. |
| 95 | +WOLFBOOT_PARTITION_BOOT_ADDRESS=0x00100000 |
| 96 | +WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00700000 |
| 97 | +WOLFBOOT_PARTITION_SWAP_ADDRESS=0x00D00000 |
| 98 | +WOLFBOOT_PARTITION_SIZE=0x00600000 |
| 99 | +# Sector size of WOLFBOOT_PARTITION (not the SD physical sector, which is |
| 100 | +# always 512 B). Used as the smallest erase/copy unit for the BOOT/UPDATE |
| 101 | +# partitions; must be > IMAGE_HEADER_SIZE. |
| 102 | +WOLFBOOT_SECTOR_SIZE=0x1000 |
| 103 | + |
| 104 | +IMAGE_HEADER_SIZE=1024 |
| 105 | + |
| 106 | +# Required by image.c when MMU=1 is set, even though update_disk.c never |
| 107 | +# opens PART_DTS_BOOT/PART_DTS_UPDATE (the disk boot path uses appended- |
| 108 | +# DTB or FIT, not a separate DTB partition). Set to dummy addresses to |
| 109 | +# satisfy the build. |
| 110 | +WOLFBOOT_DTS_BOOT_ADDRESS=0x0 |
| 111 | +WOLFBOOT_DTS_UPDATE_ADDRESS=0x0 |
| 112 | + |
| 113 | +CROSS_COMPILE=arm-none-eabi- |
0 commit comments