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: 
Visitor daromart
Visitor
9,308 Views
Registered: ‎09-05-2012

Bare metal hello world on ZYNQ through u-boot

Hi all,

 

I have a ZYNQ7000-based board (Zedboard) running u-boot + Linux without problems, and I would like to run a simple bare metal hello world from u-boot (that is, instead of loading Linux zimage, I want to load a simple bare metal binary).

 

Following Xilinx tutorials, I managed to build a bare metal hello world (the one provided by Xilinx SDK), run it on the board through the ISE/JTAG link and get a "hello world" message succesfully.

 

However, if I try to load the binary through u-boot (using tftp and go) no message is displayed. Could somebody give me a clue?

 

Thanks a lot,

Dan

 

 

0 Kudos
8 Replies
Xilinx Employee
Xilinx Employee
9,275 Views
Registered: ‎09-10-2008

Re: Bare metal hello world on ZYNQ through u-boot

I don't know of any reason why it wouldn't work, but we don't test it at this point that I know of anyway.

Can you check the addresses where everything got linked to make sure that there's no overlap with u-boot?

You may need to go ahead and set some breakpoints to debug a bit more. I would be interesting to know if it got to main ok and it's just the print not working.

Thanks.
0 Kudos
Visitor daromart
Visitor
9,270 Views
Registered: ‎09-05-2012

Re: Bare metal hello world on ZYNQ through u-boot

Dear John,

 

Thank you very much for your answer.

 

It was just a small mistake of mine. I was trying to load the "hello.elf" file directly instead of converting it to binary form using:

 

arm-xilinx-linux-gnueabi-objdump -S hello.elf -o hello.bin

 

(and then loading it with: $tftp 0x100000 hello.bin $go 0x100000)

 

Now everything is working!!

Sorry for the inconvenience ^^U

 

Incidentally, I thought I was committing the same error in http://forums.xilinx.com/t5/EDK-and-Platform-Studio/Standalone-Hello-World-on-QEMU-ZYNQ-A9/td-p/259702 (running the hello world through Xilinx QEMU), but unfortunately it still gives me an error [qemu: fatal: Unimplemented cp15 register write (c12, c0, {0, 0})]. Perhaps that error means that QEMU support is still incomplete. But on the other hand, Linux works correctly on QEMU so it is kind of strange that the SDK hello-world application doesn't... hmm

 

Best regards and thanks a lot for your reply,

Dani

 

 

 

0 Kudos
Visitor bhargavmr
Visitor
8,729 Views
Registered: ‎05-22-2013

Re: Bare metal hello world on ZYNQ through u-boot

Hi,

 

Where can I find instructions for running Bare metal hello world in QEMU. I am using ISE 14.5 and arm-xilinx-linux-gnueabi-objdump is not supporting -o option for creating bin file.

 

Regards

Bhargav

0 Kudos
Adventurer
Adventurer
5,279 Views
Registered: ‎09-19-2014

Re: Bare metal hello world on ZYNQ through u-boot

Me too... no objdump -o. Don't keep all the secrets to yourself!

0 Kudos
Scholar rfs613
Scholar
5,270 Views
Registered: ‎05-28-2013

Re: Bare metal hello world on ZYNQ through u-boot

Recommend you use objcopy instead of objdump:

 

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

That's a capital letter "O", not zero, by the way.

0 Kudos
Adventurer
Adventurer
5,263 Views
Registered: ‎09-19-2014

Re: Bare metal hello world on ZYNQ through u-boot

Yes, thanks, I did discover objcopy actually.

 

Although, if you're working with baremetal, you may want to use arm-xilinx-eabi-objcopy instead.

 

However, it still wasn't working for me, so I wasn't happy to call it "the solution".

 

I attempted to load that binary file in U-Boot, and it reported:

Wrong Image Format for bootm command
ERROR: can't get kernel image!

 

I'm not sure if the boot actions should be slightly different if I'm not actually booting a Linux kernel, but instead a baremetal application.

 

EDIT: Oh, I see the U-Boot command before was "go" instead of "bootm", so I will try that.

0 Kudos
Scholar rfs613
Scholar
5,248 Views
Registered: ‎05-28-2013

Re: Bare metal hello world on ZYNQ through u-boot

The "go" command should work for you. It just jumps to whatever address you specify.

 

For reference: "bootm" expects an image wrapped in a header (produced by "mkimage" tool). It also does more than just jump: it massages the commandline arguments into the device tree, and sets up certain registers to pass the devicetree (and possibly ramdisk) to the Linux kernel.

0 Kudos
Highlighted
1,385 Views
Registered: ‎04-21-2017

Re: Bare metal hello world on ZYNQ through u-boot

I was successful at booting a baremetal ELF file by loading into the DDR then using the "bootelf" command. 

 

For example, if loading from an SD card, you can use:

fatload mmc 0 0x10000000 <your_file>.elf

bootelf 0x10000000

 

 

Note: This was using Petalinux 2017.4

0 Kudos