Skip to content

Commit 8a5c039

Browse files
authored
Merge pull request #475 from danielinux/imx-rt-hab
Add support for building for HAB for i.MX RT targets
2 parents f493526 + e081d74 commit 8a5c039

File tree

4 files changed

+105
-1
lines changed

4 files changed

+105
-1
lines changed

arch.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,12 @@ ifeq ($(TARGET),imx_rt)
562562
ifeq ($(DEBUG_UART),1)
563563
OBJS+= $(MCUXPRESSO_DRIVERS)/drivers/fsl_lpuart.o
564564
endif
565-
endif
565+
ifeq ($(TARGET_IMX_HAB),1)
566+
LSCRIPT_IN:=hal/$(TARGET)_hab.ld
567+
else
568+
LSCRIPT_IN:=hal/$(TARGET).ld
569+
endif
570+
endif
566571

567572
ifeq ($(MCUXPRESSO_CPU),MIMXRT1064DVL6A)
568573
ARCH_FLASH_OFFSET=0x70000000
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ARCH?=ARM
2+
TARGET?=imx_rt
3+
TARGET_IMX_HAB?=1
4+
SIGN?=ECC256
5+
HASH?=SHA256
6+
MCUXSDK?=0
7+
MCUXPRESSO?=$(PWD)/../SDK-2.11.0_EVK-MIMXRT1060
8+
MCUXPRESSO_CMSIS?=$(MCUXPRESSO)/CMSIS
9+
MCUXPRESSO_CPU?=MIMXRT1062DVL6A
10+
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MIMXRT1062
11+
DEBUG?=0
12+
VTOR?=1
13+
CORTEX_M0?=0
14+
NO_ASM?=0
15+
NO_MPU=1
16+
EXT_FLASH?=0
17+
SPI_FLASH?=0
18+
ALLOW_DOWNGRADE?=0
19+
NVM_FLASH_WRITEONCE?=1
20+
WOLFBOOT_VERSION?=0
21+
V?=0
22+
SPMATH?=1
23+
RAM_CODE?=0
24+
DUALBANK_SWAP?=0
25+
PKA?=0
26+
WOLFBOOT_PARTITION_SIZE?=0x20000
27+
WOLFBOOT_SECTOR_SIZE?=0x1000
28+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x60010000
29+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x60030000
30+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x60050000
31+
WOLFBOOT_SMALL_STACK?=1
32+
33+
CFLAGS_EXTRA+=-DDCP_USE_DCACHE=0

docs/Targets.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,10 @@ section, e.g.:
14071407
If an external `.dcd_data` section is provided, the option `NXP_CUSTOM_DCD=1` must
14081408
be added to the configuration.
14091409

1410+
### Building wolfBoot for HAB (High Assurance Boot)
1411+
1412+
The `imx_rt` target supports building without a flash configuration, IVT, Boot Data and DCD. This is needed when wanting to use HAB through NXP's *Secure Provisioning Tool* to sign wolfBoot to enable secure boot. To build wolfBoot this way `TARGET_IMX_HAB` needs to be set to 1 in the configuration file (see `config/examples/imx-rt1060 _hab.config` for an example). When built with `TARGET_IMX_HAB=1` wolfBoot must be written to flash using NXP's *Secure Provisioning Tool*.
1413+
14101414
### Flashing
14111415

14121416
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.

hal/imx_rt_hab.ld

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/* Specify the memory areas */
2+
MEMORY
3+
{
4+
FLASH(rx) : ORIGIN = @ARCH_FLASH_OFFSET@ + 0x2000, LENGTH = @BOOTLOADER_PARTITION_SIZE@
5+
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 0x0001FFF0
6+
}
7+
8+
/* Define output sections */
9+
SECTIONS
10+
{
11+
.text :
12+
{
13+
_start_text = @ARCH_FLASH_OFFSET@;
14+
KEEP(*(.isr_vector))
15+
. = ALIGN(0x8);
16+
*(.text*)
17+
*(.rodata*)
18+
*(.glue_7) /* glue arm to thumb code */
19+
*(.glue_7t) /* glue thumb to arm code */
20+
*(.eh_frame)
21+
KEEP (*(.init))
22+
KEEP (*(.fini))
23+
. = ALIGN(4);
24+
_end_text = .;
25+
} > FLASH
26+
.ARM.extab :
27+
{
28+
*(.ARM.extab* .gnu.linkonce.armextab.*)
29+
} > FLASH
30+
.ARM :
31+
{
32+
__exidx_start = .;
33+
*(.ARM.exidx*)
34+
__exidx_end = .;
35+
} > FLASH
36+
_stored_data = .;
37+
38+
.data : AT (_stored_data)
39+
{
40+
_start_data = .;
41+
KEEP(*(.ramcode*))
42+
. = ALIGN(4);
43+
KEEP(*(.data*))
44+
. = ALIGN(4);
45+
_end_data = .;
46+
} > RAM
47+
48+
.bss (NOLOAD) :
49+
{
50+
_start_bss = .;
51+
__bss_start__ = .;
52+
*(.bss*)
53+
*(COMMON)
54+
. = ALIGN(4);
55+
_end_bss = .;
56+
__bss_end__ = .;
57+
_end = .;
58+
} > RAM
59+
. = ALIGN(4);
60+
}
61+
62+
END_STACK = ORIGIN(RAM) + LENGTH(RAM);

0 commit comments

Comments
 (0)