UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer nunu
Observer
4,657 Views
Registered: ‎06-08-2017

How using U-boot to start a bare metal application?

Hi, 

 

My aim is to start a bare metal application from a tftp-server.after after startting from SD-Card a u-boot.

I have also some general questions.

 

What I had done till now:

Create FSLB (with SDK), u-boot.elf, hello_world.elf (with SDK).

 

This files wrapped together to a bin-file with

Xilinx SDK
  Xilinx Tools -> Create Image:
  FSBL              (bootloader)
  u-boot.elf        (datafile)

 

The lscript.ld looks like:

  lscript.ld (FSBL)                       Base Address    Size
  ps7_ram_0_S_AXI_BASEADDR                0x00000000      0x00030000
  ps7_ram_1_S_AXI_BASEADDR                0xFFFF0000      0x0000FE00
  
  lscript.ld (Hello_World.elf)            Base Address    Size
  ps7_ddr_0_S_AXI_BASEADDR                0x100000        0x3FF00000                    
  ps7_qspi_linear_0_S_AXI_BASEADDR        0xFC000000      0x2000000
  ps7_ram_0_S_AXI_BASEADDR                0x0             0x30000
  ps7_ram_1_S_AXI_BASEADDR                0xFFFF0000      0x0000FE00

 

I have read the the u-boot has a specific memory start-addresses: In file sturctur of the u-boot i find this file

u-boot-xlnx/arch/arm/config.mk

 which contains: 

#ifndef CONFIG_STANDALONE_LOAD_ADDR
#ifneq ($(CONFIG_ARCH_OMAP2),)
CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
#else
CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
#endif
#endif

 How this addresses are involved to the addresse of the lscripts.ld?

 

Now to the behavior of the system til now.

After the u-boot starts the network environment variables are set and the connection to the tftp-server could be established.

 

 

Zynq> setenv ipaddr 192.168.xxx.101 
Zynq> setenv netmask 255.255.255.0
Zynq> setenv gatewayip 192.168.xxx.1
Zynq> serverip=192.168.xxx.100
Zynq> tftpboot 0x8000 FreeRTOS_HelloWorld.elf
Using ethernet@e000b000 device
TFTP from server 192.168.xxx.100; our IP address is 192.168.xxx.101
Filename 'FreeRTOS_HelloWorld.elf'.
Load address: 0x8000
Loading: ###############
         3 MiB/s
done
Bytes transferred = 205675 (3236b hex)

 

After using different addresses for the "go" command, the system comes to two different situations:

Zynq> go 0x8000
## Starting application at 0x00008000 ...
data abort
pc : [<000085ec>]          lr : [<3ff443c4>]
reloc pc : [<c40c65ec>]    lr : [<040023c4>]
sp : 3eb21d78  ip : c004cf82     fp : 3ff4437c
r10: 00000002  r9 : 3eb21ee8     r8 : 3ffaef30
r7 : 3eb2f820  r6 : 00008000     r5 : 00000002  r4 : c0054f82
r3 : 00008000  r2 : 3eb2f824     r1 : 3eb2f824  r0 : 00001004
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

in the second situation the Loading stucks

Zynq> tftpboot 0x80008000 FreeRTOS_HelloWorld.elf
Using ethernet@e000b000 device
TFTP from server 192.168.xxx.100; our IP address is 192.168.xxx.101
Filename 'FreeRTOS_HelloWorld.elf'.
Load address: 0x80008000
Loading: #

 

 

What i also had tried is to convert the  FreeRTOS_ZC706_HelloWorld.elf to a bin-file with:

arm-xilinx-linux-gnueabi-objcopy -O binary FreeRTOS_ZC706_HelloWorld.elf FreeRTOS_ZC706_HelloWorld.bin

mkimage -A arm -O u-boot -T standalone -C none -a 0x00108000 -e 0x00108000 -n "FreeRTOS_ZC706_HelloWorld" -d FreeRTOS_ZC706_HelloWorld.bin uFreeRTOS_ZC706_HelloWorld.bin
mkimage: Can't map uFreeRTOS_ZC706_HelloWorld.bin: Invalid argument


 

It seem to me that the memory mapping is not consistent:

At which adress the u-boot should load and start the application?

 

Thanks in advance

AN

Tags (2)
0 Kudos
18 Replies
Observer nunu
Observer
4,627 Views
Registered: ‎06-08-2017

Re: How using U-boot to start a bare metal application?

After start the u-boot and send the bdinfo cmd it appears thits output:

 

Zynq> bdinfo
arch_number = 0x00000000
boot_params = 0x00000000
DRAM bank   = 0x00000000
-> start    = 0x00000000
-> size     = 0x40000000
baudrate    = 115200 bps
TLB addr    = 0x3FFF0000
relocaddr   = 0x3FF42000
reloc off   = 0x3BF42000
irq_sp      = 0x3EB21ED0
sp start    = 0x3EB21EC0
ARM frequency = 666 MHz
DSP frequency = 0 MHz
DDR frequency = 533 MHz
Early malloc usage: 49c / 600
0 Kudos
Observer nunu
Observer
4,600 Views
Registered: ‎06-08-2017

Re: How using U-boot to start a bare metal application?

The solution is: The Xilinx SDK supply as an output an Elf-File, which the u-boot understands:

tftpboot 0x000000 FreeRTOS_ZC706_HelloWorld.elf
bootelf 0x0

Thanks 

