diff --git a/arch.mk b/arch.mk index 58957fc682..6ad8c5ce1e 100644 --- a/arch.mk +++ b/arch.mk @@ -1205,9 +1205,11 @@ ifeq ($(TARGET),lpc55s69) -I$(MCUXPRESSO_DRIVERS)/drivers \ -I$(MCUXPRESSO_DRIVERS)/../periph \ -I$(MCUXPRESSO)/drivers \ + -I$(MCUXPRESSO)/drivers/casper \ -I$(MCUXPRESSO)/drivers/common \ -I$(MCUXPRESSO)/drivers/flexcomm \ -I$(MCUXPRESSO)/drivers/flexcomm/usart \ + -I$(MCUXPRESSO)/drivers/hashcrypt \ -I$(MCUXPRESSO)/drivers/iap1 \ -I$(MCUXPRESSO)/drivers/lpc_gpio \ -I$(MCUXPRESSO)/drivers/lpc_iocon \ @@ -1225,16 +1227,24 @@ ifeq ($(TARGET),lpc55s69) $(MCUXPRESSO_DRIVERS)/drivers/fsl_power.o \ $(MCUXPRESSO)/drivers/common/fsl_common_arm.o \ $(MCUXPRESSO)/drivers/iap1/fsl_iap.o \ - $(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o - ifeq ($(WOLFCRYPT_TZ),1) - OBJS+=$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o - endif + $(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o \ + $(MCUXPRESSO)/drivers/rng_1/fsl_rng.o ifeq ($(DEBUG_UART),1) OBJS+=\ $(MCUXPRESSO_DRIVERS)/drivers/fsl_reset.o \ $(MCUXPRESSO)/drivers/flexcomm/fsl_flexcomm.o \ $(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o endif + ifeq ($(PKA),1) + CFLAGS+=-DWOLFSSL_NXP_LPC55S69_WITH_HWACCEL + OBJS+=\ + $(MCUXPRESSO)/drivers/casper/fsl_casper.o \ + $(MCUXPRESSO)/drivers/hashcrypt/fsl_hashcrypt.o \ + $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/casper_port.o \ + $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/hashcrypt_port.o + else + CFLAGS+=-DWOLFSSL_NXP_LPC55S69_NO_HWACCEL + endif endif ifeq ($(TARGET),psoc6) diff --git a/config/examples/lpc55s69-benchmark.config b/config/examples/lpc55s69-benchmark.config new file mode 100644 index 0000000000..9804dedae5 --- /dev/null +++ b/config/examples/lpc55s69-benchmark.config @@ -0,0 +1,45 @@ +ARCH?=ARM +TZEN?=0 +TARGET?=lpc55s69 +SIGN?=ECC384 +HASH?=SHA256 +MCUXSDK?=1 +MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk +MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS +MCUXPRESSO_CPU?=LPC55S69JBD100_cm33_core0 +MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/LPC/LPC5500/LPC55S69 +MCUXPRESSO_PROJECT_TEMPLATE?=$(MCUXPRESSO)/examples/_boards/lpcxpresso55s69/project_template +DEBUG?=0 +DEBUG_UART?=1 +VTOR?=1 +CORTEX_M0?=0 +CORTEX_M33?=1 +NO_ASM?=0 +NO_MPU=1 +EXT_FLASH?=0 +SPI_FLASH?=0 +ALLOW_DOWNGRADE?=0 +NVM_FLASH_WRITEONCE?=1 +NO_ARM_ASM=1 +WOLFBOOT_VERSION?=0 +V?=0 +SPMATH?=1 +RAM_CODE?=1 +DUALBANK_SWAP?=0 +FLASH_MULTI_SECTOR_ERASE?=1 + +# Turn on or off hw acceleration of crypto algs in the lpc55s69 +PKA?=0 + +# use 1024-byte sector to accommodate RSA4096 signature +# WOLFBOOT_SECTOR_SIZE?=0x400 +WOLFBOOT_SECTOR_SIZE?=0x200 + +# use these for test/benchmark +WOLFBOOT_PARTITION_SIZE?=0x2b000 +WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x10000 +WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x3b000 +WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x66000 + +WOLFCRYPT_TEST?=1 +WOLFCRYPT_BENCHMARK?=1 diff --git a/config/examples/lpc55s69-tz.config b/config/examples/lpc55s69-tz.config index f708099321..58d4fb6f6a 100644 --- a/config/examples/lpc55s69-tz.config +++ b/config/examples/lpc55s69-tz.config @@ -2,7 +2,7 @@ ARCH?=ARM TZEN?=1 TARGET?=lpc55s69 SIGN?=ECC384 -HASH?=SHA384 +HASH?=SHA256 MCUXSDK?=1 MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS @@ -26,15 +26,18 @@ V?=0 SPMATH?=1 RAM_CODE?=1 DUALBANK_SWAP?=0 -PKA?=1 FLASH_MULTI_SECTOR_ERASE?=1 WOLFCRYPT_TZ?=1 WOLFCRYPT_TZ_PKCS11?=1 -# 512-byte pages erasable/writeable +# Turn on or off hw acceleration of crypto algs in the lpc55s69 +PKA?=0 + +# use 1024-byte sector to accommodate RSA4096 signature +# WOLFBOOT_SECTOR_SIZE?=0x400 WOLFBOOT_SECTOR_SIZE?=0x200 -# 200KB boot, 80KB keyvault, 8KB NSC, 56KB partitions, 512 swap +# 200KB boot, 80KB keyvault, 8KB NSC, 56KB partitions, 512/1024 swap WOLFBOOT_KEYVAULT_ADDRESS?=0x10032000 WOLFBOOT_KEYVAULT_SIZE?=0x14000 WOLFBOOT_NSC_ADDRESS?=0x10046000 diff --git a/config/examples/lpc55s69.config b/config/examples/lpc55s69.config index 7020831a62..57c6647c3f 100644 --- a/config/examples/lpc55s69.config +++ b/config/examples/lpc55s69.config @@ -2,7 +2,7 @@ ARCH?=ARM TZEN?=0 TARGET?=lpc55s69 SIGN?=ECC384 -HASH?=SHA384 +HASH?=SHA256 MCUXSDK?=1 MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS @@ -26,15 +26,18 @@ V?=0 SPMATH?=1 RAM_CODE?=1 DUALBANK_SWAP?=0 -PKA?=1 FLASH_MULTI_SECTOR_ERASE?=1 -# 512-byte pages erasable/writeable +# Turn on or off hw acceleration of crypto algs in the lpc55s69 +PKA?=0 + +# use 1024-byte sector to accommodate RSA4096 signature +# WOLFBOOT_SECTOR_SIZE?=0x400 WOLFBOOT_SECTOR_SIZE?=0x200 # Default configuration -# 40KB boot, 44KB partitions, 512 swap +# 44KB boot, 52KB partitions, 512/1024 swap WOLFBOOT_PARTITION_SIZE?=0xB000 -WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xA000 -WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x15000 -WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x20000 +WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xD000 +WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x18000 +WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x23000 diff --git a/docs/Targets.md b/docs/Targets.md index 200fd182ca..d451b306c4 100644 --- a/docs/Targets.md +++ b/docs/Targets.md @@ -2289,17 +2289,22 @@ LinkServer flash LPC55S69 erase ```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: 0xA000 (sz 24016, ver 0x1, type 0x601) -Partition 1 header magic 0xFFFFFFFF invalid at 0x15000 -Boot partition: 0xA000 (sz 24016, ver 0x1, type 0x601) +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 init + +================================== +LPC55S69 wolfBoot demo Application +Copyright 2026 wolfSSL Inc +================================== boot: ver=0x1 state=0xFF update: ver=0x0 state=0xFF Calling wolfBoot_success() @@ -2312,25 +2317,30 @@ Calling wolfBoot_success() 1) Sign the test-app with version 2: ```sh -./tools/keytools/sign --ecc384 --sha384 test-app/image.bin wolfboot_signing_private_key.der 2 +./tools/keytools/sign --ecc384 --sha256 test-app/image.bin wolfboot_signing_private_key.der 2 ``` 2) Flash v2 update binary to your `.config`'s `WOLFBOOT_PARTITION_UPDATE_ADDRESS` Example: ```sh -LinkServer flash LPC55S69 load test-app/image_v2_signed.bin:0x15000 +LinkServer flash LPC55S69 load test-app/image_v2_signed.bin:0x18000 ``` +NOTE: See [tools/scripts/lpc55s69/lpc55s69_flash_update.cmm](/tools/scripts/lpc55s69/lpc55s69_flash_update.cmm) for the lauterbach equivalent. 3) You should see output like this in the terminal window: ```sh lpc55s69 init -Boot partition: 0xA000 (sz 24016, ver 0x1, type 0x601) -Update partition: 0x15000 (sz 24016, ver 0x2, type 0x601) -Boot partition: 0xA000 (sz 24016, ver 0x1, type 0x601) +Boot partition: 0xD000 (sz 22460, ver 0x1, type 0x601) +Update partition: 0x18000 (sz 22460, ver 0x2, type 0x601) +Boot partition: 0xD000 (sz 22460, ver 0x1, type 0x601) Booting version: 0x1 -lpc55s69 init + +================================== +LPC55S69 wolfBoot demo Application +Copyright 2026 wolfSSL Inc +================================== boot: ver=0x1 state=0x00 update: ver=0x2 state=0xFF Update detected, version: 0x2 @@ -2347,18 +2357,18 @@ like this in the terminal window: ```sh lpc55s69 init -Update partition: 0x15000 (sz 24016, ver 0x2, type 0x601) -Boot partition: 0xA000 (sz 24016, ver 0x1, type 0x601) -Update partition: 0x15000 (sz 24016, ver 0x2, type 0x601) +Update partition: 0x18000 (sz 22460, ver 0x2, type 0x601) +Boot partition: 0xD000 (sz 22460, ver 0x1, type 0x601) +Update partition: 0x18000 (sz 22460, ver 0x2, type 0x601) Starting Update (fallback allowed 0) -Update partition: 0x15000 (sz 24016, ver 0x2, type 0x601) -Boot partition: 0xA000 (sz 24016, ver 0x1, type 0x601) +Update partition: 0x18000 (sz 22460, ver 0x2, type 0x601) +Boot partition: 0xD000 (sz 22460, ver 0x1, type 0x601) Versions: Current 0x1, Update 0x2 Copy sector 0 (part 1->2) Copy sector 0 (part 0->1) Copy sector 0 (part 2->0) -Boot partition: 0xA000 (sz 24016, ver 0x2, type 0x601) -Update partition: 0x15000 (sz 24016, ver 0x1, type 0x601) +Boot partition: 0xD000 (sz 22460, ver 0x2, type 0x601) +Update partition: 0x18000 (sz 22460, ver 0x1, type 0x601) Copy sector 1 (part 1->2) Copy sector 1 (part 0->1) Copy sector 1 (part 2->0) @@ -2491,23 +2501,18 @@ Copy sector 43 (part 2->0) Copy sector 44 (part 1->2) Copy sector 44 (part 0->1) Copy sector 44 (part 2->0) -Copy sector 45 (part 1->2) -Copy sector 45 (part 0->1) -Copy sector 45 (part 2->0) -Copy sector 46 (part 1->2) -Copy sector 46 (part 0->1) -Copy sector 46 (part 2->0) -Copy sector 47 (part 1->2) -Copy sector 47 (part 0->1) -Copy sector 47 (part 2->0) -Erasing remainder of partition (38 sectors)... -Boot partition: 0xA000 (sz 24016, ver 0x2, type 0x601) -Update partition: 0x15000 (sz 24016, ver 0x1, type 0x601) +Erasing remainder of partition (41 sectors)... +Boot partition: 0xD000 (sz 22460, ver 0x2, type 0x601) +Update partition: 0x18000 (sz 22460, ver 0x1, type 0x601) Copy sector 85 (part 0->2) Copied boot sector to swap -Boot partition: 0xA000 (sz 24016, ver 0x2, type 0x601) +Boot partition: 0xD000 (sz 22460, ver 0x2, type 0x601) Booting version: 0x2 -lpc55s69 init + +================================== +LPC55S69 wolfBoot demo Application +Copyright 2026 wolfSSL Inc +================================== boot: ver=0x2 state=0x10 update: ver=0x1 state=0xFF Calling wolfBoot_success() @@ -2530,7 +2535,248 @@ b main mon reset c ``` +NOTE: See [tools/scripts/lpc55s69/lpc55s69_debug.cmm](/tools/scripts/lpc55s69/lpc55s69_debug.cmm) for the lauterbach equivalent. + + +### LPC55S69: 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 +make clean +make +``` + +2. Flash the factory.bin and reboot... +```sh +lpc55s69 init +Boot partition: 0x10000 (sz 162932, ver 0x1, type 0x201) +Partition 1 header magic 0xFFFFFFFF invalid at 0x3B000 +Boot partition: 0x10000 (sz 162932, ver 0x1, type 0x201) +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 + +Running wolfCrypt tests... +------------------------------------------------------------------------------ + wolfSSL version 5.9.1 +------------------------------------------------------------------------------ +macro test passed! +error test passed! +MEMORY test passed! +asn test passed! +SHA-256 test passed! +SHA-384 test passed! +SHA-512 test passed! +SHA-512/224 test passed! +SHA-512/256 test passed! +RANDOM test passed! +Hash test passed! +HMAC-SHA256 test passed! +HMAC-SHA384 test passed! +HMAC-SHA512 test passed! +GMAC test passed! +AES test passed! +AES192 test passed! +AES256 test passed! +AES-CBC test passed! +AES-CTR test passed! +AES-OFB test passed! +AES-GCM test passed! +AES-CFB test passed! +ECC test passed! +ECC buffer test passed! +logging test passed! +mutex test passed! +memcb test passed! +Test complete +Tests complete. + + +Running wolfCrypt benchmarks... +wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each) +RNG SHA-256 DRBG 325 KiB took 1.044 seconds, 311.302 KiB/s +AES-128-CBC-enc 350 KiB took 1.051 seconds, 333.016 KiB/s +AES-128-CBC-dec 350 KiB took 1.057 seconds, 331.125 KiB/s +AES-192-CBC-enc 300 KiB took 1.035 seconds, 289.855 KiB/s +AES-192-CBC-dec 300 KiB took 1.040 seconds, 288.461 KiB/s +AES-256-CBC-enc 275 KiB took 1.064 seconds, 258.458 KiB/s +AES-256-CBC-dec 275 KiB took 1.062 seconds, 258.701 KiB/s +AES-128-GCM-enc 275 KiB took 1.036 seconds, 265.188 KiB/s +AES-128-GCM-dec 275 KiB took 1.035 seconds, 265.444 KiB/s +AES-192-GCM-enc 250 KiB took 1.057 seconds, 236.518 KiB/s +AES-192-GCM-dec 250 KiB took 1.056 seconds, 236.742 KiB/s +AES-256-GCM-enc 225 KiB took 1.047 seconds, 214.899 KiB/s +AES-256-GCM-dec 225 KiB took 1.046 seconds, 215.105 KiB/s +AES-128-GCM-enc-no_AAD 275 KiB took 1.033 seconds, 265.957 KiB/s +AES-128-GCM-dec-no_AAD 275 KiB took 1.032 seconds, 266.214 KiB/s +AES-192-GCM-enc-no_AAD 250 KiB took 1.053 seconds, 237.191 KiB/s +AES-192-GCM-dec-no_AAD 250 KiB took 1.052 seconds, 237.416 KiB/s +AES-256-GCM-enc-no_AAD 225 KiB took 1.044 seconds, 215.517 KiB/s +AES-256-GCM-dec-no_AAD 225 KiB took 1.042 seconds, 215.723 KiB/s +GMAC Table 1 MiB took 1.009 seconds, 1.208 MiB/s +AES-128-ECB-enc 374 KiB took 1.026 seconds, 364.167 KiB/s +AES-128-ECB-dec 385 KiB took 1.027 seconds, 374.878 KiB/s +AES-192-ECB-enc 319 KiB took 1.024 seconds, 311.219 KiB/s +AES-192-ECB-dec 330 KiB took 1.018 seconds, 323.846 KiB/s +AES-256-ECB-enc 286 KiB took 1.036 seconds, 276.061 KiB/s +AES-256-ECB-dec 286 KiB took 1.006 seconds, 284.011 KiB/s +AES-128-CFB-enc 350 KiB took 1.064 seconds, 328.947 KiB/s +AES-128-CFB-dec 350 KiB took 1.057 seconds, 331.125 KiB/s +AES-192-CFB-enc 300 KiB took 1.046 seconds, 286.532 KiB/s +AES-192-CFB-dec 300 KiB took 1.039 seconds, 288.461 KiB/s +AES-256-CFB-enc 275 KiB took 1.074 seconds, 256.052 KiB/s +AES-256-CFB-dec 275 KiB took 1.067 seconds, 257.490 KiB/s +AES-128-OFB-enc 350 KiB took 1.020 seconds, 343.137 KiB/s +AES-128-OFB-dec 350 KiB took 1.019 seconds, 343.137 KiB/s +AES-192-OFB-enc 300 KiB took 1.009 seconds, 297.324 KiB/s +AES-192-OFB-dec 300 KiB took 1.009 seconds, 297.324 KiB/s +AES-256-OFB-enc 275 KiB took 1.038 seconds, 264.677 KiB/s +AES-256-OFB-dec 275 KiB took 1.039 seconds, 264.423 KiB/s +AES-128-CTR 350 KiB took 1.010 seconds, 346.191 KiB/s +AES-192-CTR 300 KiB took 1.003 seconds, 299.102 KiB/s +AES-256-CTR 275 KiB took 1.033 seconds, 265.957 KiB/s +SHA-256 1000 KiB took 1.000 seconds, 1000.000 KiB/s +SHA-384 425 KiB took 1.060 seconds, 400.565 KiB/s +SHA-512 425 KiB took 1.060 seconds, 400.565 KiB/s +SHA-512/224 425 KiB took 1.062 seconds, 400.188 KiB/s +SHA-512/256 425 KiB took 1.060 seconds, 400.565 KiB/s +HMAC-SHA256 1000 KiB took 1.009 seconds, 991.080 KiB/s +HMAC-SHA384 400 KiB took 1.015 seconds, 394.088 KiB/s +HMAC-SHA512 400 KiB took 1.015 seconds, 394.088 KiB/s +ECC [ SECP256R1] 256 key gen 72 ops took 1.007 sec, avg 13.986 ms, 71.499 ops/sec +ECDHE [ SECP256R1] 256 agree 34 ops took 1.013 sec, avg 29.823 ms, 33.530 ops/sec +ECDSA [ SECP256R1] 256 sign 42 ops took 1.036 sec, avg 24.690 ms, 40.501 ops/sec +ECDSA [ SECP256R1] 256 verify 22 ops took 1.003 sec, avg 45.590 ms, 21.934 ops/sec +RNG 256 SHA256 Init/Free 196 ops took 1.003 sec, avg 5.117 ms, 195.413 ops/sec +Benchmark complete +Benchmarks complete. +``` + +2. Now try changing to PKA?=1 in the config file, rebuild, and reflash... +```sh +lpc55s69 init +Boot partition: 0x10000 (sz 163148, ver 0x1, type 0x201) +Partition 1 header magic 0xFFFFFFFF invalid at 0x3B000 +Boot partition: 0x10000 (sz 163148, ver 0x1, type 0x201) +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 + +Running wolfCrypt tests... +------------------------------------------------------------------------------ + wolfSSL version 5.9.1 +------------------------------------------------------------------------------ +macro test passed! +error test passed! +MEMORY test passed! +asn test passed! +SHA-256 test passed! +SHA-384 test passed! +SHA-512 test passed! +SHA-512/224 test passed! +SHA-512/256 test passed! +RANDOM test passed! +Hash test passed! +HMAC-SHA256 test passed! +HMAC-SHA384 test passed! +HMAC-SHA512 test passed! +GMAC test passed! +AES test passed! +AES192 test passed! +AES256 test passed! +AES-CBC test passed! +AES-CTR test passed! +AES-OFB test passed! +AES-GCM test passed! +AES-CFB test passed! +ECC test passed! +ECC buffer test passed! +logging test passed! +mutex test passed! +memcb test passed! +Test complete +Tests complete. + + +Running wolfCrypt benchmarks... +wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each) +RNG SHA-256 DRBG 650 KiB took 1.011 seconds, 642.292 KiB/s +AES-128-CBC-enc 23 MiB took 1.000 seconds, 23.657 MiB/s +AES-128-CBC-dec 22 MiB took 1.000 seconds, 22.097 MiB/s +AES-192-CBC-enc 23 MiB took 1.000 seconds, 23.510 MiB/s +AES-192-CBC-dec 19 MiB took 1.000 seconds, 19.531 MiB/s +AES-256-CBC-enc 21 MiB took 1.000 seconds, 21.582 MiB/s +AES-256-CBC-dec 17 MiB took 1.000 seconds, 17.504 MiB/s +AES-128-GCM-enc 950 KiB took 1.022 seconds, 928.641 KiB/s +AES-128-GCM-dec 950 KiB took 1.022 seconds, 929.549 KiB/s +AES-192-GCM-enc 925 KiB took 1.003 seconds, 922.233 KiB/s +AES-192-GCM-dec 925 KiB took 1.001 seconds, 923.153 KiB/s +AES-256-GCM-enc 925 KiB took 1.012 seconds, 914.031 KiB/s +AES-256-GCM-dec 925 KiB took 1.011 seconds, 914.935 KiB/s +AES-128-GCM-enc-no_AAD 950 KiB took 1.010 seconds, 939.663 KiB/s +AES-128-GCM-dec-no_AAD 950 KiB took 1.010 seconds, 940.594 KiB/s +AES-192-GCM-enc-no_AAD 950 KiB took 1.016 seconds, 934.119 KiB/s +AES-192-GCM-dec-no_AAD 950 KiB took 1.014 seconds, 935.960 KiB/s +AES-256-GCM-enc-no_AAD 925 KiB took 1.000 seconds, 925.000 KiB/s +AES-256-GCM-dec-no_AAD 950 KiB took 1.025 seconds, 925.925 KiB/s +GMAC Table 1 MiB took 1.001 seconds, 1.218 MiB/s +AES-128-ECB-enc 24 MiB took 1.000 seconds, 24.502 MiB/s +AES-128-ECB-dec 24 MiB took 1.000 seconds, 24.008 MiB/s +AES-192-ECB-enc 24 MiB took 1.000 seconds, 24.341 MiB/s +AES-192-ECB-dec 20 MiB took 1.000 seconds, 20.990 MiB/s +AES-256-ECB-enc 22 MiB took 1.000 seconds, 22.290 MiB/s +AES-256-ECB-dec 18 MiB took 1.000 seconds, 18.659 MiB/s +AES-128-CFB-enc 3 MiB took 1.003 seconds, 3.136 MiB/s +AES-128-CFB-dec 3 MiB took 1.005 seconds, 3.133 MiB/s +AES-192-CFB-enc 3 MiB took 1.006 seconds, 3.082 MiB/s +AES-192-CFB-dec 3 MiB took 1.006 seconds, 3.079 MiB/s +AES-256-CFB-enc 3 MiB took 1.000 seconds, 3.027 MiB/s +AES-256-CFB-dec 3 MiB took 1.001 seconds, 3.021 MiB/s +AES-128-OFB-enc 3 MiB took 1.007 seconds, 3.030 MiB/s +AES-128-OFB-dec 3 MiB took 1.008 seconds, 3.027 MiB/s +AES-192-OFB-enc 3 MiB took 1.006 seconds, 2.982 MiB/s +AES-192-OFB-dec 2 MiB took 1.000 seconds, 2.978 MiB/s +AES-256-OFB-enc 2 MiB took 1.000 seconds, 2.929 MiB/s +AES-256-OFB-dec 2 MiB took 1.000 seconds, 2.926 MiB/s +AES-128-CTR 17 MiB took 1.001 seconds, 17.706 MiB/s +AES-192-CTR 17 MiB took 1.000 seconds, 17.633 MiB/s +AES-256-CTR 16 MiB took 1.000 seconds, 16.528 MiB/s +SHA-256 57 MiB took 1.000 seconds, 57.397 MiB/s +SHA-384 400 KiB took 1.000 seconds, 400.000 KiB/s +SHA-512 400 KiB took 1.000 seconds, 400.000 KiB/s +SHA-512/224 400 KiB took 1.000 seconds, 400.000 KiB/s +SHA-512/256 400 KiB took 1.000 seconds, 400.000 KiB/s +HMAC-SHA256 48 MiB took 1.000 seconds, 48.803 MiB/s +HMAC-SHA384 400 KiB took 1.015 seconds, 393.700 KiB/s +HMAC-SHA512 400 KiB took 1.015 seconds, 393.700 KiB/s +ECC [ SECP256R1] 256 key gen 74 ops took 1.020 sec, avg 13.783 ms, 72.549 ops/sec +ECDHE [ SECP256R1] 256 agree 34 ops took 1.015 sec, avg 29.882 ms, 33.464 ops/sec +ECDSA [ SECP256R1] 256 sign 42 ops took 1.003 sec, avg 23.904 ms, 41.832 ops/sec +ECDSA [ SECP256R1] 256 verify 24 ops took 1.081 sec, avg 45.041 ms, 22.201 ops/sec +RNG 256 SHA256 Init/Free 5 ops took 1.258 sec, avg 251.600 ms, 3.974 ops/sec +Benchmark complete +Benchmarks complete. +``` ## NXP LS1028A diff --git a/hal/lpc55s69.c b/hal/lpc55s69.c index 67d7637cb7..38f718f117 100644 --- a/hal/lpc55s69.c +++ b/hal/lpc55s69.c @@ -93,17 +93,35 @@ static void hal_flash_fix_ecc(void) } } + +extern int wc_hashcrypt_init(void); +extern int wc_casper_init(void); + void hal_init(void) { #ifdef __WOLFBOOT /* lpc55s69 must run < 100 MHz for flash write/erase to work */ BOARD_BootClockFROHF96M(); // BOARD_BootClockPLL150M(); -#ifdef DEBUG_UART + +# ifdef DEBUG_UART uart_init(); uart_write("lpc55s69 init\n", 14); -#endif -#endif +# endif + +# ifdef WOLFSSL_NXP_LPC55S69_WITH_HWACCEL + CLOCK_EnableClock(kCLOCK_HashCrypt); + wc_hashcrypt_init(); + CLOCK_EnableClock(kCLOCK_Casper); + wc_casper_init(); +# endif + + CLOCK_EnableClock(kCLOCK_Rng); + RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn); + +#endif /* __WOLFBOOT */ + + RNG_Init(RNG); #if defined(__WOLFBOOT) || !defined(TZEN) memset(&pflash, 0, sizeof(pflash)); @@ -209,11 +227,7 @@ int RAMFUNCTION hal_flash_erase(uint32_t address, int len) #ifdef WOLFCRYPT_SECURE_MODE void hal_trng_init(void) { -#ifdef __WOLFBOOT - CLOCK_EnableClock(kCLOCK_Rng); - RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn); -#endif - RNG_Init(RNG); + /* handled in hal_init() regardless */ } void hal_trng_fini(void) diff --git a/include/user_settings.h b/include/user_settings.h index 4c701be45d..ea281e891b 100644 --- a/include/user_settings.h +++ b/include/user_settings.h @@ -493,14 +493,28 @@ extern int tolower(int c); #define NO_AES_CBC #else #if defined(WOLFCRYPT_TEST) || defined(WOLFCRYPT_BENCHMARK) - /* Use custom RNG for tests/benchmarks (saves ~7KB vs HASHDRBG). - * WARNING: my_rng_seed_gen is NOT cryptographically secure. - * Only used in test-app builds, not in production wolfBoot. */ - #define WC_NO_HASHDRBG - #define CUSTOM_RAND_GENERATE_SEED my_rng_seed_gen - #define CUSTOM_RAND_GENERATE_BLOCK my_rng_seed_gen - extern int my_rng_seed_gen(unsigned char* output, unsigned int sz); - + #if defined(WOLFSSL_NXP_LPC55S69_WITH_HWACCEL) \ + || defined(WOLFSSL_NXP_LPC55S69_NO_HWACCEL) + /* use actual rng hardware for seed, HASHDRBG for generation */ + #define HAVE_HASHDRBG + #define HAVE_AES_ECB + #define WOLFSSL_AES_OFB + #define WOLFSSL_AES_CFB + #define WOLFSSL_AES_COUNTER + #define WOLFSSL_STATIC_MEMORY_TEST_SZ (30 * 1024) + #define WOLFSSL_SHA256 + #define WOLFSSL_SHA384 + #define WOLFSSL_SHA512 + #else + /* Use custom RNG for tests/benchmarks (saves ~7KB vs HASHDRBG). + * WARNING: my_rng_seed_gen is NOT cryptographically secure. + * Only used in test-app builds, not in production wolfBoot. */ + #define WC_NO_HASHDRBG + #define CUSTOM_RAND_GENERATE_SEED my_rng_seed_gen + #define CUSTOM_RAND_GENERATE_BLOCK my_rng_seed_gen + extern int my_rng_seed_gen(unsigned char* output, unsigned int sz); + #endif + #define HAVE_AESGCM #define GCM_TABLE #else @@ -575,6 +589,10 @@ extern int tolower(int c); /* wolfCrypt Test/Benchmark Configuration */ #ifdef WOLFCRYPT_TEST + #ifdef WOLFSSL_NXP_LPC55S69_WITH_HWACCEL + /* lpc55s69 hashcrypt hw does not support interleaving */ + #define NO_WOLFSSL_SHA256_INTERLEAVE + #endif /* Skip extended tests to save memory */ #define NO_CRYPT_TEST_EXTENDED /* Use smaller certificate buffers */ diff --git a/test-app/ARM-lpc55s69.ld b/test-app/ARM-lpc55s69.ld index aa3200f9eb..078c125e3e 100644 --- a/test-app/ARM-lpc55s69.ld +++ b/test-app/ARM-lpc55s69.ld @@ -1,7 +1,10 @@ +_Min_Heap_Size = 0x00000100; /* minimal heap (not using malloc) */ +_Min_Stack_Size = 0x00008000; /* required amount of stack */ + MEMORY { FLASH (rx) : ORIGIN = @WOLFBOOT_TEST_APP_ADDRESS@, LENGTH = @WOLFBOOT_TEST_APP_SIZE@ - RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 32K + RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 160K } SECTIONS @@ -44,15 +47,23 @@ SECTIONS *(COMMON) . = ALIGN(4); _end_bss = .; - _end = .; } > RAM + + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + PROVIDE ( _start_heap = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + PROVIDE ( END_STACK = . ); + PROVIDE ( _end_stack = . ); + } > RAM } _wolfboot_partition_boot_address = @WOLFBOOT_PARTITION_BOOT_ADDRESS@; _wolfboot_partition_size = @WOLFBOOT_PARTITION_SIZE@; _wolfboot_partition_update_address = @WOLFBOOT_PARTITION_UPDATE_ADDRESS@; _wolfboot_partition_swap_address = @WOLFBOOT_PARTITION_SWAP_ADDRESS@; - -PROVIDE(_start_heap = _end); -PROVIDE(end = _end); -PROVIDE(_end_stack = ORIGIN(RAM) + LENGTH(RAM)); diff --git a/test-app/Makefile b/test-app/Makefile index 13e53d2a58..c88129b1eb 100644 --- a/test-app/Makefile +++ b/test-app/Makefile @@ -182,6 +182,9 @@ ifeq ($(WOLFCRYPT_SUPPORT),1) # Add SP C math (all architectures) APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/sp_c32.o + # Add RSA support + APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/rsa.o + ifneq ($(NO_ASM),1) # SP Cortex M ifneq ($(filter ARM ARM_BE,$(ARCH)),) @@ -702,6 +705,7 @@ ifeq ($(TARGET),mcxn) endif ifeq ($(TARGET),lpc55s69) + CFLAGS+=-ffunction-sections -fdata-sections ifeq ($(TZEN),1) LSCRIPT_TEMPLATE=ARM-lpc55s69-ns.ld CFLAGS:=$(filter-out -mcmse, $(CFLAGS)) @@ -716,14 +720,26 @@ ifeq ($(TARGET),lpc55s69) $(MCUXPRESSO)/drivers/flexcomm/fsl_flexcomm.o \ $(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o \ $(MCUXPRESSO)/drivers/iap1/fsl_iap.o \ - $(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o - ifeq ($(WOLFCRYPT_TZ),1) - APP_OBJS+=$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o + $(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o \ + $(MCUXPRESSO)/drivers/rng_1/fsl_rng.o + ifeq ($(PKA),1) + CFLAGS+=-DWOLFSSL_NXP_LPC55S69_WITH_HWACCEL + APP_OBJS+=\ + $(MCUXPRESSO)/drivers/casper/fsl_casper.o \ + $(MCUXPRESSO)/drivers/hashcrypt/fsl_hashcrypt.o \ + $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/casper_port.o \ + $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/hashcrypt_port.o + else + CFLAGS+=-DWOLFSSL_NXP_LPC55S69_NO_HWACCEL endif - ifeq (,$(findstring nosys.specs,$(LDFLAGS))) - LDFLAGS+=--specs=nosys.specs + ifeq ($(WOLFCRYPT_SUPPORT),1) + LDFLAGS+=--specs=nano.specs endif - LDFLAGS+=-Wl,--no-warn-rwx-segments + ifeq ($(WOLFCRYPT_BENCHMARK),1) + # Benchmark needs float printf for results + LDFLAGS+=-Wl,-u_printf_float + endif + LDFLAGS+=-Wl,--no-warn-rwx-segments -Wl,--allow-multiple-definition endif ifeq ($(TARGET),nxp_lpc54s0xx) diff --git a/test-app/app_lpc55s69.c b/test-app/app_lpc55s69.c index 4582bd7a1b..5bacdf98fb 100644 --- a/test-app/app_lpc55s69.c +++ b/test-app/app_lpc55s69.c @@ -28,12 +28,40 @@ #include "wolfboot/wolfboot.h" #include "printf.h" +/* wolfCrypt test/benchmark support */ +#ifdef WOLFCRYPT_TEST +#include +#include +int wolfcrypt_test(void *args); +#endif + +#ifdef WOLFCRYPT_BENCHMARK +#include +#include +int benchmark_test(void *args); +#endif + #define RED_LED 6 #define GREEN_LED 7 #define BLUE_LED 4 extern void hal_init(void); + +volatile uint64_t SysTick_time_ms; + +void SysTick_Handler(void) +{ + SysTick_time_ms++; +} + +#ifdef WOLFCRYPT_BENCHMARK +static void systick_init(void) +{ + SysTick_Config(CLOCK_GetCoreSysClkFreq() / 1000U); /* 1 ms period */ +} +#endif + #define IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */ #define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */ #define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */ @@ -107,6 +135,15 @@ void main(void) hal_init(); leds_init(); +#ifdef WOLFCRYPT_BENCHMARK + systick_init(); + __enable_irq(); +#endif + + wolfBoot_printf("\n==================================\n"); + wolfBoot_printf("LPC55S69 wolfBoot demo Application\n"); + wolfBoot_printf("Copyright 2026 wolfSSL Inc\n"); + wolfBoot_printf("==================================\n"); check_parts(&boot_ver, &update_ver, &boot_state, &update_state); @@ -147,32 +184,60 @@ void main(void) GPIO_PinWrite(GPIO, 1, GREEN_LED, 0); } +#if defined(WOLFCRYPT_TEST) || defined(WOLFCRYPT_BENCHMARK) + wolfCrypt_Init(); + +# ifdef WOLFCRYPT_TEST + wolfBoot_printf("\nRunning wolfCrypt tests...\n"); + wolfcrypt_test(NULL); + wolfBoot_printf("Tests complete.\n\n"); +# endif + +# ifdef WOLFCRYPT_BENCHMARK + wolfBoot_printf("\nRunning wolfCrypt benchmarks...\n"); + benchmark_test(NULL); + wolfBoot_printf("Benchmarks complete.\n\n"); +# endif + + wolfCrypt_Cleanup(); +#endif + while (1) { __asm__ volatile ("wfi"); } } +#ifndef ENOMEM +#define ENOMEM 12 +#endif +#ifndef EBADF +#define EBADF 9 +#endif +#ifndef EINVAL +#define EINVAL 22 +#endif +int errno; #include "sys/stat.h" -int _getpid(void) +int WEAKFUNCTION _getpid(void) { return 1; } -int _kill(int pid, int sig) +int WEAKFUNCTION _kill(int pid, int sig) { (void)pid; (void)sig; return -1; } -void _exit(int status) +void WEAKFUNCTION _exit(int status) { _kill(status, -1); while (1) {} } -int _read(int file, char *ptr, int len) +int WEAKFUNCTION _read(int file, char *ptr, int len) { (void)file; (void)ptr; @@ -180,26 +245,26 @@ int _read(int file, char *ptr, int len) return -1; } -int _write(int file, char *ptr, int len) +int WEAKFUNCTION _write(int file, char *ptr, int len) { (void)file; (void)ptr; return len; } -int _close(int file) +int WEAKFUNCTION _close(int file) { (void)file; return -1; } -int _isatty(int file) +int WEAKFUNCTION _isatty(int file) { (void)file; return 1; } -int _lseek(int file, int ptr, int dir) +int WEAKFUNCTION _lseek(int file, int ptr, int dir) { (void)file; (void)ptr; @@ -207,9 +272,35 @@ int _lseek(int file, int ptr, int dir) return 0; } -int _fstat(int file, struct stat *st) +int WEAKFUNCTION _fstat(int file, struct stat *st) { (void)file; st->st_mode = S_IFCHR; return 0; } + +/* Heap management */ +extern char _end; /* Defined by linker */ +extern char _Min_Heap_Size; /* Linker symbol: address is the value */ + +void WEAKFUNCTION *_sbrk(int incr) +{ + static char *heap_end = 0; + char *prev_heap_end; + char *heap_limit; + + if (heap_end == 0) { + heap_end = &_end; + } + prev_heap_end = heap_end; + + heap_limit = &_end + (uintptr_t)&_Min_Heap_Size; + + if (heap_end + incr > heap_limit) { + errno = ENOMEM; + return (void *)-1; + } + + heap_end += incr; + return prev_heap_end; +} diff --git a/test-app/startup_arm.c b/test-app/startup_arm.c index 07995e3c4e..74fa18a302 100644 --- a/test-app/startup_arm.c +++ b/test-app/startup_arm.c @@ -43,7 +43,7 @@ extern void isr_usart3(void); extern void isr_lpuart1(void); #endif -#ifdef TARGET_va416x0 +#if defined(TARGET_va416x0) || defined(TARGET_lpc55s69) #define isr_systick SysTick_Handler #elif !defined(APP_HAS_SYSTICK) #define isr_systick isr_empty diff --git a/test-app/syscalls.c b/test-app/syscalls.c index 620cd4de12..77e0cbe5c3 100644 --- a/test-app/syscalls.c +++ b/test-app/syscalls.c @@ -141,6 +141,7 @@ int _getpid(void) * other OS facilities that don't exist in bare-metal. * wolfCrypt test/benchmark code calls standard printf, not wolfBoot_printf. */ +static int ___vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp); /* Route all printf-family functions through our vsnprintf (in this file) * rather than uart_vprintf (in string.c). This ensures float formatting @@ -149,7 +150,7 @@ int _getpid(void) int vprintf(const char *fmt, va_list args) { char buf[256]; - int len = vsnprintf(buf, sizeof(buf), fmt, args); + int len = ___vsnprintf(buf, sizeof(buf), fmt, args); if (len > 0) uart_write(buf, (len < (int)sizeof(buf)) ? len : (int)sizeof(buf) - 1); return len; @@ -221,7 +222,7 @@ static int buf_num(char *buf, int pos, int size, unsigned int num, return pos; } -int vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp) +static int ___vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp) { int pos = 0; const char *fmtp = fmt; @@ -374,7 +375,7 @@ int snprintf(char *buf, unsigned int size, const char *fmt, ...) va_list args; int ret; va_start(args, fmt); - ret = vsnprintf(buf, size, fmt, args); + ret = ___vsnprintf(buf, size, fmt, args); va_end(args); return ret; } @@ -438,7 +439,7 @@ int __snprintf_chk(char *buf, unsigned int maxlen, int flag, int ret; (void)flag; va_start(args, fmt); - ret = vsnprintf(buf, size, fmt, args); + ret = ___vsnprintf(buf, size, fmt, args); va_end(args); return ret; } diff --git a/test-app/wolfcrypt_support.c b/test-app/wolfcrypt_support.c index 92d07d3b21..b4f2447126 100644 --- a/test-app/wolfcrypt_support.c +++ b/test-app/wolfcrypt_support.c @@ -42,6 +42,8 @@ #elif defined(TARGET_va416x0) /* Use Vorago SDK HAL_time_ms (incremented by SysTick_Handler every 1ms) */ extern volatile uint64_t HAL_time_ms; +#elif defined(TARGET_lpc55s69) + extern volatile uint64_t SysTick_time_ms; #elif defined(TARGET_nxp_t2080) || defined(TARGET_nxp_t1024) /* PPC timebase register for accurate timing. * Timebase frequency = platform_clock / 16. */ @@ -96,6 +98,10 @@ unsigned long my_time(unsigned long* timer) unsigned long t = (unsigned long)(HAL_time_ms / 1000); if (timer) *timer = t; return t; +#elif defined(TARGET_lpc55s69) + unsigned long t = (unsigned long)(SysTick_time_ms / 1000); + if (timer) *timer = t; + return t; #elif defined(TARGET_nxp_t2080) || defined(TARGET_nxp_t1024) if (ppc_tb_hz == 0) ppc_tb_hz = ppc_get_timebase_hz(); @@ -125,6 +131,9 @@ double current_time(int reset) (void)reset; /* Use Vorago SDK SysTick-based millisecond counter */ return (double)HAL_time_ms / 1000.0; +#elif defined(TARGET_lpc55s69) + (void)reset; + return (double)SysTick_time_ms / 1000.0; #elif defined(TARGET_nxp_t2080) || defined(TARGET_nxp_t1024) if (ppc_tb_hz == 0) ppc_tb_hz = ppc_get_timebase_hz(); diff --git a/tools/scripts/lpc55s69/lpc55s69_debug.cmm b/tools/scripts/lpc55s69/lpc55s69_debug.cmm new file mode 100644 index 0000000000..a90f601f90 --- /dev/null +++ b/tools/scripts/lpc55s69/lpc55s69_debug.cmm @@ -0,0 +1,38 @@ +;; lpc55s69_debug.cmm + +&basedir="\\wsl.localhost\Ubuntu-22.04\home\tcook\wolf\wolfBoot" + +RESet +SYStem.RESet +SYStem.CPU LPC55S69JBD100-CPU0 +SYStem.CONFIG.DEBUGPORTTYPE SWD +IF COMBIPROBE()||UTRACE() +( + SYStem.CONFIG.CONNECTOR MIPI20T +) +SYStem.Option DUALPORT ON +SYStem.MemAccess DAP +SYStem.JtagClock 10MHz +ITM.OFF +Trace.DISable +break.config.method program onchip +mode.hll + +SYStem.Up + +;; STOP in wolfBoot... +data.load "&basedir\wolfboot.elf" /nocode +symbol.sourcepath.TranslateSUBpath "\home\tcook\wolf\wolfBoot" "&basedir" +Register.Set PC isr_reset +Register.Set MSP END_STACK +break.set main /onchip /temporary +break.set do_boot /onchip /temporary +go + +;; STOP in test-app... +;; UNCOMMENT the following: +;;WAIT !STATE.RUN() +;;data.load "&basedir\test-app\image.elf" /nocode +;;break.set main /onchip /temporary + +go diff --git a/tools/scripts/lpc55s69/lpc55s69_flash_factory_bin.cmm b/tools/scripts/lpc55s69/lpc55s69_flash_factory_bin.cmm new file mode 100644 index 0000000000..e64a3550b1 --- /dev/null +++ b/tools/scripts/lpc55s69/lpc55s69_flash_factory_bin.cmm @@ -0,0 +1,28 @@ +;; lpc55s69_flash_factory_bin.cmm + +&basedir="\\wsl.localhost\Ubuntu-22.04\home\tcook\wolf\wolfBoot" + +RESet +SYStem.RESet +SYStem.CPU LPC55S69JBD100-CPU0 +SYStem.CONFIG.DEBUGPORTTYPE SWD +IF COMBIPROBE()||UTRACE() +( + SYStem.CONFIG.CONNECTOR MIPI20T +) +SYStem.Option DUALPORT ON +SYStem.MemAccess DAP +SYStem.JtagClock 10MHz +ITM.OFF +Trace.DISable + +SYStem.Up + +DO ~~/demo/arm/flash/lpc55xx PREPAREONLY + +flash.erase all +FLASH.ReProgram ALL +Data.LOAD.Binary "&basedir\factory.bin" 0 +FLASH.ReProgram OFF + +ENDDO diff --git a/tools/scripts/lpc55s69/lpc55s69_flash_update.cmm b/tools/scripts/lpc55s69/lpc55s69_flash_update.cmm new file mode 100644 index 0000000000..86e56a9e43 --- /dev/null +++ b/tools/scripts/lpc55s69/lpc55s69_flash_update.cmm @@ -0,0 +1,28 @@ +;; lpc55s69_flash_update.cmm + +&basedir="\\wsl.localhost\Ubuntu-22.04\home\tcook\wolf\wolfBoot" + +RESet +SYStem.RESet +SYStem.CPU LPC55S69JBD100-CPU0 +SYStem.CONFIG.DEBUGPORTTYPE SWD +IF COMBIPROBE()||UTRACE() +( + SYStem.CONFIG.CONNECTOR MIPI20T +) +SYStem.Option DUALPORT ON +SYStem.MemAccess DAP +SYStem.JtagClock 10MHz +ITM.OFF +Trace.DISable + +SYStem.Up + +DO ~~/demo/arm/flash/lpc55xx PREPAREONLY + + +FLASH.ReProgram ALL +Data.LOAD.Binary "&basedir\test-app\image_v2_signed.bin" 0x18000 +FLASH.ReProgram OFF + +ENDDO