Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,6 @@ jobs:
arch: ppc
config-file: ./config/examples/nxp-t1024.config

nxp_t2080_68ppc2_test:
uses: ./.github/workflows/test-build.yml
with:
arch: ppc
config-file: ./config/examples/nxp-t2080-68ppc2.config

nxp_t2080_test:
uses: ./.github/workflows/test-build.yml
with:
Expand Down
10 changes: 9 additions & 1 deletion arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,19 @@ endif
ifeq ($(ARCH),PPC)
CROSS_COMPILE?=powerpc-linux-gnu-
LDFLAGS+=-Wl,--build-id=none
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY -ffreestanding -fno-tree-loop-distribute-patterns

ifeq ($(DEBUG_UART),0)
CFLAGS+=-fno-builtin-printf
endif

# Target-specific CPU flags
ifeq ($(TARGET),nxp_t2080)
CFLAGS+=-mcpu=e6500 -mno-altivec -mbss-plt
else ifeq ($(TARGET),nxp_t1024)
CFLAGS+=-mcpu=e5500
endif

# Prune unused functions and data
CFLAGS+=-ffunction-sections -fdata-sections
LDFLAGS+=-Wl,--gc-sections
Expand Down Expand Up @@ -994,6 +1001,7 @@ ifeq ($(TARGET),nxp_t2080)
LDFLAGS+=$(ARCH_FLAGS)
LDFLAGS+=-Wl,--hash-style=both # generate both sysv and gnu symbol hash table
LDFLAGS+=-Wl,--as-needed # remove weak functions not used
OBJS+=src/boot_ppc_mp.o # support for spin table
UPDATE_OBJS:=src/update_ram.o
OBJS+=src/fdt.o
endif
Expand Down
55 changes: 0 additions & 55 deletions config/examples/nxp-t2080-68ppc2.config

This file was deleted.

44 changes: 35 additions & 9 deletions config/examples/nxp-t2080.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# NXP T2080 wolfBoot Configuration Template
#
# Stock (default): Compact layout, NOR base 0xEFFE0000
# NAII 68PPC2 (alternate): Larger app partition, NOR base 0xE8000000
# Uncomment the "# NAII 68PPC2:" lines and comment the stock lines to use.

ARCH=PPC
TARGET=nxp_t2080
SIGN?=ECC384
HASH?=SHA384
IMAGE_HEADER_SIZE?=512
DEBUG?=0
DEBUG_SYMBOLS?=1
DEBUG_UART?=1
VTOR?=1
CORTEX_M0?=0
Expand All @@ -17,25 +25,43 @@ WOLFBOOT_VERSION?=0
NO_MPU?=0
SPMATH?=0
SPMATHALL?=1
RAM_CODE?=0
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=1
WOLFTPM?=0
WOLFBOOT_ORIGIN?=0xEFFF0000
WOLFBOOT_PARTITION_SIZE?=0x20000

# NOR Base Address
ARCH_FLASH_OFFSET?=0xEFFE0000
# NAII 68PPC2: ARCH_FLASH_OFFSET?=0xE8000000

# Flash Sector Size
WOLFBOOT_SECTOR_SIZE?=0x10000

ARCH_FLASH_OFFSET?=0xEFFF0000
BOOTLOADER_PARTITION_SIZE=0x10000
# wolfBoot start address
WOLFBOOT_ORIGIN?=0xEFFE0000
# NAII 68PPC2: WOLFBOOT_ORIGIN?=0xEFF40000
# wolfBoot partition size (custom)
BOOTLOADER_PARTITION_SIZE=0x20000

WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFFD0000
# Application Partition Size
WOLFBOOT_PARTITION_SIZE?=0x20000
# NAII 68PPC2: WOLFBOOT_PARTITION_SIZE?=0xA00000
# Location in Flash for Application Partition
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFFC0000
# NAII 68PPC2: WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xE8080000
# Load Partition to RAM Address
WOLFBOOT_LOAD_ADDRESS?=0x19000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFFB0000

# Location in Flash for Update Partition
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFFA0000
# NAII 68PPC2: WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xE8A80000

# Location of temporary sector used during updates
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFFA0000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFF90000
# NAII 68PPC2: WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xE8060000

