Skip to content

Commit 50a9985

Browse files
committed
Add wolfBoot target for Infineon PSOC Edge E8
1 parent 8685a5a commit 50a9985

13 files changed

Lines changed: 1395 additions & 13 deletions

File tree

‎.github/workflows/test-configs.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,27 @@ jobs:
10191019
arch: arm
10201020
config-file: ./config/examples/stm32c5.config
10211021

1022+
psoc_e8_test:
1023+
uses: ./.github/workflows/test-build.yml
1024+
with:
1025+
arch: arm
1026+
config-file: ./config/examples/psoc_e8_ai.config
1027+
1028+
psoc_e8_wolfcrypt_test:
1029+
uses: ./.github/workflows/test-build.yml
1030+
with:
1031+
arch: arm
1032+
config-file: ./config/examples/psoc_e8_ai.config
1033+
make-args: WOLFCRYPT_TEST=1 WOLFCRYPT_BENCHMARK=1
1034+
1035+
# wolfBoot linked into RRAM, partitions still in QSPI.
1036+
psoc_e8_rram_test:
1037+
uses: ./.github/workflows/test-build.yml
1038+
with:
1039+
arch: arm
1040+
config-file: ./config/examples/psoc_e8_ai.config
1041+
make-args: PSOC_E8_BOOT_RRAM=1
1042+
10221043
psoc_c3_test:
10231044
uses: ./.github/workflows/test-build.yml
10241045
with:

‎arch.mk‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,46 @@ ifeq ($(ARCH),ARM)
758758
CFLAGS+=-DPSOC_C3_I2C_HSIOM_SEL=$(PSOC_C3_I2C_HSIOM_SEL)
759759
CFLAGS+=-DPSOC_C3_I2C_HZ=$(PSOC_C3_I2C_HZ)
760760
endif
761+
ifeq ($(TARGET),psoc_e8)
762+
CORTEX_M33=1
763+
CFLAGS+=-Ihal
764+
# Extended boot runs the first CM33 image in place, after a 0x400 MCUboot
765+
# header: from QSPI by default, or from RRAM with PSOC_E8_BOOT_RRAM=1
766+
# (needs the boot policy reprovisioned). ARCH_FLASH_OFFSET is the slot.
767+
PSOC_E8_BOOT_RRAM?=0
768+
ifeq ($(PSOC_E8_BOOT_RRAM),1)
769+
PSOC_E8_RRAM_SLOT_SIZE?=0x20000
770+
ARCH_FLASH_OFFSET=0x12011000
771+
WOLFBOOT_ORIGIN=0x12011400
772+
BOOTLOADER_PARTITION_SIZE=$$(( $(PSOC_E8_RRAM_SLOT_SIZE) - 0x400))
773+
else
774+
ARCH_FLASH_OFFSET=0x18100000
775+
WOLFBOOT_ORIGIN=0x18100400
776+
BOOTLOADER_PARTITION_SIZE=$$(( $(WOLFBOOT_PARTITION_BOOT_ADDRESS) - $(WOLFBOOT_ORIGIN)))
777+
endif
778+
LSCRIPT_IN=hal/$(TARGET).ld
779+
# Board wiring, defaulted for KIT_PSE84_AI.
780+
PSOC_E8_UART_SCB?=2
781+
PSOC_E8_UART_PORT?=6
782+
PSOC_E8_UART_RX_PIN?=5
783+
PSOC_E8_UART_TX_PIN?=7
784+
PSOC_E8_UART_HSIOM_SEL?=20
785+
PSOC_E8_UART_PCLK_GR?=1
786+
PSOC_E8_UART_PCLK_IDX?=1
787+
PSOC_E8_PCLK_HZ?=100000000
788+
PSOC_E8_QSPI_SECTOR_SIZE?=0x40000
789+
PSOC_E8_CPU_HZ?=200000000
790+
CFLAGS+=-DPSOC_E8_UART_SCB=$(PSOC_E8_UART_SCB)
791+
CFLAGS+=-DPSOC_E8_UART_PORT=$(PSOC_E8_UART_PORT)
792+
CFLAGS+=-DPSOC_E8_UART_RX_PIN=$(PSOC_E8_UART_RX_PIN)
793+
CFLAGS+=-DPSOC_E8_UART_TX_PIN=$(PSOC_E8_UART_TX_PIN)
794+
CFLAGS+=-DPSOC_E8_UART_HSIOM_SEL=$(PSOC_E8_UART_HSIOM_SEL)
795+
CFLAGS+=-DPSOC_E8_UART_PCLK_GR=$(PSOC_E8_UART_PCLK_GR)
796+
CFLAGS+=-DPSOC_E8_UART_PCLK_IDX=$(PSOC_E8_UART_PCLK_IDX)
797+
CFLAGS+=-DPSOC_E8_PCLK_HZ=$(PSOC_E8_PCLK_HZ)
798+
CFLAGS+=-DPSOC_E8_QSPI_SECTOR_SIZE=$(PSOC_E8_QSPI_SECTOR_SIZE)
799+
CFLAGS+=-DPSOC_E8_CPU_HZ=$(PSOC_E8_CPU_HZ)
800+
endif
761801
ifeq ($(TARGET),m2354)
762802
CORTEX_M23=1
763803
CFLAGS+=-Ihal

