Add NXP T2080 (+ NAII 68PPC2) wolfIP support

pull/845/head
David Garske 2026-07-23 12:50:44 -07:00 committed by Daniele Lacamera
parent 29c9ea1ce1
commit ac5f532cf9
5 changed files with 111 additions and 30 deletions

View File

@ -63,18 +63,22 @@ WOLFBOOT_ORIGIN?=0xEFFE0000
# wolfBoot partition size (custom) # wolfBoot partition size (custom)
BOOTLOADER_PARTITION_SIZE=0x20000 BOOTLOADER_PARTITION_SIZE=0x20000
# The region [0xEFF00000, 0xEFFE0000) below wolfBoot is reserved for the FMan
# microcode (FMAN_FW_ADDR=0xEFF00000, the U-Boot-standard slot). The partitions
# below sit under it so a BOOT-partition erase/update never touches the ucode.
# Application Partition Size # Application Partition Size
WOLFBOOT_PARTITION_SIZE?=0x100000 WOLFBOOT_PARTITION_SIZE?=0x100000
# Location in Flash for Application Partition # Location in Flash for Application Partition (top = 0xEFF00000, below the ucode)
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFEE0000 WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFE00000
# Load Partition to RAM Address # Load Partition to RAM Address
WOLFBOOT_LOAD_ADDRESS?=0x19000 WOLFBOOT_LOAD_ADDRESS?=0x19000
# Location in Flash for Update Partition # Location in Flash for Update Partition
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFDE0000 WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFD00000
# Location of temporary sector used during updates # Location of temporary sector used during updates
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFDD0000 WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFCF0000
# DTS (Device Tree) # DTS (Device Tree)
WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8040000 WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8040000
@ -124,3 +128,40 @@ WOLFBOOT_LOAD_DTS_ADDRESS?=0x200000
# wolfCrypt Test and Benchmark (requires larger partition size) # wolfCrypt Test and Benchmark (requires larger partition size)
#WOLFCRYPT_TEST?=1 #WOLFCRYPT_TEST?=1
#WOLFCRYPT_BENCHMARK?=1 #WOLFCRYPT_BENCHMARK?=1
# -----------------------------------------------------------------------------
# wolfIP network test in the test-app (optional)
# -----------------------------------------------------------------------------
# Compiles wolfIP + the NXP QorIQ FMan ethernet port (mEMAC/MDIO/SGMII,
# FM1@DTSEC1) into the test-app and runs a board-side network test. Build the
# app FLAT and 32-bit (ELF=0, OS_64BIT=0) at a low load address (the elf32 load
# path and 64-bit RTOS handoff are unused). wolfIP objects are built -fno-plt
# -D_FORTIFY_SOURCE=0 (no PLT/GOT runtime fixup). Point WOLFBOOT_LIB_WOLFIP at
# a wolfIP checkout (or add it as lib/wolfip).
#ENABLE_WOLFIP=1
#WOLFBOOT_LIB_WOLFIP=../lib/wolfip
# Build FLAT + 32-bit at a low load address (as above; siblings t1040/t1024 too):
#ELF=0
#OS_64BIT=0
#WOLFBOOT_LOAD_ADDRESS=0x100000
# Test mode (neither flag = acquire a DHCP lease and stop):
# WOLFBOOT_TEST_TFTP=1 RRQ a file from a host tftpd, report size+checksum
# (set CFLAGS_EXTRA TFTP_EXPECT_SIZE/TFTP_EXPECT_SUM to verify)
# WOLFIP_SPEED_TEST=1 TCP throughput server on port 9 (drive with nc/dd/pv)
#WOLFBOOT_TEST_TFTP=1
#WOLFIP_SPEED_TEST=1
#
# Per-board wolfIP ethernet wiring (defaults above are CW VPX3-152 / RDB =
# FM1@DTSEC1, SGMII, PHY probed at addr 0x2). Override per the board device
# tree if the wired port differs:
#
# NAII 68PPC2 (hardware-verified): PRIME port is FM1@DTSEC3 = RGMII, Marvell
# PHY at MDIO addr 0 (68ppc2.dts ethernet@e4000: "rgmii-id", ethernet-phy@0
# reg <0>). The MDIO scan would otherwise grab DTSEC4's PHY at addr 1, so set
# the address explicitly:
#CFLAGS_EXTRA+=-DNXP_FMAN_MEMAC_IDX=3
#CFLAGS_EXTRA+=-DNXP_FMAN_IF_SGMII=0
#CFLAGS_EXTRA+=-DNXP_FMAN_PHY_ADDR=0
#
# NAII NOR is dual-bank with only the top 128KB boot sector common to both
# banks; flash the ucode/app with the boot-bank select in its runtime state.

View File

