Skip to content

Commit 9ffdbd0

Browse files
committed
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 2277dfa commit 9ffdbd0

File tree

17 files changed

+2175
-918
lines changed

17 files changed

+2175
-918
lines changed

.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
@@ -627,12 +627,19 @@ endif
627627
ifeq ($(ARCH),PPC)
628628
CROSS_COMPILE?=powerpc-linux-gnu-
629629
LDFLAGS+=-Wl,--build-id=none
630-
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY
630+
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY -ffreestanding -fno-tree-loop-distribute-patterns
631631

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

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

10011011
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
@@ -3065,28 +3065,110 @@ Flash factory_custom.bin to NOR base 0xEC00_0000
30653065

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

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

30723071
### Design NXP T2080 PPC
30733072

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

30763075
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()`.
30773076

3078-
RM 4.3.3 Boot Space Translation
3077+
#### Boot Sequence and Hardware Constraints
3078+
3079+
**Memory Hierarchy:**
3080+
3081+
```
3082+
CPU Core → L1 (32KB I + 32KB D) → L2 (256KB/cluster, shared by 4 cores)
3083+
→ CoreNet Fabric → CPC (2MB, SRAM or L3 cache)
3084+
→ DDR Controller → DDR SDRAM
3085+
→ IFC Controller → NOR Flash
3086+
```
3087+
3088+
Each core begins execution at effective address `0x0_FFFF_FFFC` with a single
3089+
4KB MMU page (RM 4.3.3). The assembly startup (`boot_ppc_start.S`) configures
3090+
TLBs, caches, and stack before jumping to C code.
3091+
3092+
**Cold Boot Stack (L1 Locked D-Cache)**
3093+
3094+
CPC SRAM is unreliable for stores on cold power-on — L1 dirty-line evictions
3095+
through CoreNet to CPC cause bus errors (silent CPU checkstop with `MSR[ME]=0`).
3096+
The fix (matching U-Boot) uses L1 locked D-cache as the initial 16KB stack:
3097+
`dcbz` allocates cache lines without bus reads, `dcbtls` locks them so they
3098+
are never evicted. The locked lines at `L1_CACHE_ADDR` (0xF8E00000) are
3099+
entirely core-local. After DDR init in `hal_init()`, the stack relocates to
3100+
DDR and the CPC switches from SRAM to L3 cache mode.
3101+
3102+
**Flash TLB and XIP**
3103+
3104+
The flash TLB uses `MAS2_W | MAS2_G` (Write-Through + Guarded) during XIP
3105+
boot, allowing L1 I-cache to cache instruction fetches while preventing
3106+
speculative prefetch to the IFC. C code switches to `MAS2_I | MAS2_G` during
3107+
flash write/erase (command mode), then `MAS2_M` for full caching afterward.
3108+
3109+
**RAMFUNCTION Constraints**
3110+
3111+
The NAII 68PPC2 NOR flash (two S29GL01GS x8 in parallel, 16-bit bus) enters
3112+
command mode bank-wide — instruction fetches during program/erase return status
3113+
data instead of code. All flash write/erase functions are marked `RAMFUNCTION`,
3114+
placed in `.ramcode`, copied to DDR, and remapped via TLB9. Key rules:
3115+
3116+
- **No calls to flash-resident code.** The linker generates trampolines that
3117+
jump back to flash addresses. Any helper called from RAMFUNCTION code must
3118+
itself be RAMFUNCTION or fully inlined. Delay ticks are pre-computed in
3119+
`hal_flash_init()` to avoid calling `hal_get_plat_clk()` from flash `.text`.
3120+
- **Inline TLB/cache ops.** `hal_flash_cache_disable/enable` use
3121+
`ram_write_tlb()` (inline mtspr) and direct L1CSR0/L1CSR1 manipulation.
3122+
- **WBP timing.** The write-buffer-program sequence (unlock → 0x25 → count →
3123+
data → 0x29) must execute without bus-stalling delays. UART output between
3124+
steps (~87us per character at 115200) triggers DQ1 abort.
3125+
- **WBP abort recovery.** Plain `AMD_CMD_RESET` (0xF0) is ignored in
3126+
WBP-abort state; the full unlock + 0xF0 sequence is required.
3127+
3128+
**Multi-Core (ENABLE_MP)**
30793129

3080-
"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."
3130+
The e6500 L2 cache is per-cluster (shared by all 4 cores). Secondary cores
3131+
must skip L2 flash-invalidate (L2FI) since the primary core already
3132+
initialized the shared L2; they only set L1 stash ID via L1CSR2.
3133+
3134+
**e6500 64-bit GPR**
3135+
3136+
The e6500 has 64-bit GPRs even in 32-bit mode. `lis` sign-extends to 64 bits,
3137+
producing incorrect values for addresses >= 0x80000000 (e.g., `lis r3, 0xEFFE`
3138+
`0xFFFFFFFF_EFFE0000`), causing TLB misses on `blr`. The `LOAD_ADDR32`
3139+
macro (`li reg, 0` + `oris` + `ori`) avoids this for all address loads.
3140+
3141+
**MSR Configuration**
3142+
3143+
After the stack is established: `MSR[CE|ME|DE|RI]` — critical interrupt,
3144+
machine check (exceptions instead of checkstop), debug, and recoverable
3145+
interrupt enable. Branch prediction (BUCSR) is deferred to `hal_init()` after
3146+
DDR stack relocation.
3147+
3148+
**UART Debug Checkpoints (`DEBUG_UART=1`)**
3149+
3150+
Assembly startup emits characters to UART0 (0xFE11C500, 115200 baud):
3151+
3152+
```
3153+
1 - CPC invalidate start A - L2 cluster enable start
3154+
2 - CPC invalidate done B - L2 cluster enabled
3155+
3 - CPC SRAM configured E - L1 cache setup
3156+
4 - SRAM LAW configured F - L1 I-cache enabled
3157+
5 - Flash TLB configured G - L1 D-cache enabled
3158+
6 - CCSRBAR TLB configured D - Stack ready (L1 locked cache)
3159+
7 - SRAM TLB configured Z - About to jump to C code
3160+
8 - CPC enabled
3161+
```
30813162

30823163
### Building wolfBoot for NXP T2080 PPC
30833164

30843165
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`).
30853166

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

