Hello Heinrich

I modified the code for arm32 architecture. You may be using an ARM64 
architecture. Take a look at the architecture used.


version of U-Boot (commit in git): 
    d8a7100d658eb201fa0e955667fdff298db31945

operating system and architecture:
    5.15.0-130-generic x86_64

installed version of gcc and binutils
    gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.3)
    GNU ld (GNU Binutils for Ubuntu) 2.34
 
used defconfig
    stm32h750-art-pi_defconfig
used commands for building
    make CROSS_COMPILE=arm-none-eabi- ARCH=arm 
stm32h750-art-pi_defconfig
    make CROSS_COMPILE=arm-none-eabi- ARCH=arm menuconfig # to add 
CONFIG_API=y, CONFIG_EXAMPLES=y
    make CROSS_COMPILE=arm-none-eabi- ARCH=arm -j 12


https://developer.arm.com/documentation/den0013/d/Application-Binary-Interfaces/Procedure-Call-Standard
lists IP, SP, PC as aliases for registers R12, R13, R15.
------------------------------------------------------------

I have tried using R12, R13, R15 and the error message is as follows:
    examples/api/crt0.S:32: Error: lo register required -- `ldr 
r12,=search_hint'
    examples/api/crt0.S:34: Error: lo register required -- `str 
R13,[r12]'
    examples/api/crt0.S:40: Error: lo register required -- `ldr 
r12,=syscall_ptr'
    examples/api/crt0.S:41: Error: lo register required -- `ldr 
r15,[r12]'


As the error message suggests, you need to use a low register (lo register), 
and r12 and similar registers belong to the high register (hi register) 
category.


Best regards

LiYa
------------------ ???????? ------------------
??????:                                                                         
                                               "Heinrich Schuchardt"            
                                                                        
<heinrich.schucha...@canonical.com&gt;;
????????:&nbsp;2025??1??27??(??????) ????2:49
??????:&nbsp;"Tom Rini"<tr...@konsulko.com&gt;;
????:&nbsp;"??????"<1425075...@qq.com&gt;;"u-boot"<u-boot@lists.denx.de&gt;;"Heinrich
 Schuchardt"<heinrich.schucha...@canonical.com&gt;;
????:&nbsp;[PATCH 1/1] examples/api: improve determination of LOAD_ADDR



The current load address for the 'demo' binary does not work for
qemu_arm_defconfig.

The suitability of an address to load an ELF binary and run it does
not only depend on the architecture but also on the memory layout of
the board.

On most boards we can assume that 8 MiB of memory is available above
$loadaddr. So $loadaddr + 0x400000 should work there.

Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com&gt;
---
&nbsp;examples/api/Makefile | 23 +++--------------------
&nbsp;1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/examples/api/Makefile b/examples/api/Makefile
index 722c7e45904..be97b8015bd 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -5,26 +5,9 @@
&nbsp;# Provide symbol API_BUILD to signal that the API example is being built.
&nbsp;KBUILD_CPPFLAGS += -DAPI_BUILD
&nbsp;
-ifeq ($(ARCH),powerpc)
-LOAD_ADDR = 0x40000
-endif
-ifeq ($(ARCH),arm)
-ifdef CONFIG_64BIT
-LOAD_ADDR = 0x40400000
-else
-LOAD_ADDR = 0x1000000
-endif
-endif
-ifeq ($(ARCH),mips)
-ifdef CONFIG_64BIT
-LOAD_ADDR = 0xffffffff80200000
-else
-LOAD_ADDR = 0x80200000
-endif
-endif
-ifeq ($(ARCH),riscv)
-LOAD_ADDR = 0x84000000
-endif
+# Environment variable loadaddr is set from CONFIG_SYS_LOAD_ADDR.
+# Run the examples 4 MiB above this address.
+LOAD_ADDR:=${shell printf 0x%X $$(( $(CONFIG_SYS_LOAD_ADDR) + 0x400000 ))}
&nbsp;
&nbsp;# Resulting ELF and binary exectuables will be named demo and demo.bin
&nbsp;extra-y = demo
-- 
2.47.1

Reply via email to