# DTS (Device Tree)
WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8040000
WOLFBOOT_DTS_UPDATE_ADDRESS?=0xE8050000
# DTS Load to RAM Address
WOLFBOOT_LOAD_DTS_ADDRESS?=0x200000
# NAII 68PPC2: WOLFBOOT_LOAD_DTS_ADDRESS?=0x40000
8 changes: 4 additions & 4 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -3061,9 +3061,8 @@ Flash factory_custom.bin to NOR base 0xEC00_0000

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

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

### Design NXP T2080 PPC

Expand All @@ -3080,9 +3079,10 @@ RM 4.3.3 Boot Space Translation
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`).

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

```
cp ./config/examples/nxp-t2080-68ppc2.config .config
cp ./config/examples/nxp-t2080.config .config
make clean
make keytools
make
Expand Down
76 changes: 62 additions & 14 deletions hal/nxp_ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
#define USE_LONG_JUMP

#elif defined(TARGET_nxp_t2080)
/* NXP T0280 */
/* NXP T2080 */
#define CORE_E6500
#define CPU_NUMCORES 4
#define CORES_PER_CLUSTER 4
Expand All @@ -118,19 +118,22 @@
#define ENABLE_L1_CACHE
#define ENABLE_L2_CACHE

#define L2SRAM_ADDR (0xF8F80000UL) /* L2 as SRAM */
#define L2SRAM_SIZE (256UL * 1024UL)
#define L2SRAM_ADDR (0xF8F00000UL) /* CPC as SRAM (1MB) */
#define L2SRAM_SIZE (1024UL * 1024UL)

#define INITIAL_SRAM_ADDR L2SRAM_ADDR
#define INITIAL_SRAM_LAW_SZ LAW_SIZE_256KB
/* CPC SRAM transactions traverse the CoreNet interconnect, which
* requires a LAW to route them. LAW_TRGT_DDR_1 is used as a routing
* target; the CPC intercepts the transaction before it reaches DDR. */
#define INITIAL_SRAM_LAW_SZ LAW_SIZE_1MB
#define INITIAL_SRAM_LAW_TRGT LAW_TRGT_DDR_1
#define INITIAL_SRAM_BOOKE_SZ BOOKE_PAGESZ_256K
#define INITIAL_SRAM_BOOKE_SZ BOOKE_PAGESZ_1M

#define ENABLE_INTERRUPTS

#define ENABLE_DDR
#ifndef DDR_SIZE
#define DDR_SIZE (8192UL * 1024UL * 1024UL)
#define DDR_SIZE (8192ULL * 1024ULL * 1024ULL)
#endif

#define FLASH_BASE_ADDR 0xE8000000UL
Expand Down Expand Up @@ -285,20 +288,23 @@
#define CPC_BASE (CCSRBAR + 0x10000)
/* 8.2 CoreNet Platform Cache (CPC) Memory Map */
#define CPCCSR0 (0x000)
#define CPCEWCR0 (0x010)
#define CPCSRCR1 (0x100)
#define CPCSRCR0 (0x104)
#define CPCERRDIS (0xE44)
#define CPCHDBCR0 (0xF00)

#define CPCCSR0_CPCE (0x80000000 >> 0)
#define CPCCSR0_CPCPE (0x80000000 >> 1)
#define CPCCSR0_CPCFI (0x80000000 >> 10)
#define CPCCSR0_CPCFL (0x80000000 >> 20)
#define CPCCSR0_CPCLFC (0x80000000 >> 21)
#define CPCCSR0_SRAM_ENABLE (CPCCSR0_CPCE | CPCCSR0_CPCPE)

#ifdef CORE_E6500
#define CPCSRCR0_SRAMSZ_64 (0x1 << 1) /* ways 14-15 */
#define CPCSRCR0_SRAMSZ_256 (0x3 << 1) /* ways 8-15 */
#define CPCSRCR0_SRAMSZ_512 (0x4 << 1) /* ways 0-15 */
/* T2080: 2MB CPC, 16 ways, 128KB per way */
#define CPCSRCR0_SRAMSZ_256 (0x1 << 1) /* ways 14-15, 256KB */
#define CPCSRCR0_SRAMSZ_1024 (0x3 << 1) /* ways 8-15, 1MB */
#define CPCSRCR0_SRAMSZ_2048 (0x4 << 1) /* ways 0-15, 2MB */
#else /* CORE E5500 */
#define CPCSRCR0_SRAMSZ_64 (0x1 << 1) /* ways 6-7 */
#define CPCSRCR0_SRAMSZ_128 (0x2 << 1) /* ways 4-7 */
Expand Down Expand Up @@ -483,13 +489,21 @@

