OP-TEE is placed right below the end of memory, so the scratch space has to go below it. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/include/asm/barebox-arm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index 0cf4549cd7..711ccd2510 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -75,7 +75,7 @@ void *barebox_arm_boot_dtb(void); static inline const void *arm_mem_scratch_get(void) { - return (const void *)__arm_mem_scratch(arm_mem_endmem_get()); + return (const void *)__arm_mem_scratch(arm_mem_endmem_get() - OPTEE_SIZE); } #define arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K - OPTEE_SIZE) -- 2.39.2