-
Notifications
You must be signed in to change notification settings - Fork 147
Add Xilinx Zynq-7000 (ZC702) wolfBoot port #770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dgarske
wants to merge
1
commit into
wolfSSL:master
Choose a base branch
from
dgarske:zynq7000
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| ARCH?=ARM | ||
| TARGET?=zynq7000 | ||
| SIGN?=ECC256 | ||
| HASH?=SHA256 | ||
|
|
||
| # Cortex-A9 (Zynq-7000) - selected automatically via TARGET=zynq7000 in arch.mk. | ||
| # wolfBoot replaces U-Boot in the Z7 boot flow (BootROM -> FSBL -> wolfBoot -> | ||
| # kernel/app, no U-Boot stage). This single config supports both bare-metal | ||
| # and Linux payloads from QSPI. | ||
| DEBUG?=0 | ||
| DEBUG_UART?=1 | ||
| V?=0 | ||
| SPMATH?=1 | ||
|
|
||
| # Linux payload support (no-op for plain bare-metal payloads): | ||
| # LINUX_PAYLOAD=1 -> do_boot uses ARM Linux boot ABI (r0=0, r1=~0, | ||
| # r2=DTB_phys, r3=0). Bare-metal apps don't read these | ||
| # registers, so the same ABI is fine for them. | ||
| # MMU=1 -> enables update_ram.c DTB-load codepath and pulls in | ||
| # src/fdt.o. wolfBoot itself does NOT manage page | ||
| # tables; it inherits FSBL's flat 1:1 DDR mapping. | ||
| # ELF=1 -> wolfBoot understands ELF inputs (e.g. vmlinux) and | ||
| # loads only their LOAD segments. Flat binaries (zImage, | ||
| # bare-metal .bin) fall through to raw-binary boot. | ||
| # Cost vs. a strictly bare-metal-only build: ~5 KB extra wolfBoot binary | ||
| # from the FDT/MMU/ELF support, in exchange for one config that covers | ||
| # both payload types. | ||
| LINUX_PAYLOAD=1 | ||
| MMU=1 | ||
| ELF=1 | ||
|
|
||
| # wolfBoot itself is staged by FSBL to DDR at 0x04000000 (hal/zynq7000.ld); | ||
| # the verified payload (kernel or bare-metal app) is staged at | ||
| # WOLFBOOT_LOAD_ADDRESS, well clear of wolfBoot. 1 GB DDR3 on ZC702 | ||
| # starts at 0x00000000. | ||
| WOLFBOOT_LOAD_ADDRESS=0x10000000 | ||
|
|
||
| # DTB load address (Linux only). Kernel reads it from r2. 16 MB clear of | ||
| # WOLFBOOT_LOAD_ADDRESS. Ignored for bare-metal payloads. | ||
| WOLFBOOT_LOAD_DTS_ADDRESS=0x11000000 | ||
|
|
||
| # QSPI flash (16 MB N25Q128A on ZC702) via XQspiPs (hal/zynq7000.c). | ||
| # Override EXT_FLASH=0 on the make command line for JTAG-only dev builds. | ||
| EXT_FLASH?=1 | ||
| NO_XIP=1 | ||
|
|
||
| # QSPI partition layout (16 MB total) - sized for a full Linux kernel + DTB | ||
| # pair so the same layout also works for bare-metal payloads. | ||
| # 0x000000 - 0x07FFFF BOOT.BIN (FSBL + wolfboot, 512 KB) | ||
| # 0x080000 - 0x0FFFFF DTS_BOOT (signed DTB, 512 KB - Linux only) | ||
| # 0x100000 - 0x6FFFFF BOOT_A (~6 MB primary) | ||
| # 0x700000 - 0x77FFFF DTS_UPD (signed update DTB, 512 KB - Linux only) | ||
| # 0x780000 - 0xDFFFFF UPDATE_B (~6.5 MB update) | ||
| # 0xE00000 - 0xE0FFFF SWAP (64 KB scratch) | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x00100000 | ||
| WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00780000 | ||
| WOLFBOOT_PARTITION_SWAP_ADDRESS=0x00E00000 | ||
| WOLFBOOT_PARTITION_SIZE=0x00600000 | ||
| WOLFBOOT_SECTOR_SIZE=0x10000 | ||
|
|
||
| WOLFBOOT_DTS_BOOT_ADDRESS=0x00080000 | ||
| WOLFBOOT_DTS_UPDATE_ADDRESS=0x00700000 | ||
|
|
||
| IMAGE_HEADER_SIZE=1024 | ||
|
|
||
| CROSS_COMPILE?=arm-none-eabi- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| ARCH?=ARM | ||
| TARGET?=zynq7000 | ||
| SIGN?=ECC256 | ||
| HASH?=SHA256 | ||
|
|
||
| # Cortex-A9 Zynq-7000 SD-card boot variant. Uses the generic SDHCI driver | ||
| # (src/sdhci.c) with HAL hooks in hal/zynq7000.c that translate between the | ||
| # driver's Cadence SD4HC register layout and the Arasan SDHCI v2.0 standard | ||
| # layout used by the Zynq-7000 controller (same IP family as ZynqMP's v3.0, | ||
| # just an older revision; the translation is reused from hal/zynq.c). | ||
| # | ||
| # wolfBoot replaces U-Boot in the Z7 boot flow (BootROM -> FSBL -> wolfBoot | ||
| # -> kernel/app, no U-Boot stage). This single config supports both | ||
| # bare-metal and Linux payloads from SD card -- see the LINUX_PAYLOAD/MMU/ | ||
| # ELF block below. | ||
| DEBUG?=0 | ||
| DEBUG_UART?=1 | ||
| V?=0 | ||
| SPMATH?=1 | ||
|
|
||
| # SD card boot - swaps update_ram.o for update_disk.o + GPT/disk support. | ||
| DISK_SDCARD=1 | ||
| NO_XIP=1 | ||
|
|
||
| # Linux payload support (no-op for plain bare-metal payloads): | ||
| # LINUX_PAYLOAD=1 -> do_boot uses ARM Linux boot ABI (r0=0, r1=~0, | ||
| # r2=DTB_phys, r3=0). Bare-metal apps don't read | ||
| # these registers, so the same ABI is fine for them. | ||
| # MMU=1 -> pulls in src/fdt.o for FDT-aware paths in | ||
| # update_disk.c. wolfBoot does NOT manage page | ||
| # tables; it inherits FSBL's flat 1:1 DDR mapping. | ||
| # ELF=1 -> wolfBoot understands ELF inputs (e.g. vmlinux) and | ||
| # loads only their LOAD segments. Flat binaries | ||
| # (zImage, bare-metal .bin) fall through to raw- | ||
| # binary boot. | ||
| # For Linux from SD use tools/scripts/zynq7000/prepare_linux.sh APPENDED=1 | ||
| # (DTB concatenated to zImage and signed as one image). update_disk.c does | ||
| # not read a separate PART_DTS_BOOT partition; the appended-DTB path is | ||
| # what carries the device tree to the kernel via CONFIG_ARM_APPENDED_DTB. | ||
| LINUX_PAYLOAD=1 | ||
| MMU=1 | ||
| ELF=1 | ||
|
|
||
| # Stage payload at low DDR (clear of wolfBoot at 0x04000000-0x040FFFFF). | ||
| WOLFBOOT_LOAD_ADDRESS=0x10000000 | ||
|
|
||
| # DTB load address (Linux only, used by update_disk.c when a FIT image | ||
| # carries a DTB). Ignored for bare-metal and for the appended-DTB Linux | ||
| # flow. 16 MB clear of WOLFBOOT_LOAD_ADDRESS. | ||
| WOLFBOOT_LOAD_DTS_ADDRESS=0x11000000 | ||
|
|
||
| # MBR partition layout on the SD card. Pure MBR (no GPT) - the Zynq-7000 | ||
| # BootROM (UG821 ch.6.3) only accepts MBR with the first partition as | ||
| # FAT32 and the Active flag set. wolfBoot's src/disk.c falls back to MBR | ||
| # parsing when no protective-GPT entry is present. | ||
| # MBR p1 (wolfBoot idx 0): FAT32-LBA Active - holds BOOT.BIN for BootROM. | ||
| # MBR p2 (wolfBoot idx 1): Linux raw (0x83) - signed boot image. | ||
| # MBR p3 (wolfBoot idx 2): Linux raw (0x83) - signed update image. | ||
| # tools/scripts/zynq7000/prepare_sdcard.sh lays this out; BOOT_PART_A/B tell | ||
| # update_disk.c which MBR entries (0-indexed) to use for boot/update. | ||
| CFLAGS_EXTRA+=-DBOOT_PART_A=1 -DBOOT_PART_B=2 | ||
|
|
||
| # Arasan SDHCI v2.0 on Zynq-7000 is 3.3V-only, no UHS-I. The generic | ||
| # driver tries to push the card to UHS-I SDR25 / 50 MHz / High Speed mode | ||
| # which is invalid for our v2.0 + 3.3V combo and causes DTOE on the first | ||
| # data transfer (MBR read). Cap the post-init clock at SD default-speed | ||
| # 25 MHz; the HSE bit is also masked in hal/zynq7000.c sdhci_reg_write so | ||
| # the controller stays in single-edge timing the card matches. | ||
| # Cap the post-init SDHCI clock at 6 MHz. The Arasan SDHCI v2.0 on | ||
| # Zynq-7000 has a clock-dependent state-cleanup issue: at 12 MHz multi- | ||
| # block reads (CMD18) work, but a single-block read (CMD17) issued | ||
| # immediately after a CMD18+CMD12 sequence times out (DTOE) on the first | ||
| # data block. At 24 MHz even the very first CMD17 fails. 6 MHz / 4-bit | ||
| # bus is plenty fast for boot-time loading (~3 MB/s) and is well below | ||
| # the v2.0 quirk threshold; raise this if a future fix in src/sdhci.c | ||
| # adds an explicit DAT-line reset between transfers. | ||
| CFLAGS_EXTRA+=-DSDHCI_CLK_50MHZ=6000 -DSDHCI_CLK_25MHZ=6000 | ||
|
|
||
| # update_disk.c reads images in DISK_BLOCK_SIZE chunks. Default 512 B = one | ||
| # disk_read = one CMD17 per 512 B, which makes a multi-MB Linux load issue | ||
| # thousands of CMDs and stall the card with per-CMD overhead. Bump to | ||
| # 512 KB so each disk_read pulls 1024 blocks via one CMD18 SDMA (matches | ||
| # ZynqMP). Verified on ZC702 with a 4.76 MB appended-DTB zImage: 9 CMD18s | ||
| # complete in well under a second. The default 4 KB SDMA buffer boundary | ||
| # is left in place -- overriding it to 512 KB stalled SDMA on Arasan v2.0. | ||
| CFLAGS_EXTRA+=-DDISK_BLOCK_SIZE=0x80000 | ||
|
|
||
| # Uncomment for verbose SDHCI driver logging when bringing up new boards | ||
| # or debugging timing issues. | ||
| #CFLAGS_EXTRA+=-DDEBUG_SDHCI | ||
|
|
||
| # Image-header partition addresses are unused for disk boot (kept for the | ||
| # Makefile sanity checks). update_disk.c finds images by GPT entry, not by | ||
| # memory address. | ||
|
dgarske marked this conversation as resolved.
|
||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x00100000 | ||
| WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00700000 | ||
| WOLFBOOT_PARTITION_SWAP_ADDRESS=0x00D00000 | ||
| WOLFBOOT_PARTITION_SIZE=0x00600000 | ||
| # Sector size of WOLFBOOT_PARTITION (not the SD physical sector, which is | ||
| # always 512 B). Used as the smallest erase/copy unit for the BOOT/UPDATE | ||
| # partitions; must be > IMAGE_HEADER_SIZE. | ||
| WOLFBOOT_SECTOR_SIZE=0x1000 | ||
|
|
||
| IMAGE_HEADER_SIZE=1024 | ||
|
|
||
| # Required by image.c when MMU=1 is set, even though update_disk.c never | ||
| # opens PART_DTS_BOOT/PART_DTS_UPDATE (the disk boot path uses appended- | ||
| # DTB or FIT, not a separate DTB partition). Set to dummy addresses to | ||
| # satisfy the build. | ||
| WOLFBOOT_DTS_BOOT_ADDRESS=0x0 | ||
| WOLFBOOT_DTS_UPDATE_ADDRESS=0x0 | ||
|
|
||
| CROSS_COMPILE=arm-none-eabi- | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.