Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The unavailable private TC4xx port dependency prevents verification of critical integration details, requiring maintainer review alongside host/CSRM build and hardware validation of boot and flash operations.
No open issues 🎉
What changed in this PR
Migrates AURIX TC4xx support from Infineon iLLD to wolfLLD through the wolfHSM TC4xx port, covering the bootloader HAL, startup, and test application.
Changes:
- Uses port-provided wolfLLD startup and driver objects, with the test app’s flash driver built as RAM code.
- Migrates HAL operations to wolfLLD, adds UART timeout handling and sector-size validation, and rejects
UART_FLASH. - Makes the provisioned cross-verify key nonmodifiable and nondestroyable.
| File | Description |
|---|---|
tools/scripts/tc4xx/wolfBoot-wolfHSM-keys.nvminit |
Locks the verification key with additional NVM flags. |
test-app/Makefile |
Uses wolfLLD objects and enables RAM placement for the flash driver. |
test-app/app_aurix_tc4xx.c |
Removes the obsolete empty _init startup hook. |
Makefile |
Updates the data-section warning comment without changing build behavior. |
hal/aurix_tc4xx.c |
Replaces iLLD and local flash routines with wolfLLD APIs and adds validation. |
arch.mk |
Removes iLLD paths and source lists in favor of port-provided objects. |
Review effort: Balanced
|
@claude review |
There was a problem hiding this comment.
I reviewed this PR and found no bugs. It replaces the bootloader's PFLASH program/erase path and its startup objects with code from an external port that can't be seen from this checkout, so a human familiar with the TC4xx port should also take a look.
What was reviewed:
- The hal/aurix_tc4xx.c flash write/erase/erase-check path now calls tc4_flash_*. The callers are still RAMFUNCTION, and test-app/Makefile builds tc4_flash.o with -DRAM_CODE. I couldn't confirm that the bootloader build does the same, because that comes from the port's tchsm_wolfboot.mk.
- In arch.mk and test-app/Makefile, the iLLD sources and include paths now come from the TCHSM_WB_* object variables. The patched Ifx_Ssw_Tc0 rebuild was removed.
- The nvminit key flags went from 0x100 to 0x901, which adds NONDESTROYABLE and NONMODIFIABLE. The comment explains the new value, and it makes the provisioned cross-verify key permanent.
Extended reasoning...
The change touches 6 files on the AURIX TC4xx port: build glue (arch.mk, both Makefiles), the HAL's flash, UART, watchdog, reset and clock code, and the wolfHSM key provisioning flags. The security-sensitive parts are the PFLASH program/erase path, which wolfBoot uses during updates, and the cross-verify public key, which is now provisioned so it can't be modified or destroyed. The PR depends on an external private wolfHSM port change that supplies tchsm_wolfboot.mk, the wolfLLD objects and the startup hooks. That code can't be checked from this checkout, including whether the bootloader's tc4_flash.o runs from RAM. The size of the rewrite and that external dependency are why I'm asking for a human review instead of approving.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1002
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): Makefile, arch.mk, test-app/Makefile, tools/scripts/tc4xx/wolfBoot-wolfHSM-keys.nvminit
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
The TC4 HAL, its startup and the test app no longer use the Infineon iLLD. The wolfHSM TC4 port now supplies the wolfLLD startup and driver objects through tchsm_wolfboot.mk, so arch.mk drops the iLLD include list and sources, and the test app drops the second Ifx_Ssw_Tc0 build that compiled out the hypervisor exit (the port's linker script now marks it in the crt config table). - UART: tc4_uart, with the divider computed from the live fASCLINF so the CSRM, which prints before the host starts the PLLs, keeps 115200 baud. hal_prepare_boot() drains with tc4_uart_BlockOnTC() instead of a fixed delay. - Watchdogs, software reset and the backup clock switch before boot use tc4_wtu_Disable(), tc4_TriggerSwReset() and tc4_clock_SwitchToBackup(). - The wolfHSM client's SRC access grant uses the port's tchsm_Notify_OpenSrcs(), shared with the demo client. - The test app's empty _init() stub for the iLLD startup goes.
The wolfBoot public key in the TC4 NVM image was provisioned with the verify usage flag only, so any core of client 1 could replace or erase the root of the cross-verification. Add WH_NVM_FLAGS_NONMODIFIABLE and WH_NVM_FLAGS_NONDESTROYABLE (flags 0x901).
The erase, program, erase-verify and read primitives move to wolfLLD tc4_flash. The HAL keeps the sector cache, the read-modify-write logic and the partition-level entry points, and picks pages on the CSRM and bursts on the host as before.
The test app compiled tc4_flash.o without -DRAM_CODE -D__WOLFBOOT, so the driver could land in PFLASH and run from the bank it programs; only the build order hid it. Give it the HAL's per-object flags, and realign the HAL call continuations after the renames.
tc4_uart_Write8() now times out instead of blocking on a stalled transmitter, so uart_tx() drops the console after the first timeout rather than waiting one out per character. The HAL caches and erases one WOLFBOOT_SECTOR_SIZE sector at a time with the wolfLLD PFLASH driver, whose erase unit is 16 KB; a static assert now catches a config that sets a different size. UART_FLASH could never work here: uart_rx() was a stub and uart_init() takes no arguments, unlike the call in loader.c. Reject it at compile time and drop the stub.
tc4_wtu_Disable() now returns -1 when the watchdog refuses the unlock, or when password sequencing or the time check is active. hal_init() ignored that and ran on with the watchdog armed, so a long update could be cut short by a watchdog reset. It now panics instead, like the other checks in hal_init().
410e02c to
ee93836
Compare
The TC4xx HAL, its startup and the test app use wolfLLD through the wolfHSM TC4xx port instead of the Infineon iLLD.
Changes
arch.mktakes the TC4 startup and driver objects from the port'stchsm_wolfboot.mkand drops the iLLD sourcesUART_FLASHrejectedhal_init()panics when a watchdog cannot be disabledDependencies
tchsm_wolfboot.mkand the startup hooks