Skip to content

Commit 022b8d3

Browse files
dgarskedanielinux
authored andcommitted
Progress on adding NXP QorIQ P1021 support.
1 parent e88a7dc commit 022b8d3

File tree

9 files changed

+926
-20
lines changed

9 files changed

+926
-20
lines changed

INSTALL.md

+30-10
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,65 @@ https://github.com/wolfSSL/wolfssl/archive/master.zip
1919

2020
1. Extract wolfBoot
2121
2. `cd wolfBoot/lib`
22-
3. Extact wolfSSL (should be named `lib/wolfssl`)
22+
3. Extract wolfSSL (should be named `lib/wolfssl`)
2323

2424
Directory should look like:
2525

2626
```
2727
wolfBoot
2828
-> config
29-
-> docs
30-
-> hal
29+
-> examples (sample configurations)
30+
-> docs (markdown docs)
31+
-> hal (Hardware target abstractions)
32+
-> spi
33+
-> uart
3134
-> IDE
3235
-> include
33-
-> lib
36+
-> lib (wolfSSL and wolfTPM submodules)
3437
-> wolfssl
3538
-> src
3639
-> wolfcrypt/src
3740
-> src
38-
-> test-app
39-
-> tools
41+
-> image.c (crypto verify/hash)
42+
-> loader.c (main)
43+
-> libwolfboot.c (User application API’s)
44+
-> update_*.c (flash/ram wolfBoot_start)
45+
-> test-app (example applications)
46+
-> tools
47+
-> keytools (signing and key generation tools)
4048
```
4149

4250
## Configuration
4351

4452
Use `make config` to walk-through setting up the platform, architecture and partition settings.
4553
OR
46-
Use the `config/examples` as a template to wolfBoot root as `.config`.
54+
Use the `config/examples` as a template to wolfBoot root as `.config`.
4755
Example: `cp ./config/examples/zynqmp.config .config`
4856

4957
## Setup the Key
5058

51-
Use the key generation tool in `tools/keytool` or get existing keys.
52-
Copy `rsa4096.der` to wolfBoot root
53-
Copy `rsa4096_pub_key.c` to `./src`
59+
Build the key tools: `make keytools`
60+
61+
The key generation is handled the first time you use `make`, however we do provide some tools to help use existing keys.
62+
See tools in `tools/keytool`. Public key(s) are populated into the `src/keystore.c`.
63+
The signing key used goes into wolfBoot root (example `rsa4096.der`).
5464

5565
## Building
5666

5767
```sh
5868
make
5969
```
6070

71+
The “make [target]
72+
* `keytools`: Build the C version of the key tools
73+
* `wolfboot.bin`: Build the .elf and .bin version of the bootloader only
74+
* `test-app/image.bin`: Builds the test application
75+
* `test-app/image_v1_signed.bin`: Builds the test application signed with version 1
76+
* `factory.bin`: Builds bootloader and test application signed and appended together
77+
78+
Note: Default is “factory.bin”
79+
80+
6181
## Building with Cross Compile
6282

