Skip to content

Commit a5356b8

Browse files
dgarskedanielinux
authored andcommitted
NXP T2080 Port Refresh
* Initial port refresh for the NXP T2080 target * IFC Flash driver and multi-core support on T2080 * Working wolfBoot test-app startup on T2080 * Support for NAII and Curtiss-Wright T2080 vendor boards
1 parent 74565a3 commit a5356b8

17 files changed

Lines changed: 2175 additions & 918 deletions

File tree

.github/workflows/test-configs.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,6 @@ jobs:
182182
arch: ppc
183183
config-file: ./config/examples/nxp-t1024.config
184184

185-
nxp_t2080_68ppc2_test:
186-
uses: ./.github/workflows/test-build.yml
187-
with:
188-
arch: ppc
189-
config-file: ./config/examples/nxp-t2080-68ppc2.config
190-
191185
nxp_t2080_test:
192186
uses: ./.github/workflows/test-build.yml
193187
with:

arch.mk

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,19 @@ endif
628628
ifeq ($(ARCH),PPC)
629629
CROSS_COMPILE?=powerpc-linux-gnu-
630630
LDFLAGS+=-Wl,--build-id=none
631-
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY
631+
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY -ffreestanding -fno-tree-loop-distribute-patterns
632632

633633
ifeq ($(DEBUG_UART),0)
634634
CFLAGS+=-fno-builtin-printf
635635
endif
636636

637+
# Target-specific CPU flags
638+
ifeq ($(TARGET),nxp_t2080)
639+
CFLAGS+=-mcpu=e6500 -mno-altivec -mbss-plt
640+
else ifeq ($(TARGET),nxp_t1024)
641+
CFLAGS+=-mcpu=e5500
642+
endif
643+
637644
# Prune unused functions and data
638645
CFLAGS+=-ffunction-sections -fdata-sections
639646
LDFLAGS+=-Wl,--gc-sections
@@ -995,8 +1002,11 @@ ifeq ($(TARGET),nxp_t2080)
9951002
LDFLAGS+=$(ARCH_FLAGS)
9961003
LDFLAGS+=-Wl,--hash-style=both # generate both sysv and gnu symbol hash table
9971004
LDFLAGS+=-Wl,--as-needed # remove weak functions not used
998-
UPDATE_OBJS:=src/update_ram.o
1005+
OBJS+=src/boot_ppc_mp.o # support for spin table
9991006
OBJS+=src/fdt.o
1007+
OBJS+=src/pci.o
1008+
CFLAGS+=-DWOLFBOOT_USE_PCI
1009+
UPDATE_OBJS:=src/update_ram.o
10001010
endif
10011011

10021012
ifeq ($(TARGET),nxp_p1021)

config/examples/nxp-t2080-68ppc2.config

Lines changed: 0 additions & 55 deletions
This file was deleted.

config/examples/nxp-t2080.config

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
# NXP T2080 wolfBoot Configuration
2+
# Default board: T2080 RDB (66.66 MHz oscillator, DDR3L SODIMM)
3+
#
4+
# Board selection: uncomment exactly one line to override the default.
5+
# Default (no define): T2080 RDB (66.66 MHz oscillator, DDR3L SODIMM)
6+
# BOARD_CW_VPX3152: CW VPX3-152 (66.667 MHz oscillator, DDR3L)
7+
# BOARD_NAII_68PPC2: NAII 68PPC2 (100 MHz oscillator, 8GB DDR3)
8+
#
9+
#CFLAGS_EXTRA+=-DBOARD_CW_VPX3152
10+
#CFLAGS_EXTRA+=-DBOARD_NAII_68PPC2
11+
112
ARCH=PPC
213
TARGET=nxp_t2080
314
SIGN?=ECC384
415
HASH?=SHA384
16+
IMAGE_HEADER_SIZE?=512
517
DEBUG?=0
18+
DEBUG_SYMBOLS?=1
619
DEBUG_UART?=1
720
VTOR?=1
821
CORTEX_M0?=0
@@ -15,27 +28,42 @@ ALLOW_DOWNGRADE?=0
1528
NVM_FLASH_WRITEONCE?=0
1629
WOLFBOOT_VERSION?=0
1730
NO_MPU?=0
18-
SPMATH?=0
19-
SPMATHALL?=1
20-
RAM_CODE?=0
31+
SPMATH?=1
32+
SPMATHALL?=0
33+
RAM_CODE?=1
2134
DUALBANK_SWAP?=0
22-
PKA?=1
2335
WOLFTPM?=0
24-
WOLFBOOT_ORIGIN?=0xEFFF0000
25-
WOLFBOOT_PARTITION_SIZE?=0x20000
26-
WOLFBOOT_SECTOR_SIZE?=0x10000
36+
OPTIMIZATION_LEVEL?=1
37+
38+
# NOR Base Address
39+
ARCH_FLASH_OFFSET?=0xEFFE0000
40+
41+
# Flash Sector Size (must match physical NOR erase block: 128 KB)
42+
WOLFBOOT_SECTOR_SIZE?=0x20000
2743