0 Kudos
Visitor anicotra
Visitor
941 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

Hello,

I hope someone is still reading this thread.  I'm having an issue running a standalone program.  The program runs fine within the SDK (2018.3).  I produce an elf image and tftp the image to the zcu102..  

I've tried a number of different commands.  I get two results:  

1. Synchronous Abort, or

2. Starting App, and hang...

I'm using the following commands:

tftpboot 0 app.elf

bootelf 0

this, or any other adress gives me the synchronous abort message.

any help would be appreciated.

 

0 Kudos
Moderator
Moderator
921 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

You need to set the exception level of the app you are running on u-boot. You can do this in SDK. Right click on the BSP and select Board Support Package Settings. Enable the supervisor.

 

 

0 Kudos
Visitor anicotra
Visitor
917 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

i don't see a setting for supervisor in the BSPs settings.  I do see one for Hypervisor.  I tried that, but no success.

0 Kudos
Moderator
Moderator
909 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

Yes, I meant hypervisor (autocorrected)

I Tested this a while back. I thought I created a wiki for it. Let me check

0 Kudos
Moderator
Moderator
881 Views
Registered: ‎12-04-2016

Re: How using U-boot to start a bare metal application?

Hi

 

I have tried on zc702 and able to run hello world application, as can be seen below:

Load elf file instead of binary file, as bootelf expects the application to be in elf format

fatload mmc 0 0x0 hello.elf

bootelf 0x0

Note: please ignore the misaligned operation messages on console

0 Kudos
Visitor anicotra
Visitor
870 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

yes, I've tried both elf and binary executables, however, both give me the synchronous abort..

0 Kudos
Moderator
Moderator
863 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

0 Kudos
Visitor anicotra
Visitor
859 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

thanks,  i did all this but still get the abort...  only difference is the load address..  also tried loading the elf image at ZERO.  same result...

ZynqMP> tftpboot helloworld.bin
Using ethernet@ff0e0000 device
TFTP from server 192.168.111.200; our IP address is 192.168.111.254
Filename 'helloworld.bin'.
Load address: 0x10000000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...
ZynqMP> tftpboot /zcu102/helloworld.bin
Using ethernet@ff0e0000 device
TFTP from server 192.168.111.200; our IP address is 192.168.111.254
Filename '/zcu102/helloworld.bin'.
Load address: 0x10000000
Loading: ########
5.9 MiB/s
done

ZynqMP> go 0x10000000
## Starting application at 0x10000000 ...
"Synchronous Abort" handler, esr 0x02000000
ELR: 940
LR: 7fef21e4
x0 : 0000000000000001 x1 : 000000007debcf18
x2 : 000000007debcf18 x3 : 0000000010000000
x4 : 0000000000000000 x5 : 0000000000000030
x6 : 000000007ff685d8 x7 : 000000000000000f
x8 : 000000007deae9e0 x9 : 0000000000000008
x10: 000000007deae26a x11: 0000000000000001
x12: 0000000000000008 x13: 00000000ffffffff
x14: 000000007ffdcb68 x15: 000000007deae027
x16: 0000000000000940 x17: 0000000000000000
x18: 000000007deaede8 x19: 000000007debcf18
x20: 0000000000000002 x21: 0000000010000000
x22: 000000007debcf10 x23: 000000007ff9db84
x24: 0000000000000002 x25: 000000007debcf70
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000007deaeb20

Resetting CPU ...

 

0 Kudos
Moderator
Moderator
847 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

Yes, you will need to place the applciation at an offset. I have updated the wiki to reflect this:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/147882060/Executing+application+from+u-boot+on+ZCU102

0 Kudos
Moderator
Moderator
808 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

Did you get this working?

0 Kudos
Visitor anicotra
Visitor
800 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

nope..  i tried a coupole different offsets 0x06000000 and 0x10000000.  Both yelded the same behavior.  I create two output files, one elf and one binary.  The binary, when go $offset, says starting application, and just hangs (no error messages), the elf when bootelf, emits the synchronous abort message.  

0 Kudos
Moderator
Moderator
792 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

Can you try with my Hello_World.bin

0 Kudos
Visitor anicotra
Visitor
786 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

same result, 

ZynqMP> go 0x6000000
## Starting application at 0x06000000 ...

 

Nothing else, just hangs...

There's no hardware issue here either, this same board boots and runs a large vxWorks image with no issues at all..

0 Kudos
Moderator
Moderator
774 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

Can you send oyur HDF file?

0 Kudos
Visitor anicotra
Visitor
766 Views
Registered: ‎08-16-2018

Re: How using U-boot to start a bare metal application?

see attached...

0 Kudos
Moderator
Moderator
742 Views
Registered: ‎09-12-2007

Re: How using U-boot to start a bare metal application?

How did you generate the uboot? What EL settings did you use. Can you check the BIF:

the_ROM_image:
{
[fsbl_config] a53_x64
[bootloader] embedded/lib/sw_apps/zynqmp_fsbl/src/fsbl.elf
[pmufw_image] embeddedsw/lib/sw_apps/zynqmp_pmufw/src/executable.elf
[destination_device=pl] design_1_wrapper.bit
[, destination_cpu=a53-0,exception_level=el-3,trustzone] arm-trusted-firmware/build/zynqmp/release/bl31/bl31.elf
[, destination_cpu=a53-0,exception_level=el-2] u-boot-xlnx/u-boot.elf
}

 

Try with attached, and make sure you follow the steps in the wiki