6383
QNX Example:

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# wolfBoot
2+
23
wolfSSL Secure Bootloader ([Home page](https://www.wolfssl.com/products/wolfboot/))
34

45
wolfBoot is a portable, OS-agnostic, secure bootloader solution for 32-bit microcontrollers,
@@ -8,7 +9,6 @@ Due to the minimalist design of the bootloader and the tiny HAL API, wolfBoot is
89
from any OS or bare-metal application, and can be easily ported and integrated in existing embedded software
910
projects to provide a secure firmware update mechanism.
1011

11-
1212
## Features
1313
- Multi-slot partitioning of the flash device
1414
- Integrity verification of the firmware image(s)
@@ -93,16 +93,19 @@ For more detailed information about firmware update implementation, see [Firmwar
9393

9494
### Makefile
9595

96-
To build using the Makefile, create a `.config` file with your build specifications in the wolfBoot root directory. You can find a
96+
To build using the Makefile, create a `.config` file with your build specifications in the wolfBoot root directory. You can find a
9797
number of examples that you can use inside [config/examples](config/examples). Then run `make keytools` to generate the signing
98-
and key generation tools. If you have wolfCrypt-py installed and would like to use it, you can skip this step.
98+
and key generation tools. If you have wolfCrypt-py installed and would like to use it, you can skip this step.
99+
100+
Documentation for the flash configuration options used in `.config` can be found in [docs/compile.md](docs/compile.md).
99101

100102
For example, to build using our provided `stm32h7.config`:
103+
101104
```
102105
cp config/examples/stm32h7.config .config
103106
make keytools
104107
make
105-
```
108+
```
106109

107110
### CMake
108111

@@ -116,7 +119,7 @@ $ mkdir build
116119
$ cd build
117120
$ cmake -DWOLFBOOT_TARGET=stm32h7 -DBUILD_TEST_APPS=yes -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x8020000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_SIZE=0xD0000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x80F0000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81C0000 ..
118121
$ make
119-
```
122+
```
120123

121124
The output should look something like:
122125
```
@@ -174,7 +177,7 @@ Selected cipher: ECC256
174177
Selected hash : SHA256
175178
Public key: /home/user/wolfBoot/build/wolfboot_signing_private_key.der
176179
Output image: /home/user/wolfBoot/build/test-app/image_v1_signed.bin
177-
Target partition id : 1
180+
Target partition id : 1
178181
Calculating SHA256 digest...
179182
Signing the digest...
180183
Output image(s) successfully created.
@@ -206,7 +209,7 @@ Selected cipher: ECC256
206209
Selected hash : SHA256
207210
Public key: /home/user/wolfBoot/build/wolfboot_signing_private_key.der
208211
Output image: /home/user/wolfBoot/build/test-app/image_v1_signed.bin
209-
Target partition id : 1
212+
Target partition id : 1
210213
Calculating SHA256 digest...
211214
Signing the digest...
212215
Output image(s) successfully created.
@@ -223,12 +226,12 @@ Signing and hashing algorithms can be specified with `-DSIGN=<alg>` and `-DHASH=
223226
options to configuring wolfBoot, add `-LAH` to your cmake command, along with the partition specifications.
224227
```
225228
$ cmake -DWOLFBOOT_TARGET=stm32h7 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x8020000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_SIZE=0xD0000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x80F0000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81C0000 -LAH ..
226-
```
229+
```
227230

228231
##### stm32f4
229232
```
230233
$ cmake -DWOLFBOOT_TARGET=stm32f4 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08020000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08040000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x08060000 ..
231-
```
234+
```
232235

233236
##### stm32u5
234237
```

arch.mk

+16
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,22 @@ ifeq ($(TARGET),nxp_t2080)
274274
endif
275275
endif
276276

277+
ifeq ($(TARGET),nxp_p1021)
278+
# Power PC big endian
279+
ARCH_FLAGS=-m32 -mhard-float -mcpu=e500mc
280+
CFLAGS+=$(ARCH_FLAGS) -DBIG_ENDIAN_ORDER
281+
CFLAGS+=-DMMU -DWOLFBOOT_DUALBOOT
282+
CFLAGS+=-pipe # use pipes instead of temp files
283+
CFLAGS+=-feliminate-unused-debug-types
284+
LDFLAGS+=$(ARCH_FLAGS)
285+
LDFLAGS+=-Wl,--hash-style=both # generate both sysv and gnu symbol hash table
286+
LDFLAGS+=-Wl,--as-needed # remove weak functions not used
287+
UPDATE_OBJS:=src/update_ram.o
288+
ifeq ($(SPMATH),1)
289+
MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_c32.o
290+
endif
291+
endif
292+
277293
ifeq ($(TARGET),ti_hercules)
278294
# HALCoGen Source and Include?
279295
CORTEX_R5=1

config/examples/nxp-p1021.config

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
ARCH=PPC
2+
TARGET=nxp_p1021
3+
SIGN?=ECC384
4+
HASH?=SHA384
5+
IMAGE_HEADER_SIZE?=512
6+
DEBUG?=0
7+
DEBUG_UART?=1
8+
VTOR?=1
9+
CORTEX_M0?=0
10+
NO_ASM?=0
11+
EXT_FLASH?=0
12+
SPI_FLASH?=0
13+
NO_XIP?=0
14+
UART_FLASH?=0
15+
ALLOW_DOWNGRADE?=0
16+
NVM_FLASH_WRITEONCE?=0
17+
WOLFBOOT_VERSION?=0
18+
NO_MPU?=0
19+
SPMATH?=1
20+
RAM_CODE?=1
21+
DUALBANK_SWAP?=0
22+
WOLFTPM?=0
23+
24+
# NAND Base Address
25+
ARCH_FLASH_OFFSET?=0xE8000000
26+
27+
# Flash Sector Size
28+
WOLFBOOT_SECTOR_SIZE=0x10000
29+
30+
# wolfBoot start address
31+
WOLFBOOT_ORIGIN=0xEFF40000
32+
# wolfBoot parition size (custom)
33+
BOOTLOADER_PARTITION_SIZE=0x20000
34+
35+
# Application Partition Size
36+
WOLFBOOT_PARTITION_SIZE?=0xA00000
37+
# Location in Flash for Application Partition
38+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xE8080000
39+
# Load Partition to RAM Address
40+
WOLFBOOT_LOAD_ADDRESS?=0x19000
41+
42+
# Location in Flash for Update Partition
43+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xE8A80000
44+
45+
# Location of temporary sector used during updates
46+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xE8060000
47+
48+
# DTS (Device Tree)
49+
WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8040000
50+
WOLFBOOT_DTS_UPDATE_ADDRESS?=0xE8050000
51+
# DTS Load to RAM Address
52+
WOLFBOOT_LOAD_DTS_ADDRESS?=0x40000

docs/Targets.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This README describes configuration of supported targets.
1010
* [NXP LPC54xxx](#nxp-lpc54xxx)
1111
* [NXP iMX-RT](#nxp-imx-rt)
1212
* [NXP Kinetis](#nxp-kinetis)
13+
* [NXP P1021 PPC](#nxp-p1021-ppc)
1314
* [NXP T2080 PPC](#nxp-t2080-ppc)
1415
* [Qemu x86-64 UEFI](#qemu-x86-64-uefi)
1516
* [SiFive HiFive1 RISC-V](#sifive-hifive1-risc-v)

0 commit comments

Comments
 (0)