28-
ARCH_FLASH_OFFSET?=0xEFFF0000
29-
BOOTLOADER_PARTITION_SIZE=0x10000
44+
# wolfBoot start address
45+
WOLFBOOT_ORIGIN?=0xEFFE0000
46+
# wolfBoot partition size (custom)
47+
BOOTLOADER_PARTITION_SIZE=0x20000
3048

31-
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFFD0000
49+
# Application Partition Size
50+
WOLFBOOT_PARTITION_SIZE?=0x20000
51+
# Location in Flash for Application Partition
52+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFFC0000
53+
# Load Partition to RAM Address
3254
WOLFBOOT_LOAD_ADDRESS?=0x19000
33-
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFFB0000
55+
56+
# Location in Flash for Update Partition
57+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFFA0000
3458

3559
# Location of temporary sector used during updates
36-
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFFA0000
60+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFF90000
3761

3862
# DTS (Device Tree)
3963
WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8040000
4064
WOLFBOOT_DTS_UPDATE_ADDRESS?=0xE8050000
65+
# DTS Load to RAM Address
4166
WOLFBOOT_LOAD_DTS_ADDRESS?=0x200000
67+
68+
# Flash erase/write/read test at update partition address
69+
#TEST_FLASH?=1

docs/Targets.md

Lines changed: 105 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,28 +3265,110 @@ Flash factory_custom.bin to NOR base 0xEC00_0000
32653265

32663266
The NXP QorIQ T2080 is a PPC e6500 based processor (four cores). Support has been tested with the NAII 68PPC2.
32673267

3268-
Example configurations for this target are provided in:
3269-
* NXP T2080: [/config/examples/nxp-t2080.config](/config/examples/nxp-t2080.config).
3270-
* NAII 68PPC2: [/config/examples/nxp-t2080-68ppc2.config](/config/examples/nxp-t2080-68ppc2.config).
3268+
Example configuration: [/config/examples/nxp-t2080.config](/config/examples/nxp-t2080.config).
3269+
Stock layout is default; for NAII 68PPC2, uncomment the "# NAII 68PPC2:" lines and comment the stock lines.
32713270

32723271
### Design NXP T2080 PPC
32733272

32743273
The QorIQ requires a Reset Configuration Word (RCW) to define the boot parameters, which resides at the start of the flash (0xE8000000).
32753274

32763275
The flash boot entry point is `0xEFFFFFFC`, which is an offset jump to wolfBoot initialization boot code. Initially the PowerPC core enables only a 4KB region to execute from. The initialization code (`src/boot_ppc_start.S`) sets the required CCSR and TLB for memory addressing and jumps to wolfBoot `main()`.
32773276

