xilinx_zync_zedboard u-boot tftp load and run issue

Chris Johns chrisj at rtems.org
Thu Jun 25 23:39:01 UTC 2020


On 26/6/20 1:25 am, Heinz Junkes wrote:
> Hallo,
> 
> i just can't get it to load and start a rtems-exe via tftp in u-boot.
> I have tried many variations now. Without success. This one should work, right?
> 
> pwd: build/b-xilinx_zynq_zedboard/arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples
> ls -l ticker*
> 
> -rwxr-xr-x  1 junkes  staff  2822792 Jun 23 09:24 ticker.exe
> 
> ticker:
> total 264
> -rw-r--r--  1 junkes  staff  82416 Jun 23 09:24 ticker-init.o
> -rw-r--r--  1 junkes  staff  48744 Jun 23 09:24 ticker-tasks.o
> 
> To create an image file for u-boot I make :
> 
> [junkes at h epics]$ more rtems-zynq-image
> #!/bin/sh
> 
> OBJCOPY_FOR_TARGET=arm-rtems5-objcopy
> OBJCOPY="$OBJCOPY_FOR_TARGET"
> 
> EXE_NAME=$1
> 
> START_ADDR=0x00104000
   ^^^^^^^^^^^^^^^^^^^^^
> ENTRY_ADDR=0x00104000
> 
> ${OBJCOPY} -R -S --strip-debug -O binary "$EXE_NAME" "$EXE_NAME.bin" || exit 1
> cat "$EXE_NAME.bin" | gzip -9 >"$EXE_NAME.gz"
> mkimage \
>    -A arm -O rtems -T kernel -a $START_ADDR -e $ENTRY_ADDR -n "EPICS" \
>    -C gzip -d "$EXE_NAME.gz" "$EXE_NAME.img”
> 
> Now when I want to start the ticker.img file on the Zync u-boot:
> 
> Zynq> set serverip 141.14.128.9
> Zynq> tftpboot ticker.img
> Using ethernet at e000b000 device
> TFTP from server 141.14.128.9; our IP address is 141.14.128.46
> Filename 'ticker.img'.
> Load address: 0x10000000
> Loading: ###
>           523.4 KiB/s
> done
> Bytes transferred = 34847 (881f hex)
> Zynq> bootm
> Wrong Image Format for bootm command
> ERROR: can't get kernel image!
> Zynq> go 0x10000000

That is the load address and the above script to convert the exe to img 
uses 0x00104000 as the start address.

I just ran ticker on my microzed (zedboard BSP) with ..

$ rtems-run --rtems-bsp=xilinx_zynq_zedboard --debug-trace=console,tftp 
`find . -name ticker.exe` 
 
                                                                   [1/1825]
RTEMS Testing - Run, 5.0.not_released
  Command Line: /opt/work/rtems/5/bin/rtems-run 
--rtems-bsp=xilinx_zynq_zedboard --debug-trace=console,tftp 
./arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples/ticker.exe
  Host: FreeBSD ruru 12.1-RELEASE-p2 FreeBSD 12.1-RELEASE-p2 GENERIC amd64
  Python: 3.7.6 (default, Mar  3 2020, 01:18:14) [Clang 8.0.1 
(tags/RELEASE_801/final 366581)]
Host: FreeBSD-12.1-RELEASE-p2-amd64-64bit-ELF (FreeBSD ruru 
12.1-RELEASE-p2 FreeBSD 12.1-RELEASE-p2 GENERIC amd64 amd64)
=> target exe filter: find:\.exe subst:.exe.img -> 
./arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples/ticker.exe.img
=> target on: cs-pw-ctl 1 toggle-on 2 4
=> target pretest: rtems-zynq-mkimg 
./arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples/ticker.exe
=>  Image: ./arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples/ticker.exe
=>  Image Name:   RTEMS
=>  Created:      Fri Jun 26 09:24:39 2020
=>  Image Type:   ARM RTEMS Kernel Image (gzip compressed)
=>  Data Size:    34851 Bytes = 34.03 KiB = 0.03 MiB
=>  Load Address: 00104000
=>  Entry Point:  00104000
=> tftp: exe: 
./arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples/ticker.exe.img
In:    serial at e0001000
Out:   serial at e0001000
Err:   serial at e0001000
Model: Zynq Zed Development Board
Board: Xilinx Zynq
Net:   ZYNQ GEM: e000b000, phyaddr 0, interface rgmii-id

Warning: ethernet at e000b000 (eth0) using random MAC address - 
6e:3a:1c:22:aa:5f
eth0: ethernet at e000b000
reading uEnv.txt
165 bytes read in 11 ms (14.6 KiB/s)
Importing environment from mmc ...
Checking if uenvcmd is set ...
Running uenvcmd ...
Booting RTEMS from net
=> tftp: 
./arm-rtems5/c/xilinx_zynq_zedboard/testsuites/samples/ticker.exe.img
ethernet at e000b000 Waiting for PHY auto negotiation to complete..... done
BOOTP broadcast 1
DHCP client bound to address 10.10.5.132 (1 ms)
Using ethernet at e000b000 device
TFTP from server 10.10.5.2; our IP address is 10.10.5.132
Filename 'zed/rtems.img'.
Load address: 0x2000000
Loading: ###
          1.3 MiB/s
done
Bytes transferred = 34915 (8863 hex)
## Booting kernel from Legacy Image at 02000000 ...
    Image Name:   RTEMS
    Image Type:   ARM RTEMS Kernel Image (gzip compressed)
    Data Size:    34851 Bytes = 34 KiB
    Load Address: 00104000
    Entry Point:  00104000
    Verifying Checksum ... OK
    Uncompressing Kernel Image ... OK
## Transferring control to RTEMS (at address 00104000) ...


=> test start: CLOCK TICK
*** BEGIN OF TEST CLOCK TICK ***
*** TEST VERSION: 5.0.0.084ea83a9be60ea14a9e59bdcd7eda086f9b8725
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD: RTEMS_POSIX_API
*** TEST TOOLS: 7.5.0 20191114 (RTEMS 5, RSB 5 (8223d3b7c02e), Newlib 
7947581)
TA1  - rtems_clock_get_tod - 09:00:00   12/31/1988
TA2  - rtems_clock_get_tod - 09:00:00   12/31/1988

The tester config is:

#
# Zedboard with U-Boot on an SD card.
#
[xilinx_zynq_zedboard]
tftp_port              = 9101
bsp_tty_dev            = cs-ser-2:30003
target_pretest_command = rtems-zynq-mkimg @EXE@
target_exe_filter      = /\.exe/.exe.img/
target_on_command      = cs-pw-ctl 1 toggle-on 2 4
target_off_command     = cs-pw-ctl 1 off 2
target_reset_command   = cs-pw-ctl 1 toggle-on 2 3

The uboot uEnv.txt is:

bootfile=zed/rtems.img
loadaddr=0x02000000
uenvcmd=echo Booting RTEMS Zed from net; set autoload no; dhcp; set 
serverip 10.10.5.2; tftpboot zed/rtems.img; bootm; reset;

My rtems-zynq-mkimg is basically the same. You could try '-O Linux' as 
Jan says but I do not think it matters for this BSP as it does not have 
any FDT support. It does matter on some BSPs.

FYI I am moving away from the uboot supplied `mkimage` to `mkimage.py` 
by Craig Barker. Amar has added it to rtems-tools:

https://git.rtems.org/rtems-tools/tree/misc/tools/mkimage.py

FreeBSD, MacOS and Windows do not have a `mkimage` package and this 
works nicely.

Chris


More information about the users mailing list