@ -5998,6 +5998,10 @@ variants are supported:
Example configuration: [/config/examples/nxp-t2080.config](/config/examples/nxp-t2080.config). Example configuration: [/config/examples/nxp-t2080.config](/config/examples/nxp-t2080.config).
See [Board Selection](#board-selection) below for per-board setup. See [Board Selection](#board-selection) below for per-board setup.
> **FMan microcode (DPAA/wolfIP):** with DPAA/FMan enabled, wolfBoot uploads the FMan microcode from NOR at `FMAN_FW_ADDR` (`hal/nxp_t2080.c`), board-gated: the T2080 RDB and NAII 68PPC2 (128 MB NOR at `0xE8000000`) use `0xEFF00000` -- the U-Boot-standard slot (`CONFIG_SYS_FMAN_FW_ADDR` in `T208xRDB.h`) -- and CW VPX3-152 (256 MB NOR) uses `0xFFE60000`. The wolfBoot partitions sit below this reserved firmware region so a BOOT-partition erase/update never overwrites the ucode. The address is bounds-checked against the NOR window, so a wrong value fails gracefully instead of machine-checking. Flash the matching `fsl_fman_ucode_*` blob at that address.
>
> wolfIP-on-FMan is hardware-verified on the CW VPX3-152 (FM1@DTSEC1, SGMII), the NAII 68PPC2 (FM1@DTSEC3, RGMII, PHY @ addr 0 -- see the example config's wolfIP block), and the T1040D4RDB (e5500; FM1@DTSEC4, RGMII, RTL8211 @ addr 4). NAII NOR is dual-bank with only the top 128 KB boot sector common to both banks, so flash the ucode/app with the boot-bank select in its runtime state.
### Design NXP T2080 PPC ### Design NXP T2080 PPC
The QorIQ requires a Reset Configuration Word (RCW) to define the boot parameters, which resides at the start of the flash (`0xE8000000` for 128 MB boards, `0xF0000000` for the 256 MB CW VPX3-152). The QorIQ requires a Reset Configuration Word (RCW) to define the boot parameters, which resides at the start of the flash (`0xE8000000` for 128 MB boards, `0xF0000000` for the 256 MB CW VPX3-152).
@ -6276,8 +6280,8 @@ Flash Layout (T2080 RDB / NAII 68PPC2, 128 MB flash):
| Description | File | Address | | Description | File | Address |
| ----------- | ---- | ------- | | ----------- | ---- | ------- |
| Reset Configuration Word (RCW) | _(board-specific)_ | `0xE8000000` | | Reset Configuration Word (RCW) | _(board-specific)_ | `0xE8000000` |
| Frame Manager Microcode | `fsl_fman_ucode_t2080_r1.0.bin` | `0xE8020000` | | Signed Application | `test-app/image_v1_signed.bin` | `0xEFE00000` |
| Signed Application | `test-app/image_v1_signed.bin` | `0xE8080000` | | Frame Manager Microcode | `fsl_fman_ucode_t2080_r1.0.bin` | `0xEFF00000` |
| wolfBoot | `wolfboot.bin` | `0xEFFE0000` | | wolfBoot | `wolfboot.bin` | `0xEFFE0000` |
| Boot Entry Point (offset jump to init code) | | `0xEFFFFFFC` | | Boot Entry Point (offset jump to init code) | | `0xEFFFFFFC` |
@ -6286,8 +6290,8 @@ Flash Layout (CW VPX3-152, 256 MB flash):
| Description | File | Address | | Description | File | Address |
| ----------- | ---- | ------- | | ----------- | ---- | ------- |
| Reset Configuration Word (RCW) | _(board-specific)_ | `0xF0000000` | | Reset Configuration Word (RCW) | _(board-specific)_ | `0xF0000000` |
| Frame Manager Microcode | `fsl_fman_ucode_t2080_r1.0.bin` | `0xF0020000` | | Frame Manager Microcode | `fsl_fman_ucode_t2080_r1.0.bin` | `0xFFE60000` |
| Signed Application | `test-app/image_v1_signed.bin` | `0xF0080000` | | Signed Application | `test-app/image_v1_signed.bin` | `0xFF000000` |
| wolfBoot | `wolfboot.bin` | `0xFFFE0000` | | wolfBoot | `wolfboot.bin` | `0xFFFE0000` |
| Boot Entry Point (offset jump to init code) | | `0xFFFFFFFC` | | Boot Entry Point (offset jump to init code) | | `0xFFFFFFFC` |

View File

@ -579,11 +579,17 @@ static void hal_cpld_init(void)
} }
#ifdef ENABLE_FMAN #ifdef ENABLE_FMAN
/* FMAN microcode upload for T2080. /* FMan microcode NOR address (board-gated, same QE firmware format as T1040).
* Firmware is in NOR flash at FMAN_FW_ADDR (typically 0xFFE60000). * T2080 RDB / NAII 68PPC2 (128MB NOR @ 0xE8000000): 0xEFF00000, the U-Boot-
* Uses same QE firmware format as T1040. */ * standard slot (CONFIG_SYS_FMAN_FW_ADDR in T208xRDB.h); the wolfBoot partitions
* sit below it. CW VPX3-152 (256MB NOR @ 0xF0000000): 0xFFE60000. A wrong address
* machine-checks when read in hal_fman_init(), so it is bounds-checked there. */
#ifndef FMAN_FW_ADDR #ifndef FMAN_FW_ADDR
#ifdef BOARD_CW_VPX3152
#define FMAN_FW_ADDR 0xFFE60000UL #define FMAN_FW_ADDR 0xFFE60000UL
#else
#define FMAN_FW_ADDR 0xEFF00000UL
#endif
#endif #endif
#define FMAN_BASE (CCSRBAR + 0x400000UL) #define FMAN_BASE (CCSRBAR + 0x400000UL)
#define FMAN_IRAM (FMAN_BASE + 0xC4000UL) #define FMAN_IRAM (FMAN_BASE + 0xC4000UL)
@ -643,9 +649,22 @@ static int hal_fman_init(void)
const struct qe_header *hdr = &fw->header; const struct qe_header *hdr = &fw->header;
unsigned int i; unsigned int i;
/* Guard: FMAN_FW_ADDR must lie in the NOR window, else the magic read
* below machine-checks. Compare via offset-from-base (not base+size) so the
* bound does not overflow uintptr_t when a 256MB NOR sits at the top of the
* 32-bit space (CW VPX3-152: 0xF0000000 + 256MB wraps to 0); the first
* clause ensures addr >= base, so the subtraction is safe. */
if ((uintptr_t)FMAN_FW_ADDR < (uintptr_t)FLASH_BASE_ADDR ||
((uintptr_t)FMAN_FW_ADDR - (uintptr_t)FLASH_BASE_ADDR) >=
(uintptr_t)FLASH_BANK_SIZE) {
wolfBoot_printf("FMAN: fw addr 0x%x outside NOR, skipping\n",
(unsigned)FMAN_FW_ADDR);
return -1;
}
/* Check firmware magic */ /* Check firmware magic */
if (hdr->magic[0] != 'Q' || hdr->magic[1] != 'E' || hdr->magic[2] != 'F') { if (hdr->magic[0] != 'Q' || hdr->magic[1] != 'E' || hdr->magic[2] != 'F') {
wolfBoot_printf("FMAN: no firmware at 0x%x\n", FMAN_FW_ADDR); wolfBoot_printf("FMAN: no firmware at 0x%x\n", (unsigned)FMAN_FW_ADDR);
return -1; return -1;
} }

