06-21-2017 08:42 PM
Hello Xilinx community,
I am trying to run multiple application files (.elf files) on a ZC706 board (bare-metal without linux/u-boot) using Xilinx SDK 2016.3 which is to be booted from an SD card and this is what the boot.bin consists of:
in this order.
For simplicity, both the applications are of lighting up one LED each. The problem that I am facing is that only the first LED turns on i.e., only application1 is running. I assumed that it was because the memory locations that the files were using in the DDR memory were same, so i fiddled with the linker scripts (.ld files) of both the applications and I made sure that none of the memory locations were overlapping but the problem persists.
Is it not possible to run multiple .elf files on a baremetal ZC706 or am I doing something wrong?
I want to run both the applications simultaneously in one case and consecutively(one after another) in another.
TL;DR: Only one application file is being run from a boot.bin which contains more than one .elf file on a Zynq ZC706 board.
06-21-2017 10:35 PM
Yes, of course it is possible to run all them concurrently. I have done this several times.
You can save your time and instead of burning the SD, in the SDK just go to Run Configurations... and in the Application tab, select one application for each core. Of course you would need to create 4 different applications (and BSP) for each core in separate. It is a pain but that's what it takes in standalone mode. Try this method and only then run on the SD.
In the picture below I have a ZCU102 that has 4 Cortex A53 cores plus 2 Cortex A9 (same as in the ZC706) plus one RPU. You could program all them at the same time.
You could possibly automate this with TCL though. But it's just 4 cores...
06-21-2017 11:00 PM
You will likely not be able to run applications concurrently (I assume you are thinking one app on each core) unless special handling is added for that.
If none of the .elf text / data / bss memory overlap, running them sequentially should work
But you'll need to make sure your application does not assume uninitialized variables (bss) to be zero nor can you use zero preinitialized global static local variables, and that will be an issue with many things "hidden" in the "C" library.
Did you include a way to run the 2nd application once the 1st one is done... and so on?
06-28-2017 02:01 AM
06-28-2017 03:55 AM
An easy way is to use the atexit() "C" function.
At the beginning of your first elf, call atexit() with the argument, a function pointer, set to the address of the base of the vector table of the next elf to execute.
That way, when the first elf program terminates, it will call the next program and start it fresh with a boot.
06-28-2017 09:07 AM
@ramanmohan Not sure sure what you mean "start executing".
All the CPUs will start executing main() at the same time - perhaps not exactly the same time. I think what you mean is how to synchronize all the CPUs in a way that they do meaningful work together.
Xilinx standalone supports OpenAMP and inside it there is libmetal that has many features you will find useful for this purpose. But they are pretty much #define wrappers around the builtins the GCC compiler already provides.
This is a nice overview:
06-28-2017 04:49 PM
If your ultimate goal is to have each of the 2 elf to run in parallel on individual cores, we have a freeware to do that.
Go in the freeware section at
and download uAbassi (not mAbassi).
In that package, there is a "bare-metal" demo with 2 simple pieces of code running in parallel.
The differences with that, and doing a packaging of 2 elf are the following:
- One elf only.
- Instead of 2 main() and 2 build, it's one build.
- you'll have to replace your 2 individual main() with App_0(), and App_1().
Once you get your head around the way to use a SMP RTOS, you will most likely end up having lots of fun running things sequentially and in parallel at will.
06-29-2017 03:46 AM
My problem in detail is as follows:
I have an.elf file to perform Digital PreDistortion (DPD) provided by Xilinx. I also have the .bit file for DPD. I w ant to combine the DPD application along with a user-application ( i.e., blinking an on-board LED).
So, I have:
1. Xilinx provided DPD.elf
2. My own custom application led.c ---> led.elf.
I want to run both these applications ( led after DPD ) on a single processor one after another and I want to loop them. (LED after DPD and again LED after DPD and so on)
The only problem is that I do not have the .c source code for DPD. As I have only the .elf file, I cannot make changes to it.
How do I go about this? Any suggestion will be highly appreciated.
06-29-2017 07:36 AM
You could possibly have processor #0 to loop:
- use remoteproc to run the DPD
- blink the LED
It is not for the faint of heart.
Check the "Simplest bare metal" example here:
06-29-2017 09:11 AM
Another way, if the elf has the debug symbols included, would be to try this:
- use objdump to find the address of the _exit symbol
- In your LED application, which will have to run first, write to that address the instruction to branch back to the base of the vector table of the LED application and at the end of the LED application, use the atexit() to go into the 2nd elf.
What has to be written at the address of _exit would be either b offset or ldr pc, =Address.
The ldr PC, =Address requires 1 instruction + 1 data word and _exit is quite likely a single instruction (branch to itself)
If that's the case, you'll have to be careful where to put the 1 data word to not corrupt \code / data.
You could also try to do the same with exit (not _exit), but if exit() is not called, that won't work.
Yes it's a bit tricky.
06-29-2017 09:53 PM
@ericv That's some very fun code injection there, Mr Mitnick. Perhaps the easiest solution.
Can't the FSBL be customized to achieve this?
04-13-2018 04:22 AM - edited 04-16-2018 01:04 AM
I tried the bare-metal approach to run two apps simultaneously (found your video on youtube as well, which i actually followed : https://www.youtube.com/watch?v=n0hbwp36hBs ) ..and it worked...but now i want to try out loading Linux in two different processor cores say A53_0 and A53_1 and then run two different apps from there .. i am already running and testing my apps via single core .. using SD card boot ..and want to load that image in two different cores now. is it possible ?
if so could you please share the detailed / setp-by step procedure on how to do it ?
05-25-2018 04:07 AM
I had gone through the problem as well as solution. I am facing a problem with memory as you mentioned in your explanation. I would like to know how you used linker script to solve problem. Kindly help me code / all possible documents regarding this. I am working ZCU102 and SDK2017.2 . If you don't have linker script details of ZCU102 give me a solution based on what board you have worked .
Thanks and Regards,