02-20-2019 10:25 AM
I have a test application that I created using Xilinx SDK 2018.1. It works fine when I create a boot image with the SDK (FSBL, BIT file, ELF app) and program it into flash. The board can boot from flash and run my application.
I've modified the linker script of my test application so it runs in memory at 0x6000000. I've debugged this and verified that's where the code is running. Now I'm trying to run it from the stock U-Boot that came with my UltraZed board.
I've tried converting the test application to a BIN file with objcopy.exe -O binary test.ELF test.bin. I wrote it into flash using the SDK utility. After booting with U-Boot, I read that test.bin file from flash into memory at 0x6000000. The readelf.exe application says the entry point is 0x6000000. But when I try go 0x6000000 then nothing happens. I've tried go with the address of main() and my program starts but then crashes. I've also tried bootelf but had no luck with that either.
In summary: Has anyone ever used U-Boot on the UltraZed and gotten it to start a bare-metal application?
02-20-2019 05:27 PM
I've used U-boot a few times but not on a Zynq. Here's a few things you could look at as I've encountered these issuesL
Manually load the bin in U-Boot and dump the first few words starting from address 0x6000000. These words should match the vector table. If they don't then the vector table is not where it should be and that would explain why it fails. And it's normal using main() as the start address that it crashes because the stack & library initialization haven't been performed.
Another one I remember having issues is if your bin was in one way or another created as a U-boot image (mkimage is sucha tool), then that type of bin has a 64 byte header prepended so the load address need to be 0x40 lower in memory.
An the last one, which is very unlikely as going into main() works, is the bin is loaded in memory area used by U-Boot.
02-25-2019 05:26 AM
Thank you for the reply. I'll have to take a closer look at the BIN file and see if I'm actually loading what I think I'm loading.
In the meantime, I found a workaround. Through a combination of using bare-metal test code, Xilinx SDK flash programming, and U-Boot, I managed to format the eMMC on the UltraZed and put a boot image on it with my bare-metal application. Now I can twiddle jumper switches to boot from either eMMC (bare-metal) or QSPI flash (U-Boot).