[PATCH] examples: fix building on arm32
黄利亚
1425075683 at qq.com
Mon Jan 27 11:11:31 CET 2025
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.schuchardt at canonical.com>;
发送时间: 2025年1月27日(星期一) 下午2:49
收件人: "Tom Rini"<trini at konsulko.com>;
抄送: "黄利亚"<1425075683 at qq.com>;"u-boot"<u-boot at lists.denx.de>;"Heinrich Schuchardt"<heinrich.schuchardt at canonical.com>;
主题: [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.schuchardt at canonical.com>
---
examples/api/Makefile | 23 +++--------------------
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 @@
# Provide symbol API_BUILD to signal that the API example is being built.
KBUILD_CPPFLAGS += -DAPI_BUILD
-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 ))}
# Resulting ELF and binary exectuables will be named demo and demo.bin
extra-y = demo
--
2.47.1
More information about the U-Boot
mailing list