From e7eb152a83a93f024dda4a6a54e383c6336268f6 Mon Sep 17 00:00:00 2001 From: Thomas Cook Date: Thu, 1 Oct 2026 07:29:41 -0400 Subject: [PATCH] Address copilot and fenrir issues --- CMakeLists.txt | 1 - Makefile | 6 +-- docs/Targets.md | 122 +++++----------------------------------------- hal/ti_am64x_r5.c | 10 ++-- test-app/Makefile | 2 +- 5 files changed, 21 insertions(+), 120 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd7d1d46..bd8dfa74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,7 +413,6 @@ if(NOT DEFINED ARM_TARGETS) stm32u5 stm32wb ti - ti_am64x_r5 zynqmp ) set(ARM_TARGETS diff --git a/Makefile b/Makefile index 81e0c748..37269515 100644 --- a/Makefile +++ b/Makefile @@ -589,7 +589,7 @@ wolfboot.efi: wolfboot.elf @echo ifeq ($(TARGET),ti_am64x_r5) -$(GENERATED_SRCS): +$(GENERATED_SRCS): @echo "\t[TI SYSCONFIG] generated/hal/" $(Q)$(TI_SYSCONFIG)/nodejs/node \ $(TI_SYSCONFIG)/dist/cli.js -q \ @@ -783,13 +783,13 @@ endif test-app/image.elf: wolfboot.elf $(Q)$(MAKE) -C test-app WOLFBOOT_ROOT="$(WOLFBOOT_ROOT)" ELF_FLASH_SCATTER="$(ELF_FLASH_SCATTER)" LIBERO_FPGA_CONFIG_DIR="$(LIBERO_FPGA_CONFIG_DIR)" WOLFHSM_MICROCHIP_PIC32CZ="$(WOLFHSM_MICROCHIP_PIC32CZ)" image.elf -ifneq (,$(ELF_FLASH_SCATTER)$(filter ti_am64x_r5,$(TARGET))) +ifneq (,$(filter 1,$(ELF_FLASH_SCATTER))$(filter ti_am64x_r5,$(TARGET))) $(Q)$(SIZE) test-app/image-orig.elf else $(Q)$(SIZE) test-app/image.elf endif -ifeq ($(ELF_FLASH_SCATTER),1) +ifneq (,$(filter 1,$(ELF_FLASH_SCATTER))$(filter ti_am64x_r5,$(TARGET))) test-app/image.elf: squashelf endif diff --git a/docs/Targets.md b/docs/Targets.md index 91a9d7d7..c12e1905 100644 --- a/docs/Targets.md +++ b/docs/Targets.md @@ -10378,12 +10378,6 @@ Stage 1 is built by `make -C stage1` and takes its own options, separately from The two bring-up options exist to get a new board talking; neither belongs in a shipped configuration, and the build refuses to combine either with authentication rather than letting a boot continue past a refusal. - - - - - - ## TI AM6442 The TI AM6442 is a multi-core SoC, with one dual-core Cortex-A53, two dual-core Cortex-R5F, @@ -10412,8 +10406,8 @@ cd ../TI git clone --branch REL.MCUSDK.K3.11.02.00.24 https://github.com/TexasInstruments/mcupsdk-setup.git # Run the download_components.sh script -chmod +x mcupsdk-setup/releases/11_00_00/am64x/download_components.sh -mcupsdk-setup/am64x/download_components.sh --install_dir=./tools --skip_nodejs=true --skip_doxygen=true --skip_ccs=true +chmod +x mcupsdk-setup/releases/11_02_00/am64x/download_components.sh +mcupsdk-setup/releases/11_02_00/am64x/download_components.sh --install_dir=./tools --skip_nodejs=true --skip_doxygen=true --skip_ccs=true ``` ### AM64x: Hardware Acceleration @@ -10429,120 +10423,28 @@ Basic hardware acceleration supported: - AES-GCM (128, 256 key sizes) - SHA-256, SHA-512 -See [Test and Benchmark](#am64x-test-and-benchmark) for a comparison with and without hardware acceleration. - ### AM64x: Configuring and compiling Copy the example configuration file and build with make: ```sh -cp config/examples/lpc55s69.config .config -make -``` - -We also provide a TrustZone configuration at `config/examples/lpc55s69-tz.config` -and a benchmarking configuration at `config/examples/lpc55s69-benchmark.config`. - -### AM64x: Loading the firmware - -Download and install the LinkServer tool: -[@NXP: LinkServer for microcontrollers](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER#downloads) - -NOTE: The LPCXpresso55S69's on-board LINK2 debugger comes loaded with CMSIS-DAP protocol, but it can be -optionally updated to use JLink protocol instead. See the EVK user manual for how to do this, if desired. -The below examples were tested with the default CMSIS-DAP protocol. CMSIS-DAP is supported by default in -the MCUXpresso IDE for debugging purposes. - -Connect a USB cable from your development PC to P6 on the dev board. - -Open a terminal to the virtual COM port with putty or similar app, settings 115200-N-8-1. - -### AM64x: Testing firmware factory.bin - -1) Erase the entire flash: - -```sh -LinkServer flash LPC55S69 erase -``` - -2) Program the factory.bin, which contains both wolfBoot and the test-app version 1: - -```sh -LinkServer flash LPC55S69 load factory.bin:0 -``` -NOTE: See [tools/scripts/lpc55s69/lpc55s69_flash_factory_bin.cmm](/tools/scripts/lpc55s69/lpc55s69_flash_factory_bin.cmm) for the lauterbach equivalent of 1 and 2 combined. - -3) The LED will light up blue to indicate version 1 of the firmware is running. You should also see output -like this in the terminal window: - -```sh -lpc55s69 init -Boot partition: 0xD000 (sz 22460, ver 0x1, type 0x601) -Partition 1 header magic 0xFFFFFFFF invalid at 0x18000 -Boot partition: 0xD000 (sz 22460, ver 0x1, type 0x601) -Booting version: 0x1 - -================================== -LPC55S69 wolfBoot demo Application -Copyright 2026 wolfSSL Inc -================================== - boot: ver=0x1 state=0xFF - update: ver=0x0 state=0xFF -Calling wolfBoot_success() - boot: ver=0x1 state=0x00 - update: ver=0x0 state=0xFF -``` - -### AM64x: Debugging - -Debugging with GDB: - -Note: We include a `.gdbinit` in the wolfBoot root that loads the wolfboot and test-app elf files. - -In one terminal: `LinkServer gdbserver LPC55S69` - -In another terminal use `gdb`: - -``` -b main -mon reset -c -``` -NOTE: See [tools/scripts/lpc55s69/lpc55s69_debug.cmm](/tools/scripts/lpc55s69/lpc55s69_debug.cmm) for the lauterbach equivalent. - - -### AM64x Test and Benchmark - -Here is an example of how to run wolfCrypt test and benchmarking on actual hardware. - -1. Start with [lpc55s69-benchmark.config](/config/examples/lpc55s69-benchmark.config) - - By default, the config file has PKA?=0, which means hardware acceleration of crypto is off. Let's try that first. -```sh -cp config/examples/lpc55s69-benchmark.config .config +cd /path/to/wolfBoot +cp config/examples/ti-am64x-r5.config .config make clean make ``` -2. Flash the factory.bin and reboot... +### AM64x: Loading the firmware + +The AM64x wolfBoot port for the TMDS64EVM boots from OSPI flash and runs on the main R5 core. There are several ways to flash the device, such as over UART or USB DFU. The preferred method is up to the user. Refer to the MCU Plus SDK and the TMDS64EVM documentation. + +The 'factory.bin' file needs to be flashed to the start of the OSPI flash. + +The boot switches then must be set to xSPI boot mode: ```sh +11001110 01000000 ``` -2. Now try changing to PKA?=1 in the config file, rebuild, and reflash... -```sh -``` - - - - - - - - - - - - - ## TI C2000 C28x (LAUNCHXL-F28P55X) wolfBoot runs on the Texas Instruments C2000 C28x DSP (TMS320F28P550SJ, 150 MHz) as a secure execute-in-place (XIP) bootloader. The C28x is word-addressed with `CHAR_BIT == 16` (no 8-bit type -- each octet occupies one 16-bit cell), built with the TI `cl2000` toolchain against wolfSSL's wide-byte (`CHAR_BIT != 8`) support. diff --git a/hal/ti_am64x_r5.c b/hal/ti_am64x_r5.c index 91410032..5be7870c 100644 --- a/hal/ti_am64x_r5.c +++ b/hal/ti_am64x_r5.c @@ -222,11 +222,11 @@ int RAMFUNCTION hal_flash_erase(uint32_t address, int len) if ((uint32_t)len < chunk) chunk = (uint32_t)len; status = Flash_offsetToBlkPage(gFlashHandle[0], address, &blk, &page); - if (status == 0) { - status = Flash_eraseBlk(gFlashHandle[0], blk); - if (status != 0) - break; - } + if (status != 0) + break; + status = Flash_eraseBlk(gFlashHandle[0], blk); + if (status != 0) + break; address += chunk; len -= (int)chunk; } diff --git a/test-app/Makefile b/test-app/Makefile index d362d348..9b96d45d 100644 --- a/test-app/Makefile +++ b/test-app/Makefile @@ -1825,7 +1825,7 @@ APP_OBJS := $(patsubst $(WOLFBOOT_LIB_WOLFIP)/%, \ $(WOLFIP_LOCAL_OBJDIR)/%, $(APP_OBJS)) # squashelf if either ELF_FLASH_SCATTER==1 or TARGET==ti_am64x_r5 -ifneq (,$(ELF_FLASH_SCATTER)$(filter ti_am64x_r5,$(TARGET))) +ifneq (,$(filter 1,$(ELF_FLASH_SCATTER))$(filter ti_am64x_r5,$(TARGET))) SQUASHELF_TOOL = ../tools/squashelf/squashelf OBJCOPY_SRC_ELF=image-orig.elf image-orig.elf: $(APP_OBJS) $(LSCRIPT)