#define SPRN_DBSR 0x130 /* Debug Status Register */
#define SPRN_DEC 0x016 /* Decrement Register */
#define SPRN_TSR 0x3D8 /* Timer Status Register */

#define SPRN_TCR 0x3DA /* Timer Control Register */
#ifdef CORE_E6500
#define SPRN_TSR 0x150 /* Timer Status Register (SPR 336) */
#define SPRN_TCR 0x154 /* Timer Control Register (SPR 340) */
#define SPRN_DEAR 0x03D /* Data Exception Address Register (SPR 61) */
#define SPRN_ESR 0x03E /* Exception Syndrome Register (SPR 62) */
#else
#define SPRN_TSR 0x3D8 /* Timer Status Register */
#define SPRN_TCR 0x3DA /* Timer Control Register */
#define SPRN_DEAR 0x3D5 /* Data Exception Address Register */
#define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
#endif

#define TCR_WIE 0x08000000 /* Watchdog Interrupt Enable */
#define TCR_DIE 0x04000000 /* Decrement Interrupt Enable */

#define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
#define SPRN_MCSR 0x23C /* Machine Check Syndrome Register */
#define SPRN_PVR 0x11F /* Processor Version */
#define SPRN_SVR 0x3FF /* System Version */
Expand Down Expand Up @@ -524,6 +538,8 @@

#define SRR0 0x01A /* Save/Restore Register 0 */
#define SRR1 0x01B /* Save/Restore Register 1 */
#define SPRN_MCSRR0 0x23A /* Machine Check Save/Restore Register 0 */
#define SPRN_MCSRR1 0x23B /* Machine Check Save/Restore Register 1 */

#define MSR_DS (1<<4) /* Book E Data address space */
#define MSR_IS (1<<5) /* Book E Instruction address space */
Expand Down Expand Up @@ -674,6 +690,37 @@ extern void dcache_disable(void);

#else
/* Assembly version */
#ifdef CORE_E6500
/* e6500 has 64-bit MAS registers - must clear upper 32 bits.
* Using lis would sign-extend values with bit 15 set (e.g., 0xC000xxxx).
* Use li 0; oris; ori pattern for all MAS registers. */
#define set_tlb(tlb, esel, epn, rpn, urpn, perms, winge, ts, tsize, iprot, reg) \
li reg, 0; \
oris reg, reg, BOOKE_MAS0(tlb, esel, 0)@h; \
ori reg, reg, BOOKE_MAS0(tlb, esel, 0)@l; \
mtspr MAS0, reg;\
li reg, 0; \
oris reg, reg, BOOKE_MAS1(1, iprot, 0, ts, tsize)@h; \
ori reg, reg, BOOKE_MAS1(1, iprot, 0, ts, tsize)@l; \
mtspr MAS1, reg; \
li reg, 0; \
oris reg, reg, BOOKE_MAS2(epn, winge)@h; \
ori reg, reg, BOOKE_MAS2(epn, winge)@l; \
mtspr MAS2, reg; \
li reg, 0; \
oris reg, reg, BOOKE_MAS3(rpn, 0, perms)@h; \
ori reg, reg, BOOKE_MAS3(rpn, 0, perms)@l; \
mtspr MAS3, reg; \
li reg, 0; \
oris reg, reg, urpn@h; \
ori reg, reg, urpn@l; \
mtspr MAS7, reg; \
isync; \
msync; \
tlbwe; \
isync;
#else
/* e500/e5500 - 32-bit MAS registers */
#define set_tlb(tlb, esel, epn, rpn, urpn, perms, winge, ts, tsize, iprot, reg) \
lis reg, BOOKE_MAS0(tlb, esel, 0)@h; \
ori reg, reg, BOOKE_MAS0(tlb, esel, 0)@l; \
Expand All @@ -694,6 +741,7 @@ extern void dcache_disable(void);
msync; \
tlbwe; \
isync;
#endif /* CORE_E6500 */

/* readability helpers for assembly to show register versus decimal */
#define r0 0
Expand Down
Loading
Loading