3278-
RM 4.3.3 Boot Space Translation
3277+
#### Boot Sequence and Hardware Constraints
3278+
3279+
**Memory Hierarchy:**
3280+
3281+
```
3282+
CPU Core → L1 (32KB I + 32KB D) → L2 (256KB/cluster, shared by 4 cores)
3283+
→ CoreNet Fabric → CPC (2MB, SRAM or L3 cache)
3284+
→ DDR Controller → DDR SDRAM
3285+
→ IFC Controller → NOR Flash
3286+
```
3287+
3288+
Each core begins execution at effective address `0x0_FFFF_FFFC` with a single
3289+
4KB MMU page (RM 4.3.3). The assembly startup (`boot_ppc_start.S`) configures
3290+
TLBs, caches, and stack before jumping to C code.
3291+
3292+
**Cold Boot Stack (L1 Locked D-Cache)**
3293+
3294+
CPC SRAM is unreliable for stores on cold power-on — L1 dirty-line evictions
3295+
through CoreNet to CPC cause bus errors (silent CPU checkstop with `MSR[ME]=0`).
3296+
The fix (matching U-Boot) uses L1 locked D-cache as the initial 16KB stack:
3297+
`dcbz` allocates cache lines without bus reads, `dcbtls` locks them so they
3298+
are never evicted. The locked lines at `L1_CACHE_ADDR` (0xF8E00000) are
3299+
entirely core-local. After DDR init in `hal_init()`, the stack relocates to
3300+
DDR and the CPC switches from SRAM to L3 cache mode.
3301+
3302+
**Flash TLB and XIP**
3303+
3304+
The flash TLB uses `MAS2_W | MAS2_G` (Write-Through + Guarded) during XIP
3305+
boot, allowing L1 I-cache to cache instruction fetches while preventing
3306+
speculative prefetch to the IFC. C code switches to `MAS2_I | MAS2_G` during
3307+
flash write/erase (command mode), then `MAS2_M` for full caching afterward.
3308+
3309+
**RAMFUNCTION Constraints**
3310+
3311+
The NAII 68PPC2 NOR flash (two S29GL01GS x8 in parallel, 16-bit bus) enters
3312+
command mode bank-wide — instruction fetches during program/erase return status
3313+
data instead of code. All flash write/erase functions are marked `RAMFUNCTION`,
3314+
placed in `.ramcode`, copied to DDR, and remapped via TLB9. Key rules:
3315+
3316+
- **No calls to flash-resident code.** The linker generates trampolines that
3317+
jump back to flash addresses. Any helper called from RAMFUNCTION code must
3318+
itself be RAMFUNCTION or fully inlined. Delay ticks are pre-computed in
3319+
`hal_flash_init()` to avoid calling `hal_get_plat_clk()` from flash `.text`.
3320+
- **Inline TLB/cache ops.** `hal_flash_cache_disable/enable` use
3321+
`ram_write_tlb()` (inline mtspr) and direct L1CSR0/L1CSR1 manipulation.
3322+
- **WBP timing.** The write-buffer-program sequence (unlock → 0x25 → count →
3323+
data → 0x29) must execute without bus-stalling delays. UART output between
3324+
steps (~87us per character at 115200) triggers DQ1 abort.
3325+
- **WBP abort recovery.** Plain `AMD_CMD_RESET` (0xF0) is ignored in
3326+
WBP-abort state; the full unlock + 0xF0 sequence is required.
3327+
3328+
**Multi-Core (ENABLE_MP)**
32793329

