forked from wolfSSL/wolfMQTT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wolfSSL#37 from danielinux/aarch64
wolfBoot Aarch64 support (Xilinx Zynq and Raspberry Pi)
- Loading branch information
Showing
59 changed files
with
4,696 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>efuse_wolfboot</name> | ||
<comment>Created by SDK v2018.2. standalone_bsp_0 - psu_cortexa53_0</comment> | ||
<projects> | ||
<project>standalone_bsp_0</project> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | ||
<triggers>full,incremental,</triggers> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.cdt.core.cnature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Xilinx SDK wolfBoot Project | ||
|
||
To use this example project: | ||
1. Copy `.cproject` and `.project` into the wolfBoot root. | ||
2. From the Xilinx SDK Import wolfBoot using "Import" -> "Existing Projects into Workspace". | ||
|
||
## wolfBoot Configuration | ||
|
||
A build settings template for Zynq UltraScale+ can be found here `./config/examples/zynqmp.config`. This file can be copied to wolfBoot root as `.config` for building from the command line. These template settings are also in this `.cproject` as preprocessor macros. These settings are loaded into the `target.h.in` template by the wolfBoot `make`. If not using the built-in make then the following defines will need to be manually created in `target.h`: | ||
|
||
``` | ||
#define WOLFBOOT_SECTOR_SIZE 0x20000 | ||
#define WOLFBOOT_PARTITION_BOOT_ADDRESS 0x800000 | ||
#define WOLFBOOT_LOAD_ADDRESS 0x10000000 | ||
#define WOLFBOOT_PARTITION_SIZE 0x2A00000 | ||
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS 0x3A00000 | ||
#define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x63E0000 | ||
#define WOLFBOOT_DTS_BOOT_ADDRESS 0x7E0000 | ||
#define WOLFBOOT_DTS_UPDATE_ADDRESS 0x39E0000 | ||
#define WOLFBOOT_LOAD_DTS_ADDRESS 0x11800000 | ||
``` | ||
|
||
Note: If not using Position Independent Code (PIC) the linker script `ldscript.ld` must have the start address offset to match the `WOLFBOOT_LOAD_ADDRESS`. | ||
|
||
## Signing Example | ||
|
||
```sh | ||
python3 ./tools/keytools/sign.py --rsa4096 --sha3 ../helloworld/Debug/helloworld.elf ./rsa4096.der 1 | ||
``` | ||
|
||
## Bootgen | ||
|
||
Xilinx uses a `bootgen` tool for generating a boot binary image that has Xilinx headers, which the FSBL (First Stage Boot Loader) understands. See the `boot.bif` and `boot_auth.bif` as examples. | ||
|
||
* Use "partition_owner=uboot" to prevent a partition from being loaded into RAM. | ||
* Use "offset=" option to place the application into a specific location in flash. | ||
* Use "load=" option to have FSBL load into specific location in RAM. | ||
|
||
### Adding RSA Authentication | ||
|
||
1. Generate keys: | ||
* `bootgen.exe -generate_keys auth pem -arch zynqmp -image boot.bif` | ||
2. Create hash for primary key: | ||
* `bootgen.exe -image boot.bif -arch zynqmp -w -o i BOOT.BIN -efuseppkbits ppkf_hash.txt` | ||
3. Import example project for programming eFuses: | ||
* New BSP project (program efuses , ZCU102_hw_platform, standalone, CPU: PSU_cortexa53_0) | ||
* Goto Xilinx Board Support Packet Settings. | ||
* Scroll down to Supported Libraries and Check the xiskey libray | ||
* In the system.mss pane, scroll down to Libraries and click Import Examples. | ||
* Check the xilskey_esfuseps_zynqmp_example | ||
4. Edit `xilskey_efuseps_zynqmp_input.h` | ||
* 433 `#define XSK_EFUSEPS_WRITE_PPK0_HASH TRUE` | ||
* 453 `#define XSK_EFUSEPS_PPK0_IS_SHA3 TRUE` | ||
* 454 `#define XSK_EFUSEPS_PPK0_HASH "0000000000000000000000000000000000000000000000000000000000000000" /* from ppkf_hash.txt */`` | ||
5. Update boot.bif (see boot_auth.bif) | ||
|
||
``` | ||
[auth_params] ppk_select=0; spk_id=0x00000000 | ||
[pskfile] pskf.pem | ||
[sskfile] sskf.pem | ||
authentication=rsa | ||
``` | ||
6. Build “boot.bin” image: | ||
* `bootgen.exe -image boot.bif -arch zynqmp -o i BOOT.BIN -w` | ||
Note: To generate a report of a boot.bin use the `bootgen_utility`: | ||
`bootgen_utility -arch zynqmp -bin boot.bin -out boot.bin.txt` | ||
### References: | ||
* [ZAPP1319](https://www.xilinx.com/support/documentation/application_notes/xapp1319-zynq-usp-prog-nvm.pdf): Programming BBRAM and eFUSEs | ||
* [UG1283](https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug1283-bootgen-user-guide.pdf): Bootgen User Guide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Boot BIF example for wolfBoot with signed Hello World | ||
// Note: "partition_owner=uboot" prevents partition from being loaded to RAM | ||
the_ROM_image: | ||
{ | ||
[bootloader, destination_cpu=a53-0] zynqmp_fsbl.elf | ||
[destination_cpu=pmu] pmufw.elf | ||
[destination_device=pl] system.bit | ||
[destination_cpu=a53-0, exception_level=el-3, trustzone] bl31.elf | ||
[destination_cpu=a53-0, exception_level=el-2] wolfboot.elf | ||
[destination_cpu=a53-0, offset=0x800000, partition_owner=uboot] helloworld_v1_signed.bin | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Boot BIF example with Xilinx Secure Boot authentication and wolfBoot | ||
the_ROM_image: | ||
{ | ||
// Boot Header Authentication Enable | ||
[fsbl_config] bh_auth_enable | ||
|
||
// Use the primary public key 0 and secondary public key id 0 | ||
[auth_params] ppk_select=0; spk_id=0x00000000 | ||
|
||
// primary and secondary secret (private) keys | ||
[pskfile] pskf.pem | ||
[sskfile] sskf.pem | ||
|
||
[bootloader, destination_cpu=a53-0, authentication=rsa] zynqmp_fsbl.elf | ||
[destination_cpu=pmu, authentication=rsa] pmufw.elf | ||
[destination_device=pl, authentication=rsa] system.bit | ||
[destination_cpu=a53-0, exception_level=el-3, trustzone, authentication=rsa] bl31.elf | ||
[destination_cpu=a53-0, authentication=rsa, load=0x11800000] system.dtb | ||
|
||
// ARM Device Tree (loaded to RAM at 0x11800000 by wolfBoot) | ||
[ destination_cpu=a53-0, authentication=rsa, offset=0x007E0000, partition_owner=uboot] system.dtb | ||
|
||
// Second Stage wolfBoot Bootloader (in RAM at 0x0) | ||
[destination_cpu=a53-0, exception_level=el-2, authentication=rsa] wolfboot.elf | ||
|
||
// Kernel / Application (load to RAM at 0x10000000 by wolfBoot) | ||
// Using partition_owner=uboot prevents FSBL from loading to RAM | ||
[destination_cpu=a53-0, offset=0x800000, partition_owner=uboot] kernel.ui | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
ARCH?=RISCV | ||
TARGET?=hifive1 | ||
SIGN?=ECC256 | ||
HASH?=SHA256 | ||
FREEDOM_E_SDK?=~/src/freedom-e-sdk | ||
DEBUG?=0 | ||
VTOR?=1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
ARCH?=AARCH64 | ||
TARGET?=raspi3 | ||
SIGN?=RSA4096 | ||
HASH?=SHA3 | ||
DEBUG?=1 | ||
VTOR?=1 | ||
CORTEX_M0?=0 | ||
NO_ASM?=0 | ||
EXT_FLASH?=0 | ||
SPI_FLASH?=0 | ||
ALLOW_DOWNGRADE?=0 | ||
NVM_FLASH_WRITEONCE?=0 | ||
WOLFBOOT_VERSION?=0 | ||
V?=0 | ||
SPMATH?=1 | ||
RAM_CODE?=0 | ||
DUALBANK_SWAP?=0 | ||
IMAGE_HEADER_SIZE?=256 | ||
PKA?=1 | ||
WOLFTPM?=0 | ||
WOLFBOOT_PARTITION_SIZE=0xF60000 | ||
WOLFBOOT_SECTOR_SIZE=0x20000 | ||
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xc0000 | ||
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x10c0000 | ||
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x1000000 | ||
WOLFBOOT_LOAD_ADDRESS?=0x3000000 | ||
WOLFBOOT_LOAD_DTS_ADDRESS?=0x4000000 | ||
WOLFBOOT_DTS_BOOT_ADDRESS?=0xa0000 | ||
WOLFBOOT_DTS_UPDATE_ADDRESS?=0x10a0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
ARCH?=ARM | ||
TARGET?=stm32f4 | ||
SIGN?=ED25519 | ||
HASH?=SHA256 | ||
DEBUG?=0 | ||
VTOR?=1 | ||
CORTEX_M0?=0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
ARCH?=ARM | ||
TARGET?=stm32f7 | ||
SIGN?=ECC256 | ||
HASH?=SHA256 | ||
DEBUG?=0 | ||
VTOR?=1 | ||
CORTEX_M0?=0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
ARCH?=ARM | ||
TARGET?=stm32g0 | ||
SIGN?=ED25519 | ||
HASH?=SHA256 | ||
DEBUG?=0 | ||
VTOR?=1 | ||
CORTEX_M0?=1 | ||
|
Oops, something went wrong.