From 49699bcc03e19021cea19cbd4d87121fbc35db9b Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 29 Mar 2024 11:39:40 -0700 Subject: [PATCH] Add example for larger wolfBoot partition scheme (all partitions 40KB). Added instructions for debugging. --- config/examples/mcxa.config | 14 ++++++++++- docs/Targets.md | 47 +++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/config/examples/mcxa.config b/config/examples/mcxa.config index d13fc5da..5c738f5a 100644 --- a/config/examples/mcxa.config +++ b/config/examples/mcxa.config @@ -21,8 +21,20 @@ SPMATH?=1 RAM_CODE?=1 DUALBANK_SWAP?=0 PKA?=1 -WOLFBOOT_PARTITION_SIZE?=0xB000 + +# 8KB sectors WOLFBOOT_SECTOR_SIZE?=0x2000 + +# Default configuration +# 32KB boot, 44KB partitions, 8KB swap +WOLFBOOT_PARTITION_SIZE?=0xB000 WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x8000 WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x13000 WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x1E000 + +# Alternate larger configuration for debugging or SP ASM +# 40KB boot, 40KB partitions, 8KB swap +#WOLFBOOT_PARTITION_SIZE?=0xA000 +#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xA000 +#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x14000 +#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x1E000 diff --git a/docs/Targets.md b/docs/Targets.md index fb512113..10207781 100644 --- a/docs/Targets.md +++ b/docs/Targets.md @@ -1719,36 +1719,25 @@ The support has been tested using FRDM-MCXA153 with the onboard MCU-Link configu This requires the MCXA SDK from the NXP MCUXpresso SDK Builder. We tested using `SDK_2.14.2_MCXA153` and placed into `../NXP/MCXA153` by default (see .config or set with `MCUXPRESSO`). MCUXpresso SDK Builder -### Configuring and compiling +### MCX A: Configuring and compiling -Copy the example configuration file: +Copy the example configuration file and build with make: -`cp config/examples/mcxa.config .config` +```sh +cp config/examples/mcxa.config .config` +make +``` -Compile via: - -`make` - -### Loading the firmware +### MCX A: Loading the firmware The NXP Freedom MCX A board debugger comes loaded with MCU Link, but it can be updated to JLink. See https://docs.nxp.com/bundle/UM12012/page/topics/Updating_MCU_Link_firmware.html -Use JLinkExe tool to upload the initial firmware: - -`JLinkExe -if swd -Device MCXA153` +Use JLinkExe tool to upload the initial firmware: `JLinkExe -if swd -Device MCXA153` At the Jlink prompt, type: ``` loadbin factory.bin 0 -'loadbin': Performing implicit reset & halt of MCU. -ResetTarget() start -Reset via SYSRESETREQ and reset pin + halt after bootloader -ResetTarget() end - Took 111ms -AfterResetTarget() start - SRAM_XEN set to RWX - FLASH and IFR set to RWX -AfterResetTarget() end - Took 7.40ms Downloading file [factory.bin]... J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match O.K. @@ -1758,17 +1747,17 @@ Reset or power cycle board. Once wolfBoot has performaed validation of the partition and booted the D15 Green LED on P3_13 will illuminate. -### Testing firmware update +### MCX A: Testing firmware update 1) Sign the test-app with version 2: -``` +```sh ./tools/keytools/sign --ecc256 test-app/image.bin wolfboot_signing_private_key.der 2 ``` 2) Create a bin footer with wolfBoot trailer "BOOT" and "p" (ASCII for 0x70 == IMG_STATE_UPDATING): -``` +```sh echo -n "pBOOT" > trigger_magic.bin ``` @@ -1781,7 +1770,19 @@ echo -n "pBOOT" > trigger_magic.bin 0xAFFB trigger_magic.bin ``` -4) Flash update.bin to 0x13000 (`loadbin update.bin 0x13000`). The D15 GDB LED Blue P3_0 will show if version is > 1. +4) Flash update.bin to 0x13000 (`loadbin update.bin 0x13000`). The D15 RGB LED Blue P3_0 will show if version is > 1. + +Note: For alternate larger scheme flash `update.bin` to `0x14000` and place trigger_magic.bin at `0x9FFB`. + +### MCX A: Debugging + +Debugging with JLink: + +In one terminal: +`JLinkGDBServer -if swd -Device MCXA153 -port 3333` + +We include a `.gdbinit` in the wolfBoot root that loads the wolfboot and test-app elf files: +In another terminal use `gdb`. ## TI Hercules TMS570LC435