View File

@ -51,6 +51,10 @@ void __attribute__((naked, section(".text._app_entry"))) _app_entry(void)
#include "../hal/nxp_ppc.h" #include "../hal/nxp_ppc.h"
#ifdef ENABLE_WOLFIP
#include "wolfip_tftp_test.h"
#endif
/* wolfCrypt test/benchmark support */ /* wolfCrypt test/benchmark support */
#ifdef WOLFCRYPT_TEST #ifdef WOLFCRYPT_TEST
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
@ -139,9 +143,8 @@ static int print_info(void)
void main(void) void main(void)
{ {
/* Zero BSS - required for bare-metal since there's no crt0 startup. /* Zero BSS (no crt0 on bare metal): the wolfCrypt static-memory pools
* Without this, static variables (gTestMemory, HEAP_HINT, etc.) * (gTestMemory/HEAP_HINT) must start zeroed or wc_LoadStaticMemory crashes. */
* contain DDR garbage, causing crashes in wc_LoadStaticMemory. */
extern char _start_bss[], _end_bss[]; extern char _start_bss[], _end_bss[];
{ {
char *p = _start_bss; char *p = _start_bss;
@ -177,6 +180,10 @@ void main(void)
wolfCrypt_Cleanup(); wolfCrypt_Cleanup();
#endif #endif
#ifdef ENABLE_WOLFIP
wolfip_tftp_test_report();
#endif
wolfBoot_printf("Test App: idle loop\r\n"); wolfBoot_printf("Test App: idle loop\r\n");
while(1) { while(1) {
/* Idle */ /* Idle */

View File

@ -199,12 +199,12 @@ IF &flashwolfboot
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
PRINT "2. Programming FMAN microcode..." PRINT "2. Programming FMAN microcode..."
PRINT " Source: &basedir/t2080_fman.bin" PRINT " Source: &basedir/t2080_fman.bin"
PRINT " Address: 0xE8020000 (128 KB)" PRINT " Address: 0xEFF00000 (FMAN_FW_ADDR, one 64 KB sector, ~32 KB actual)"
FLASH.UNLOCK 0xE8020000--0xE803FFFF FLASH.UNLOCK 0xEFF00000--0xEFF0FFFF
FLASH.ReProgram 0xE8020000--0xE803FFFF /Erase FLASH.ReProgram 0xEFF00000--0xEFF0FFFF /Erase
Data.LOAD.binary &basedir/t2080_fman.bin 0xE8020000 Data.LOAD.binary &basedir/t2080_fman.bin 0xEFF00000
FLASH.ReProgram.off FLASH.ReProgram.off
Data.LOAD.binary &basedir/t2080_fman.bin 0xE8020000 /Verify Data.LOAD.binary &basedir/t2080_fman.bin 0xEFF00000 /Verify
PRINT " FMAN microcode programmed and verified" PRINT " FMAN microcode programmed and verified"
PRINT "" PRINT ""
@ -227,12 +227,19 @@ IF &flashwolfboot
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
PRINT "4. Programming test application..." PRINT "4. Programming test application..."
PRINT " Source: &basedir/test-app/image_v1_signed.bin" PRINT " Source: &basedir/test-app/image_v1_signed.bin"
PRINT " Address: 0xEFEE0000 (WOLFBOOT_PARTITION_BOOT_ADDRESS, 1 MB)" ; Only erase/program sectors needed for the actual image size, not the
FLASH.UNLOCK 0xEFEE0000--0xEFFDFFFF ; full 1 MB partition -- and never climb into the ucode sector above.
FLASH.ReProgram 0xEFEE0000--0xEFFDFFFF /Erase &appsize=OS.FILE.SIZE(&basedir/test-app/image_v1_signed.bin)
Data.LOAD.binary &basedir/test-app/image_v1_signed.bin 0xEFEE0000 ; Round up to next 64 KB sector boundary (WOLFBOOT_SECTOR_SIZE=0x10000)
&append=0xEFE00000+((&appsize+0xFFFF)&~0xFFFF)-1
&appsizekb=FORMAT.Decimal(0,&appsize>>10.)
PRINT " Address: 0xEFE00000 (WOLFBOOT_PARTITION_BOOT_ADDRESS, 1 MB)"
PRINT " Image size &appsizekb KB, erasing to &append"
FLASH.UNLOCK 0xEFE00000--&append
FLASH.ReProgram 0xEFE00000--&append /Erase
Data.LOAD.binary &basedir/test-app/image_v1_signed.bin 0xEFE00000
FLASH.ReProgram.off FLASH.ReProgram.off
Data.LOAD.binary &basedir/test-app/image_v1_signed.bin 0xEFEE0000 /Verify Data.LOAD.binary &basedir/test-app/image_v1_signed.bin 0xEFE00000 /Verify
PRINT " Test application programmed and verified" PRINT " Test application programmed and verified"
PRINT "" PRINT ""
@ -243,9 +250,9 @@ IF &flashwolfboot
PRINT "" PRINT ""
PRINT "Flash Layout:" PRINT "Flash Layout:"
PRINT " 0xE8000000: RCW (64 KB)" PRINT " 0xE8000000: RCW (64 KB)"
PRINT " 0xE8020000: FMAN Microcode (128 KB)" PRINT " 0xEFE00000: Test Application (boot partition, 1 MB)"
PRINT " 0xEFEE0000: Test Application (boot partition, 1 MB)" PRINT " 0xEFEFFFFF: End of boot partition"
PRINT " 0xEFFDFFFF: End of boot partition" PRINT " 0xEFF00000: FMAN Microcode (64 KB sector, ~32 KB actual)"
PRINT " 0xEFFE0000: wolfBoot (128 KB)" PRINT " 0xEFFE0000: wolfBoot (128 KB)"
PRINT "" PRINT ""
@ -254,11 +261,14 @@ IF &flashwolfboot
PRINT "RCW at 0xE8000000 (should be AA 55 AA 55):" PRINT "RCW at 0xE8000000 (should be AA 55 AA 55):"
Data.dump 0xE8000000++0x3F /Long Data.dump 0xE8000000++0x3F /Long
PRINT "" PRINT ""
PRINT "FMAN at 0xEFF00000 (should show QEF header):"
Data.dump 0xEFF00000++0x3F /Long
PRINT ""
PRINT "wolfBoot at 0xEFFE0000:" PRINT "wolfBoot at 0xEFFE0000:"
Data.dump 0xEFFE0000++0x3F /Long Data.dump 0xEFFE0000++0x3F /Long
PRINT "" PRINT ""
PRINT "Test app at 0xEFEE0000:" PRINT "Test app at 0xEFE00000:"
Data.dump 0xEFEE0000++0x3F /Long Data.dump 0xEFE00000++0x3F /Long
PRINT "" PRINT ""
GOTO flash_complete GOTO flash_complete