From ae8d35f6b4b0808346064975f1271cbf88b94afc Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 18 Sep 2023 14:08:36 -0700 Subject: [PATCH] Fixes for DTS. --- config/examples/nxp-t2080.config | 8 ++++++-- hal/nxp_t1024.c | 2 +- hal/nxp_t2080.c | 2 +- hal/zynq.c | 2 +- src/update_ram.c | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/examples/nxp-t2080.config b/config/examples/nxp-t2080.config index 10d04d34b..faad9555a 100644 --- a/config/examples/nxp-t2080.config +++ b/config/examples/nxp-t2080.config @@ -31,6 +31,10 @@ BOOTLOADER_PARTITION_SIZE=0x10000 WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEFFD0000 WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEFFB0000 + +# Location of temporary sector used during updates WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xEFFA0000 -WOLFBOOT_LOAD_ADDRESS?=0x200000 -WOLFBOOT_LOAD_DTS_ADDRESS?=0x40000 + +# DTS (Device Tree) +WOLFBOOT_DTS_BOOT_ADDRESS?=0xE8040000 +WOLFBOOT_LOAD_DTS_ADDRESS?=0x200000 diff --git a/hal/nxp_t1024.c b/hal/nxp_t1024.c index c8204ed2b..0e63bdb68 100644 --- a/hal/nxp_t1024.c +++ b/hal/nxp_t1024.c @@ -1188,7 +1188,7 @@ void hal_prepare_boot(void) #ifdef MMU void* hal_get_dts_address(void) { - return (void*)WOLFBOOT_LOAD_DTS_ADDRESS; + return (void*)WOLFBOOT_DTS_BOOT_ADDRESS; } #endif diff --git a/hal/nxp_t2080.c b/hal/nxp_t2080.c index f883e8c11..04daac938 100644 --- a/hal/nxp_t2080.c +++ b/hal/nxp_t2080.c @@ -586,6 +586,6 @@ void hal_prepare_boot(void) #ifdef MMU void* hal_get_dts_address(void) { - return (void*)WOLFBOOT_LOAD_DTS_ADDRESS; + return (void*)WOLFBOOT_DTS_BOOT_ADDRESS; } #endif diff --git a/hal/zynq.c b/hal/zynq.c index 665a3cf24..ea332393b 100644 --- a/hal/zynq.c +++ b/hal/zynq.c @@ -1330,7 +1330,7 @@ void RAMFUNCTION ext_flash_unlock(void) #ifdef MMU void* hal_get_dts_address(void) { - return (void*)WOLFBOOT_LOAD_DTS_ADDRESS; + return (void*)WOLFBOOT_DTS_BOOT_ADDRESS; } #endif diff --git a/src/update_ram.c b/src/update_ram.c index d4ae22026..80bd9c87c 100644 --- a/src/update_ram.c +++ b/src/update_ram.c @@ -261,7 +261,8 @@ void RAMFUNCTION wolfBoot_start(void) dts_size = (uint32_t)ret; wolfBoot_printf("Loading DTB (size %d) to RAM at %08lx\n", dts_size, dts_addr); - memcpy(dts_addr, (void*)WOLFBOOT_DTS_BOOT_ADDRESS, dts_size); + memcpy((void*)WOLFBOOT_LOAD_DTS_ADDRESS, dts_addr, dts_size); + dts_addr = (uint8_t*)WOLFBOOT_LOAD_DTS_ADDRESS; } } }