‎config/examples/psoc_e8_ai.config‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ARCH?=ARM
2+
TARGET?=psoc_e8
3+
SIGN?=ECC256
4+
HASH?=SHA256
5+
DEBUG?=0
6+
VTOR?=1
7+
CORTEX_M33?=1
8+
TZEN?=0
9+
NO_ASM?=0
10+
NO_MPU=1
11+
EXT_FLASH?=0
12+
SPI_FLASH?=0
13+
ALLOW_DOWNGRADE?=0
14+
# The QSPI NOR rejects a second program into a 16-byte ECC unit.
15+
NVM_FLASH_WRITEONCE?=1
16+
WOLFBOOT_VERSION?=1
17+
V?=0
18+
SPMATH?=1
19+
RAM_CODE?=1
20+
DUALBANK_SWAP?=0
21+
DEBUG_UART=1
22+
# Keeps the application vector table 1 KB aligned.
23+
IMAGE_HEADER_SIZE?=1024
24+
25+
# KIT_PSE84_AI: 64 MB QSPI NOR, 256 KB sectors, Secure code-bus alias.
26+
#
27+
# 0x18100000 - 0x1813FFFF wolfBoot slot: 0x400 MCUboot header + wolfBoot
28+
# 0x18140000 - 0x1823FFFF BOOT (1 MB)
29+
# 0x18240000 - 0x1833FFFF UPDATE (1 MB)
30+
# 0x18340000 - 0x1837FFFF SWAP (one sector)
31+
#
32+
# Board wiring: PSOC_E8_* make options in arch.mk, see docs/Targets.md.
33+
WOLFBOOT_SECTOR_SIZE?=0x40000
34+
WOLFBOOT_PARTITION_SIZE?=0x100000
35+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x18140000
36+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x18240000
37+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x18340000