30883170
```
3089-
cp ./config/examples/nxp-t2080-68ppc2.config .config
3171+
cp ./config/examples/nxp-t2080.config .config
30903172
make clean
30913173
make keytools
30923174
make
@@ -3129,26 +3211,32 @@ Flash Layout (with files):
31293211

31303212
Or program the `factory.bin` to `0xE8080000`
31313213

3132-
Example Boot Debug Output:
3214+
Example Boot Debug Output (with `DEBUG_UART=1`):
31333215

31343216
```
31353217
wolfBoot Init
3136-
Part: Active 0, Address E8080000
3137-
Image size 1028
3218+
Build: Mar 3 2026 13:22:20
3219+
IFC CSPR0: 0x141 (WP set)
3220+
Ramcode: copied 5584 bytes to DDR, TLB9 remapped
3221+
CPC: Released SRAM, full 2MB L3 CPC cache enabled
3222+
Flash: caching enabled (L1+L2+CPC)
3223+
MP: Starting cores (boot page 0x7FFFF000, spin table 0x7FFFE100)
3224+
Versions: Boot 1, Update 0
3225+
Trying Boot partition at 0xEFFC0000
3226+
Boot partition: 0xEFFC0000 (sz 3468, ver 0x1, type 0x601)
3227+
Checking integrity...done
3228+
Verifying signature...done
3229+
Successfully selected image in part: 0
31383230
Firmware Valid
3139-
Loading 1028 bytes to RAM at 19000
3140-
Failed parsing DTB to load.
3141-
Booting at 19000
3231+
Copying image from 0xEFFC0200 to RAM at 0x19000 (3468 bytes)
3232+
Failed parsing DTB to load
3233+
Booting at 0x19000
3234+
FDT: Invalid header! -1
31423235
Test App
31433236
31443237
0x00000001
31453238
0x00000002
31463239
0x00000003
3147-
0x00000004
3148-
0x00000005
3149-
0x00000006
3150-
0x00000007
3151-
...
31523240
```
31533241

31543242
#### Flash Programming with Lauterbach

0 commit comments

Comments
 (0)