Skip to content
Open
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
14 changes: 13 additions & 1 deletion arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,19 @@ ifneq ($(filter nxp_t1024 nxp_t1040,$(TARGET)),)
OBJS+=src/fdt.o
OBJS+=src/pci.o
CFLAGS+=-DWOLFBOOT_USE_PCI
UPDATE_OBJS:=src/update_ram.o
# Disk boot from SD card (eSDHC controller, driver hal/nxp_esdhc.c).
# src/gpt.o is already linked for all PPC targets above. The driver is
# kept out of the size-constrained stage1 loader.
ifneq ($(filter 1,$(DISK_SDCARD) $(DISK_EMMC)),)
CFLAGS+=-D"WOLFBOOT_UPDATE_DISK" -D"MAX_DISKS=1"
UPDATE_OBJS:=src/update_disk.o
OBJS+=src/disk.o
ifneq ($(STAGE1),1)
OBJS+=hal/nxp_esdhc.o
endif
else
UPDATE_OBJS:=src/update_ram.o
endif

SPI_TARGET=nxp
OPTIMIZATION_LEVEL=0 # using default -Os causes issues with alignment
Expand Down
82 changes: 82 additions & 0 deletions config/examples/nxp-t1040-sdcard.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# NXP QorIQ T1040 (4 core) with SD card disk boot
#
# Same as nxp-t1040.config, but the signed application image is loaded
# from an SD card (eSDHC controller) instead of NOR flash. The card is
# GPT (or MBR) partitioned; the signed image sits at offset 0 of the
# first two partitions (BOOT_PART_A / BOOT_PART_B, 0-based indexes into
# the partition table). wolfBoot picks the slot with the higher version,
# verifies it and boots it from RAM (src/update_disk.c).

ARCH=PPC
TARGET=nxp_t1040
SIGN?=ECC384
HASH?=SHA384
IMAGE_HEADER_SIZE?=512
DEBUG?=0
DEBUG_UART?=1
VTOR?=1
CORTEX_M0?=0
NO_ASM?=0
EXT_FLASH?=0
SPI_FLASH?=0
NO_XIP?=0
UART_FLASH?=0
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=0
WOLFBOOT_VERSION?=0
NO_MPU?=0
SPMATH?=0
SPMATHALL?=1
RAM_CODE?=0
DUALBANK_SWAP?=0
WOLFTPM?=0
ELF?=1
DEBUG_ELF=0

# SD card disk boot (Freescale eSDHC driver, hal/nxp_esdhc.c)
DISK_SDCARD=1
# Upper bound for the unauthenticated image size read from disk
WOLFBOOT_RAMBOOT_MAX_SIZE?=0xF00000
# Boot slots: partition table indexes (0-based) and read chunk size
CFLAGS_EXTRA+=-DBOOT_PART_A=0 -DBOOT_PART_B=1
CFLAGS_EXTRA+=-DDISK_BLOCK_SIZE=0x8000
# eSDHC bring-up trace on the DUART console
#CFLAGS_EXTRA+=-DDEBUG_ESDHC

# NOR Base Address (128MB NOR at 0xE8000000 - 0xEFFFFFFF)
ARCH_FLASH_OFFSET?=0xE8000000

# Flash Sector Size (128KB)
WOLFBOOT_SECTOR_SIZE=0x20000

# wolfBoot start address (same as T1024 - NOR top is 0xEFFFFFFF)
WOLFBOOT_ORIGIN=0xEFF40000
# wolfBoot partition size (custom)
BOOTLOADER_PARTITION_SIZE=0xC0000

# Application Partition Size (15MB)
WOLFBOOT_PARTITION_SIZE?=0xF00000
# Location in Flash for Application Partition (unused for disk boot,
# kept for target.h consistency)
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEE000000
# Load Partition to RAM Address
WOLFBOOT_LOAD_ADDRESS?=0x70000000

# Location in Flash for Update Partition
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEEF00000

# Location of temporary sector used during updates
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xE80F0000

# Stage 1 loader settings (16KB)
WOLFBOOT_STAGE1_SIZE=0x4000
# Location in Flash for stage 1 loader (XIP from boot ROM)
WOLFBOOT_STAGE1_FLASH_ADDR=0xEFFFC000
# Address in RAM to load wolfBoot (end of DDR at 2GB-1MB for 32-bit addressing)
WOLFBOOT_STAGE1_LOAD_ADDR=0x7FF00000

# DTS (Device Tree)
WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8800000
WOLFBOOT_DTS_UPDATE_ADDRESS?=0xE8820000
# DTS Load to RAM Address
WOLFBOOT_LOAD_DTS_ADDRESS?=0x7F100000
17 changes: 17 additions & 0 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -6221,6 +6221,23 @@ Flash factory_custom.bin to NOR base 0xEC00_0000

Flash factory_custom.bin to NOR base 0xE800_0000

### T1040 SD Card Boot (eSDHC)

The T1040 can also load the signed application image from an SD card using the on-chip Freescale eSDHC controller (driver: `hal/nxp_esdhc.c`, included by the HAL translation unit). Use `config/examples/nxp-t1040-sdcard.config`, which enables `DISK_SDCARD=1` so wolfBoot links the disk boot path (`src/update_disk.c`) instead of the RAM loader.

The card is GPT (or MBR) partitioned. The signed image is written at offset 0 of the boot partitions; `BOOT_PART_A` and `BOOT_PART_B` are 0-based indexes into the partition table. wolfBoot reads the image header from both slots, picks the higher version, loads it to `WOLFBOOT_LOAD_ADDRESS`, verifies the signature and boots it.

Example card layout with two 16 MB raw slots:

```
sgdisk -Z /dev/sdX
sgdisk -n 1:0:+16M -t 1:8300 -n 2:0:+16M -t 2:8300 /dev/sdX
dd if=test-app/image_v1_signed.bin of=/dev/sdX1
dd if=test-app/image_v2_signed.bin of=/dev/sdX2
```

`WOLFBOOT_RAMBOOT_MAX_SIZE` bounds the image size read from disk before authentication. Define `DEBUG_ESDHC` (see the config) for controller bring-up trace on the DUART console.


## NXP QorIQ T2080 PPC

Expand Down
Loading
Loading