3280-
"When each core comes out of reset, its MMU has one 4 KB page defined at 0x0_FFFF_Fnnn. Each core begins execution with the instruction at effective address 0x0_FFFF_FFFC. To get this instruction, the core's first instruction fetch is a burst read of boot code from effective address 0x0_FFFF_FFC0."
3330+
The e6500 L2 cache is per-cluster (shared by all 4 cores). Secondary cores
3331+
must skip L2 flash-invalidate (L2FI) since the primary core already
3332+
initialized the shared L2; they only set L1 stash ID via L1CSR2.
3333+
3334+
**e6500 64-bit GPR**
3335+
3336+
The e6500 has 64-bit GPRs even in 32-bit mode. `lis` sign-extends to 64 bits,
3337+
producing incorrect values for addresses >= 0x80000000 (e.g., `lis r3, 0xEFFE`
3338+
`0xFFFFFFFF_EFFE0000`), causing TLB misses on `blr`. The `LOAD_ADDR32`
3339+
macro (`li reg, 0` + `oris` + `ori`) avoids this for all address loads.
3340+
3341+
**MSR Configuration**
3342+
3343+
After the stack is established: `MSR[CE|ME|DE|RI]` — critical interrupt,
3344+
machine check (exceptions instead of checkstop), debug, and recoverable
3345+
interrupt enable. Branch prediction (BUCSR) is deferred to `hal_init()` after
3346+
DDR stack relocation.
3347+
3348+
**UART Debug Checkpoints (`DEBUG_UART=1`)**
3349+
3350+
Assembly startup emits characters to UART0 (0xFE11C500, 115200 baud):
3351+
3352+
```
3353+
1 - CPC invalidate start A - L2 cluster enable start
3354+
2 - CPC invalidate done B - L2 cluster enabled
3355+
3 - CPC SRAM configured E - L1 cache setup
3356+
4 - SRAM LAW configured F - L1 I-cache enabled
3357+
5 - Flash TLB configured G - L1 D-cache enabled
3358+
6 - CCSRBAR TLB configured D - Stack ready (L1 locked cache)
3359+
7 - SRAM TLB configured Z - About to jump to C code
3360+
8 - CPC enabled
3361+
```
32813362

32823363
### Building wolfBoot for NXP T2080 PPC
32833364

32843365
By default wolfBoot will use `powerpc-linux-gnu-` cross-compiler prefix. These tools can be installed with the Debian package `gcc-powerpc-linux-gnu` (`sudo apt install gcc-powerpc-linux-gnu`).
32853366

32863367
The `make` creates a `factory.bin` image that can be programmed at `0xE8080000`
3368+
(For NAII 68PPC2, first edit `nxp-t2080.config` to uncomment the NAII 68PPC2 lines.)
32873369

32883370
```
3289-
cp ./config/examples/nxp-t2080-68ppc2.config .config
3371+
cp ./config/examples/nxp-t2080.config .config
32903372
make clean
32913373
make keytools
32923374
make
@@ -3329,26 +3411,32 @@ Flash Layout (with files):
33293411

33303412
Or program the `factory.bin` to `0xE8080000`
33313413

3332-
Example Boot Debug Output:
3414+
Example Boot Debug Output (with `DEBUG_UART=1`):
33333415

33343416
```
33353417
wolfBoot Init
3336-
Part: Active 0, Address E8080000
3337-
Image size 1028
3418+
Build: Mar 3 2026 13:22:20
3419+
IFC CSPR0: 0x141 (WP set)
3420+
Ramcode: copied 5584 bytes to DDR, TLB9 remapped
3421+
CPC: Released SRAM, full 2MB L3 CPC cache enabled
3422+
Flash: caching enabled (L1+L2+CPC)
3423+
MP: Starting cores (boot page 0x7FFFF000, spin table 0x7FFFE100)
3424+
Versions: Boot 1, Update 0
3425+
Trying Boot partition at 0xEFFC0000
3426+
Boot partition: 0xEFFC0000 (sz 3468, ver 0x1, type 0x601)
3427+
Checking integrity...done
3428+
Verifying signature...done
3429+
Successfully selected image in part: 0
33383430
Firmware Valid
3339-
Loading 1028 bytes to RAM at 19000
3340-
Failed parsing DTB to load.
3341-
Booting at 19000
3431+
Copying image from 0xEFFC0200 to RAM at 0x19000 (3468 bytes)
3432+
Failed parsing DTB to load
3433+
Booting at 0x19000
3434+
FDT: Invalid header! -1
33423435
Test App
33433436
33443437
0x00000001
33453438
0x00000002
33463439
0x00000003
3347-
0x00000004
3348-
0x00000005
3349-
0x00000006
3350-
0x00000007
3351-
...
33523440
```
33533441

33543442
#### Flash Programming with Lauterbach

0 commit comments

Comments
 (0)