‎docs/Targets.md‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This README describes configuration of supported targets.
1111
* [Cortex-A72 / Raspberry Pi Compute Module 4](#cortex-a72--raspberry-pi-compute-module-4-bcm2711)
1212
* [Cypress PSoC-6](#cypress-psoc-6)
1313
* [Infineon PSOC Control C3](#infineon-psoc-control-c3)
14+
* [Infineon PSOC Edge E8](#infineon-psoc-edge-e8)
1415
* [Infineon AURIX TC3xx](#infineon-aurix-tc3xx)
1516
* [Infineon AURIX TC4xx](#infineon-aurix-tc4xx)
1617
* [Intel x86-64 Intel FSP](#intel-x86_64-with-intel-fsp-support)
@@ -9877,6 +9878,76 @@ A TPM that offers both buses latches its choice from a strap while its own reset
98779878

98789879
Every FIFO and bus wait in both drivers is bounded, so a device that is absent or unpowered makes `wolfBoot_tpm2_init()` report a failure rather than wedging the bootloader in a spin loop.
98799880

9881+
## Infineon PSOC Edge E8
9882+
9883+
The Infineon PSOC Edge E8 family (PSE8x, CAT1D) pairs a Cortex-M33 with TrustZone and a Cortex-M55 behind a Secure Enclave, which runs the boot ROM and Infineon's extended boot. wolfBoot runs on the CM33 in the Secure state as the first image extended boot launches. The port is bare metal and needs no Peripheral Driver Library or BSP. Board differences are make options, and `config/examples/psoc_e8_ai.config` describes KIT_PSE84_AI.
9884+
9885+
Verified on KIT_PSE84_AI (PSE846GPS2DBZC4A): boot from QSPI under the factory extended boot, ECC256 verification and handoff, A/B update with confirmation, resumption of an update interrupted mid-swap, RRAM write and erase, and the wolfCrypt test and benchmark. Booting from RRAM (`PSOC_E8_BOOT_RRAM=1`) is build-tested only. The CM55 is not started.
9886+
9887+
### Boot chain and memory
9888+
9889+
Extended boot runs the first CM33 image in place from QSPI at `0x60100000`, in MCUboot format: a 0x400-byte header, the image, and a TLV with the SHA-256 of both, with no key. `tools/scripts/psoc_e8/psoc_e8_mcuboot_wrap.py` wraps `wolfboot.bin` this way.
9890+
9891+
Each memory has four aliases, Secure/Non-secure by code/system bus. wolfBoot links at `0x18100400` and all `.config` addresses use the Secure code-bus QSPI alias:
9892+
9893+
```
9894+
RRAM 0x02000000 NS code 0x12000000 S code 0x22000000 NS sys 0x32000000 S sys
9895+
QSPI 0x08000000 NS code 0x18000000 S code 0x60000000 NS sys 0x70000000 S sys
9896+
9897+
0x18100000 - 0x1813FFFF wolfBoot slot (MCUboot header + wolfBoot)
9898+
0x18140000 - 0x1823FFFF BOOT partition (1 MB)
9899+
0x18240000 - 0x1833FFFF UPDATE partition (1 MB)
9900+
0x18340000 - 0x1837FFFF SWAP sector (256 KB)
9901+
```
9902+
9903+
`IMAGE_HEADER_SIZE=1024` keeps the application vector table on the 1 KB boundary the CM33 requires.
9904+
9905+
### QSPI flash
9906+
9907+
The HAL programs the 64 MB NOR through the SMIF MMIO command interface, using the device and 3- or 4-byte addressing that extended boot configured for XIP, which stays enabled. The flash path runs from RAM with interrupts masked, stages each page in RAM (the source is often QSPI itself), and invalidates the SMIF and CM33 caches afterwards. The test application runs from the QSPI it programs, so its flash path is also placed in RAM.
9908+
9909+
The NOR keeps ECC over 16-byte units and rejects a second program into a unit, so the config sets `NVM_FLASH_WRITEONCE=1`. With 256 KB sectors this costs a sector-sized RAM buffer. A rejected program leaves the part busy across a warm reset, where extended boot can no longer read it, so the HAL clears the failure flags when it sees them.
9910+
9911+
### Build options
9912+
9913+
wolfBoot does not change the clocks extended boot sets. The console is SCB2 on P6.5/P6.7, the KitProg3 COM port, at 115200 baud.
9914+
9915+
| Option | Default | Purpose |
9916+
| --- | --- | --- |
9917+
| `PSOC_E8_UART_SCB` | 2 | console SCB instance |
9918+
| `PSOC_E8_UART_PORT` / `_RX_PIN` / `_TX_PIN` | 6 / 5 / 7 | console pins |
9919+
| `PSOC_E8_UART_HSIOM_SEL` | 20 | HSIOM selector for the UART |
9920+
| `PSOC_E8_UART_PCLK_GR` / `_IDX` | 1 / 1 | console peripheral clock group and index |
9921+
| `PSOC_E8_PCLK_HZ` | 100000000 | CLK_HF10, feeding that group |
9922+
| `PSOC_E8_CPU_HZ` | 200000000 | CLK_HF0, test-app benchmark time base |
9923+
| `PSOC_E8_QSPI_SECTOR_SIZE` | 0x40000 | QSPI erase sector |
9924+
| `PSOC_E8_BOOT_RRAM` | 0 | link wolfBoot into RRAM instead of QSPI |
9925+
| `PSOC_E8_RRAM_SLOT_SIZE` | 0x20000 | RRAM slot with `PSOC_E8_BOOT_RRAM=1` |
9926+
9927+
### Building and flashing
9928+
9929+
```sh
9930+
cp config/examples/psoc_e8_ai.config .config
9931+
make clean && make
9932+
tools/scripts/psoc_e8/psoc_e8_flash.sh
9933+
```
9934+
9935+
The script wraps `wolfboot.bin` and programs it and `test-app/image_v1_signed.bin` over the KitProg3, with the ModusToolbox Programming Tools OpenOCD (`MTB_PROGTOOLS`, default `/opt/Tools/ModusToolboxProgtools-1.6`). Set `KITPROG_SERIAL` if several probes are attached. This replaces the factory CM33 image, so read QSPI back first to keep the stock demo. `factory.bin` does not apply here, since it lacks the MCUboot header.
9936+
9937+
To test an update, sign v2 and program it into UPDATE. The v1 application triggers the update, and v2 confirms itself:
9938+
9939+
```sh
9940+
IMAGE_HEADER_SIZE=1024 ./tools/keytools/sign --ecc256 --sha256 \
9941+
test-app/image.bin wolfboot_signing_private_key.der 2
9942+
tools/scripts/psoc_e8/psoc_e8_flash.sh --update test-app/image_v2_signed.bin
9943+
```
9944+
9945+
`make WOLFCRYPT_TEST=1 WOLFCRYPT_BENCHMARK=1` adds the software wolfCrypt test and benchmark to the test application. Its RNG seed is deterministic and only for testing.
9946+
9947+
### Booting from RRAM
9948+
9949+
`PSOC_E8_BOOT_RRAM=1` links wolfBoot at `0x12011400` in the RRAM user area, keeping the partitions in QSPI. Extended boot only launches it once the boot policy is reprovisioned with Infineon's Edge Protect Tools, which this port does not automate. RRAM is written in 16-byte blocks through the RRAMC indirect-write action, under the IPC and PC_LOCK locks. It has no erase, so `hal_flash_erase()` writes zeros.
9950+
98809951
## Infineon AURIX TC3xx
98819952

98829953
wolfBoot supports the Infineon AURIX TC3xx family and includes a demo application for the TC375 AURIX LiteKit-V2. It can be configured to run on either the TriCore application cores or the HSM core.

0 commit comments

Comments
 (0)