<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>I'll start by saying that AArch64 RTEMS on QEMU (for which there
is a ZynqMP hardware model) works great and is what the current
BSP targets.<br>
</p>
<p>The current status of AArch64 RTEMS on real hardware is not as
simple as I'd like, but it's possible and I've run the
uniprocessor testsuite tests on an an Avnet dev board (ZU3EG). The
complications are caused by lack of support for the MMU on AArch64
leading to all memory requiring strict alignment for accesses. Due
to this, the toolchain needs to be recompiled with additional
flags: <br>
</p>
<p> --targetcflags="-DPREFER_SIZE_OVER_SPEED -mstrict-align"
--targetcxxflags="-mstrict-align"</p>
<p>To deal with an EL2 start, optstarthyp.yml needs to be added to
the BSP definition and -mstrict-align needs to be added to
abi.yml.</p>
<p>Unfortunately, these changes are unfit for inclusion in RTEMS and
my next step is to work on the MMU driver to avoid these alignment
problems.</p>
<p><br>
</p>
<p>Kinsey<br>
</p>
<div class="moz-cite-prefix">On 4/19/2021 00:19, Richi Dubey wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAAQOZwxp1Khg_OS3wXCO9bymX35ecaGuiD97+ui2rww8R-B--Q@mail.gmail.com">
<div dir="ltr">Thanks!<br>
<div><br>
</div>
<div>Can I get rtems to build images as an AArch64 code, so that
I don't have to change anything for uboot?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Apr 15, 2021 at 12:01
AM Kinsey Moore <<a href="mailto:kinsey.moore@oarcorp.com" moz-do-not-send="true">kinsey.moore@oarcorp.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>That exception dump doesn't say a lot other than the ELR
pointing at the very first instruction in your image, so I
suspect that u-boot is trying to start your image as
AArch64 code instead of AArch32/ARMv7 code. The ESR just
specifies that it was a 32-bit instruction that blew up
(both AArch32 and AArch64 use 32-bit instructions) instead
of a 16-bit instruction.</p>
<p>The u-boot images that come with the PetaLinux
distributions default to starting code as AArch64 at EL2,
so you either need to figure out how to make u-boot
default to AArch32/ARMv7 at EL1 or build a new u-boot that
can do what you need and then package it into BOOT.bin
using bootgen (the code is available on github). From what
I remember, the ARMv7 BSP for ZynqMP mentions booting over
JTAG.<br>
</p>
<p><br>
</p>
<p>Kinsey<br>
</p>
<div>On 4/14/2021 13:18, Richi Dubey wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hi Jan, Kinsey,
<div><br>
</div>
<div>Thanks for your quick responses.</div>
<div><br>
</div>
<div>I rebuilt the .img file with -O rtems option,
and I think it is the standard uboot available
from PetaLinux. It still fails, but I think it is
related to RTEMS now: </div>
<div>--------------------------------------------<br>
</div>
<div>Welcome to minicom 2.7.1<br>
<br>
OPTIONS: I18n <br>
Compiled on May 6 2018, 08:02:47.Welcome to
minicom 2.7.1<br>
<br>
OPTIONS: I18n <br>
Compiled on May 6 2018, 08:02:47.<br>
Port /dev/ttyUSB32, 18:14:14<br>
<br>
Press CTRL-K Z for help on special keys<br>
<br>
Xilinx Zynq MP First Stage Boot Loader <br>
Release 2020.1 Jan 1 2021 - 07:33:16<br>
NOTICE: ATF running on XCZU7EV/silicon v4/RTL5.1
at 0xfffea000<br>
NOTICE: BL31: Secure code at 0x60000000<br>
NOTICE: BL31: Non secure code at 0x10080000<br>
NOTICE: BL31:
v2.0(release):xilinx-v2019.1-12-g713dace9<br>
NOTICE: BL31: Built : 08:36:10, Sep 1 2020<br>
PMUFW: v1.1<br>
<br>
<br>
U-Boot 2019.01 (Sep 01 2020 - 08:36:54 +0000)<br>
<br>
Model: ZynqMP ZCU106 RevA<br>
Board: Xilinx ZynqMP<br>
DRAM: 4 GiB
<br>
EL Level: EL2
<br>
Chip ID: zu7ev
<br>
MMC: mmc@ff170000: 0
<br>
Loading Environment from SPI Flash... SF: Detected
n25q512a with page size 512 B<br>
ytes, erase size 128 KiB, total 128 MiB
<br>
OK
<br>
In: serial@ff000000
<br>
Out: serial@ff000000
<br>
Err: serial@ff000000
<br>
Model: ZynqMP ZCU106 RevA
<br>
Board: Xilinx ZynqMP
<br>
Net: ZYNQ GEM: ff0e0000, phyaddr c, interface
rgmii-id <br>
<br>
Warning: ethernet@ff0e0000 MAC addresses don't
match: <br>
Address in ROM is 00:0a:35:05:2f:ec
<br>
Address in environment is 00:0a:35:00:22:19
<br>
eth0: ethernet@ff0e0000
<br>
Hit any key to stop autoboot: 0
<br>
ZynqMP> tftpboot 0x3000000 rdubey/sp01new.img
<br>
Using ethernet@ff0e0000 device
<br>
TFTP from server 172.19.0.3; our IP address is
172.19.2.40 <br>
Filename 'rdubey/sp01new.img'.
<br>
Load address: 0x3000000
<br>
Loading: ####
<br>
1.7 MiB/s
<br>
done
<br>
Bytes transferred = 50978 (c722 hex)
<br>
ZynqMP> bootm 0x3000000 ; reset
<br>
## Booting kernel from Legacy Image at 03000000
... <br>
Image Name: RTEMS
<br>
Image Type: ARM RTEMS Kernel Image (gzip
compressed) <br>
Data Size: 50914 Bytes = 49.7 KiB
<br>
Load Address: 00300000
<br>
Entry Point: 00300000
<br>
Verifying Checksum ... OK
<br>
Uncompressing Kernel Image ... OK
<br>
## Transferring control to RTEMS (at address
00300000) ... <br>
"Synchronous Abort" handler, esr 0x02000000
<br>
elr: ffffffff90593000 lr : 0000000010097a90
(reloc) <br>
elr: 0000000000300000 lr : 000000007fe04a90
<br>
x0 : 000000007ddacf58 x1 : 0000000000000000
<br>
x2 : 0000000000006802 x3 : 0000000000000020
<br>
x4 : 0000000000000000 x5 : 0000000000000030
<br>
x6 : 000000007fe7e9cd x7 : 000000000000000f
<br>
x8 : 0000000000000038 x9 : 0000000000000008
<br>
x10: 000000007ddbd530 x11: 00000000ffffffd0
<br>
x12: 0000000000000000 x13: 0000000000000200
<br>
x14: 0000000000000001 x15: 0000000000000008
<br>
x16: 000000000000003f x17: 000000000000009a
<br>
x18: 000000007ddacde8 x19: 0000000000300000
<br>
x20: 000000007fead720 x21: 000000007fe04a20
<br>
x22: 000000000000071f x23: 000000007fe04a20
<br>
x24: 0000000000000001 x25: 000000007ddbd2f8
<br>
x26: 000000007fe9ac18 x27: 0000000000300000
<br>
x28: 0000000003000040 x29: 000000007dda07c0
<br>
<br>
Resetting CPU ...
<br>
<br>
### ERROR ### Please RESET the board ###
<br>
<br>
<div>--------------------------------------------</div>
<div>Can this be about the load address being
at 0x00300000 and the .img being fetched
at 0x3000000?</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Apr 14, 2021
at 7:08 PM <<a href="mailto:Jan.Sommer@dlr.de" target="_blank" moz-do-not-send="true">Jan.Sommer@dlr.de</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div lang="DE">
<div>
<p class="MsoNormal"><span lang="EN-US">Hi Richi,</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">In your
log it says:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Image
Type: ARM Linux Kernel Image (gzip
compressed)</span><span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">At least
for our zedboard devices we use the following
main options for mkimage.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">mkimage
-A arm -O rtems -T kernel </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Which
yields for me:</span></p>
<p class="MsoNormal"><span lang="EN-US">Image
Type: ARM RTEMS Kernel Image (gzip
compressed)</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">IIRC the
difference between -O rtems and -O linux is
subtle, but maybe that helps.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Best
regards,</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> Jan</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt
solid blue;padding:0cm 0cm 0cm 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt
solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>From:</b> devel <<a href="mailto:devel-bounces@rtems.org" target="_blank" moz-do-not-send="true">devel-bounces@rtems.org</a>>
<b>On Behalf Of </b>Richi Dubey<br>
<b>Sent:</b> Wednesday, April 14, 2021
3:22 PM<br>
<b>To:</b> Kinsey Moore <<a href="mailto:kinsey.moore@oarcorp.com" target="_blank" moz-do-not-send="true">kinsey.moore@oarcorp.com</a>><br>
<b>Cc:</b> <a href="mailto:rtems-devel@rtems.org" target="_blank" moz-do-not-send="true">rtems-devel@rtems.org</a>
<<a href="mailto:devel@rtems.org" target="_blank" moz-do-not-send="true">devel@rtems.org</a>><br>
<b>Subject:</b> Re: Booting a rtems exe on
Zynq UltraScale+ MPSoC ZCU106 board</p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">Trying to boot directly
from the .img file also fails:</p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">ZynqMP> tftpboot
0x3000000 rdubey/sp01.img
<br>
Using ethernet@ff0e0000 device
<br>
TFTP from server 172.19.0.3; our IP
address is 172.19.2.40
<br>
Filename 'rdubey/sp01.img'.
<br>
Load address: 0x3000000
<br>
Loading: ####
<br>
6.1 MiB/s
<br>
done
<br>
Bytes transferred = 50978 (c722 hex)
<br>
ZynqMP> bootm 0x3000000 ; reset
<br>
## Booting kernel from Legacy Image at
03000000 ... <br>
Image Name: RTEMS
<br>
Image Type: ARM Linux Kernel Image
(gzip compressed) <br>
Data Size: 50914 Bytes = 49.7 KiB
<br>
Load Address: 00300000
<br>
Entry Point: 00300000
<br>
Verifying Checksum ... OK
<br>
Uncompressing Kernel Image ... OK
<br>
FDT and ATAGS support not compiled in -
hanging <br>
### ERROR ### Please RESET the board ###
</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">What can I do now?</p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<div>
<p class="MsoNormal">On Wed, Apr 14, 2021 at
6:11 PM Kinsey Moore <<a href="mailto:kinsey.moore@oarcorp.com" target="_blank" moz-do-not-send="true">kinsey.moore@oarcorp.com</a>>
wrote:</p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt
solid rgb(204,204,204);padding:0cm 0cm 0cm
6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">If
you’re only running RTEMS, you
should be able to drop the FDT
commands since that what appears to
be causing the problem and I don’t
think that the arm/xilinx_zynqmp BSP
uses it at all.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Kinsey</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt
solid rgb(225,225,225);padding:3pt 0cm
0cm">
<p class="MsoNormal" style="margin-left:36pt"> <b><span lang="EN-US">From:</span></b><span lang="EN-US"> Richi Dubey <<a href="mailto:richidubey@gmail.com" target="_blank" moz-do-not-send="true">richidubey@gmail.com</a>>
<br>
<b>Sent:</b> Wednesday, April 14,
2021 01:01<br>
<b>To:</b> Kinsey Moore <<a href="mailto:kinsey.moore@oarcorp.com" target="_blank" moz-do-not-send="true">kinsey.moore@oarcorp.com</a>>;
<a href="mailto:rtems-devel@rtems.org" target="_blank" moz-do-not-send="true">rtems-devel@rtems.org</a>
<<a href="mailto:devel@rtems.org" target="_blank" moz-do-not-send="true">devel@rtems.org</a>><br>
<b>Subject:</b> Booting a rtems
exe on Zynq UltraScale+ MPSoC
ZCU106 board</span></p>
</div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">Hi,</span></p>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">I followed the <a href="https://docs.rtems.org/branches/master/user/bsps/bsps-arm.html#xilinx-zynqmp" target="_blank" moz-do-not-send="true">
8.2.23 docs</a> to build rtems
for the xilinx_zynqmp_ultra96
bsp since it was the only bsp
corresponding to xilinx-zynqmp
in the rtems-bsp. </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">Then I followed the
boot via Uboot section <a href="https://docs.rtems.org/branches/master/user/bsps/bsps-arm.html#boot-via-u-boot" target="_blank" moz-do-not-send="true">
8.2.1.1 on docs</a>, but the
uboot on zcu106 does not have a
run loadfdt command, and its
alternative is fdt addr
[address]. But something is
wrong, I cannot run the sp01.img
file:</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">With fdt:</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">------------------------------</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">ZynqMP> tftpboot
0x3000000 rdubey/sp01.img
</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">Using
ethernet@ff0e0000 device
<br>
TFTP from server 172.19.0.3; our
IP address is 172.19.2.40
<br>
Filename 'rdubey/sp01.img'.
<br>
Load address: 0x3000000
<br>
Loading: ####
<br>
6.9 MiB/s
<br>
done
<br>
Bytes transferred = 50978 (c722
hex)
<br>
ZynqMP> fdt addr 0x2A00000
<br>
ZynqMP> bootm 0x3000000 -
0x2A00000 ; reset
<br>
## Booting kernel from Legacy
Image at 03000000 ...
<br>
Image Name: RTEMS
<br>
Image Type: ARM Linux
Kernel Image (gzip compressed)
<br>
Data Size: 50914 Bytes =
49.7 KiB
<br>
Load Address: 00300000
<br>
Entry Point: 00300000
<br>
Verifying Checksum ... OK
<br>
## Flattened Device Tree blob at
02a00000
<br>
Booting using the fdt blob at
0x2a00000
<br>
Uncompressing Kernel Image
... OK
<br>
Loading Device Tree to
0000000007ff1000, end
0000000007fff257 ... OK
<br>
fdt_find_or_add_subnode: chosen:
FDT_ERR_BADSTRUCTURE
<br>
ERROR: /chosen node create
failed
<br>
- must RESET the board to
recover.
<br>
<br>
FDT creation failed!
hanging...### ERROR ### Please
RESET the board ### </span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">------------------------------</span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">With loading the
system.dtb that I generally use
for loading yocto linux images:</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">---------------------</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">ZynqMP> tftpboot
0x2A00000 rdubey/system.dtb
<br>
Using ethernet@ff0e0000 device
<br>
TFTP from server 172.19.0.3; our
IP address is 172.19.253.142
<br>
Filename 'rdubey/system.dtb'.
<br>
Load address: 0x2a00000
<br>
Loading: ###T #
<br>
8.8 KiB/s
<br>
done
<br>
Bytes transferred = 45656 (b258
hex)
<br>
ZynqMP> tftpboot 0x3000000
rdubey/sp01.img
<br>
Using ethernet@ff0e0000 device
<br>
TFTP from server 172.19.0.3; our
IP address is 172.19.253.142
<br>
Filename 'rdubey/sp01.img'.
<br>
Load address: 0x3000000
<br>
Loading: ####
<br>
1.7 MiB/s
<br>
done
<br>
Bytes transferred = 50978 (c722
hex)
<br>
ZynqMP> bootm 0x3000000 -
0x2A00000 ; reset
<br>
## Booting kernel from Legacy
Image at 03000000 ...
<br>
Image Name: RTEMS
<br>
Image Type: ARM Linux
Kernel Image (gzip compressed)
<br>
Data Size: 50914 Bytes =
49.7 KiB
<br>
Load Address: 00300000
<br>
Entry Point: 00300000
<br>
Verifying Checksum ... OK
<br>
## Flattened Device Tree blob at
02a00000
<br>
Booting using the fdt blob at
0x2a00000
<br>
Uncompressing Kernel Image
... OK
<br>
Loading Device Tree to
0000000007ff1000, end
0000000007fff257 ... OK
<br>
<br>
Starting kernel ...
<br>
<br>
"Synchronous Abort" handler, esr
0x02000000
<br>
elr: ffffffff90593000 lr :
0000000010081868 (reloc)
<br>
elr: 0000000000300000 lr :
000000007fdee868
<br>
x0 : 0000000000000000 x1 :
0000000000000000
<br>
x2 : 0000000007ff1000 x3 :
0000000000000000
<br>
x4 : 0000000000300000 x5 :
0000000000000000
<br>
x6 : 0000000000000008 x7 :
0000000000000000
<br>
x8 : 000000007dda0650 x9 :
0000000001008000
<br>
x10: 000000000a200023 x11:
0000000000000002
<br>
x12: 0000000000000002 x13:
00000000000096f4
<br>
x14: 000000007dda06ac x15:
000000007fdee224
<br>
x16: 0000000000000002 x17:
0000000007fff258
<br>
x18: 000000007ddacde8 x19:
000000007fead720
<br>
x20: 0000000000000000 x21:
0000000000000400
<br>
x22: 000000000000071f x23:
000000007fdeedb8
<br>
x24: 0000000000000003 x25:
000000007ddbd378
<br>
x26: 000000007fe9ac18 x27:
0000000000300000
<br>
x28: 0000000003000040 x29:
000000007dda0790
<br>
<br>
Resetting CPU ...
<br>
<br>
### ERROR ### Please RESET the
board ### </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">---------------------</span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"> <span lang="EN-US">What might be going
wrong? zcu106 is a multi
processor board, so do I need to
do something special to run the
sp01 test? I have not tested any
other .exe (or .img) so far.</span></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</body>
</html>