Fixes and improvements for iMXRT1050 QSPI.

pull/348/head^2
David Garske 2023-08-09 11:21:39 -07:00 committed by Daniele Lacamera
parent 6bfc594a75
commit 712a543c9d
8 changed files with 36 additions and 11 deletions

View File

@ -97,7 +97,7 @@ MEMORY
In order to generate a signed image, the application is copied to a binary format and signed with the following commands
```
"c:\ti\ccs1031\ccs\tools\compiler\ti-cgt-arm_20.2.4.LTS\bin\armobjcopy.exe" -O binary application.out application.bin
".\tools\keytools\sign.exe" --ecc256 --sha256 application.bin ecc256.der 1
".\tools\keytools\sign.exe" --ecc256 --sha256 application.bin wolfboot_signing_private_key.der 1
```
Output should resemble:
@ -106,7 +106,7 @@ Update type: Firmware
Input image: application.bin
Selected cipher: ECC256
Selected hash : SHA256
Public key: ecc256.der
Public key: wolfboot_signing_private_key.der
Output image: application_v1_signed.bin
Calculating SHA256 digest...
Signing the firmware...
@ -116,7 +116,7 @@ Output image(s) successfully created.
To flash the signed image the following command can be used.
```
"c:\ti\ccs1031\ccs\ccs_base\scripting\examples\uniflash\cmdLine\uniflash.bat" -ccxml "IDE\CCS\TMS570LC43xx\flashHercules.ccxml" -setOptions FlashEraseSelection="Necessary Sectors Only (for Program Load)" -programBin application_v1_signed.bin 0x20000
"c:\ti\ccs1031\ccs\ccs_base\scripting\examples\uniflash\cmdLine\uniflash.bat" -ccxml "IDE\CCS\TMS570LC43xx\flashHercules.ccxml" -setOptions FlashEraseSelection="Necessary Sectors Only (for Program Load)" -programBin application_v1_signed.bin 0x20000
```
# Implementation notes

View File

@ -40,14 +40,14 @@ generate_key.bat
```
The script will generate a keypair. The file `ecc256.der` in the root of the repository contains the private key that will be used
to sign valid firmware images. The file `src/ecc256_pub_key.c` now contains the public key that the bootloader embeds in its codebase
The script will generate a keypair. The file `wolfboot_signing_private_key.der` in the root of the repository contains the private key that will be used
to sign valid firmware images. The file `src/keystore.c` now contains the public key that the bootloader embeds in its codebase
to use it later to verify the image.
### Compiling and linking the images
Now both projects (wolfboot and wolfboot-test-app) can be compiled and linked.
Now both projects (wolfboot and wolfboot-test-app) can be compiled and linked.
The two resulting images will be placed in the output directory `Debug/Exe`:
- wolfboot.bin
- wolfboot-test-app.bin

View File

@ -2,7 +2,7 @@ ARCH?=ARM
TARGET?=imx_rt
SIGN?=ECC256
HASH?=SHA256
MCUXPRESSO?=$(PWD)/../SDK_2_11_0_EVKB-IMXRT1050
MCUXPRESSO?=$(PWD)/../SDK_2_14_0_EVKB-IMXRT1050
MCUXPRESSO_CPU?=MIMXRT1052DVJ6B
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MIMXRT1052
MCUXPRESSO_CMSIS?=$(MCUXPRESSO)/CMSIS

View File

@ -1053,6 +1053,31 @@ DCP support (hardware acceleration for SHA256 operations) can be enabled by usin
Firmware can be directly uploaded to the target by copying `factory.bin` to the virtual USB drive associated to the device, or by loading the image directly into flash using a JTAG/SWD debugger.
### Testing Update
```sh
tools/scripts/prepare_update.sh
# HyperFlash
JLinkExe -if swd -speed 5000 -Device "MIMXRT1052XXX6A"
# QSPI
JLinkExe -if swd -speed 5000 -Device "MIMXRT1052XXX6A?BankAddr=0x60000000&Loader=QSPI"
loadbin factory.bin 0x60000000
loadbin update.bin 0x60030000
```
### NXP iMX-RT Debugging JTAG / JLINK
```sh
JLinkGDBServer -Device MIMXRT1052xxx6A -speed 5000 -if swd -port 3333
arm-none-eabi-gdb
add-symbol-file test-app/image.elf 0x60010000
mon reset init
b main
c
```
## NXP Kinetis

View File

@ -16,7 +16,7 @@ echo -n "0123456789abcdef0123456789abcdef0123456789ab" > enc_key.der
$SIGN_TOOL --ecc256 \
--encrypt enc_key.der \
--delta test-app/image_v1_signed.bin \
test-app/image.bin ecc256.der $VERSION
test-app/image.bin wolfboot_signing_private_key.der $VERSION
dd if=/dev/zero bs=$SIZE count=1 2>/dev/null | tr "\000" "\377" > update.bin
dd if=$APP of=update.bin bs=1 conv=notrunc
printf "pBOOT" >> update.bin

View File

@ -9,7 +9,7 @@ fi
SIZE=131067
VERSION=8
APP=test-app/image_v"$VERSION"_signed.bin
$SIGN_TOOL --ecc256 test-app/image.bin ecc256.der $VERSION
$SIGN_TOOL --ecc256 test-app/image.bin wolfboot_signing_private_key.der $VERSION
dd if=/dev/zero bs=$SIZE count=1 2>/dev/null | tr "\000" "\377" > update.bin
dd if=$APP of=update.bin bs=1 conv=notrunc
printf "pBOOT" >> update.bin

View File

@ -9,7 +9,7 @@ fi
SIZE=129019
VERSION=8
APP=test-app/image_v"$VERSION"_signed.bin
$SIGN_TOOL --sha256 --ecc256 test-app/image.bin ecc256.der $VERSION
$SIGN_TOOL --sha256 --ecc256 test-app/image.bin wolfboot_signing_private_key.der $VERSION
dd if=/dev/zero bs=$SIZE count=1 2>/dev/null | tr "\000" "\377" > update.bin
dd if=$APP of=update.bin bs=1 conv=notrunc
printf "pBOOT" >> update.bin

View File

@ -9,7 +9,7 @@ fi
SIZE=229371
VERSION=8
APP=test-app/image_v"$VERSION"_signed.bin
$SIGN_TOOL --ecc256 test-app/image.bin ecc256.der $VERSION
$SIGN_TOOL --ecc256 test-app/image.bin wolfboot_signing_private_key.der $VERSION
dd if=/dev/zero bs=$SIZE count=1 2>/dev/null | tr "\000" "\377" > update.bin
dd if=$APP of=update.bin bs=1 conv=notrunc
printf "pBOOT" >> update.bin