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: 
Participant jsara
Participant
2,576 Views
Registered: ‎08-14-2015

Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

I have tried the XApp1079 bare metal separate apps running on both CPUs on a PicoZed board.  Nothing seems to work from the XApp1079.

 

I see the new SDK (e.g. 2017.4) includes an option when debugging / running with JTag to specify a .elf file for both cores.  If I write a very simple app( eg a main() that just returns) - 2 copies - one tagged to CPU0 and the other for CPU1, debugging never gets to main and neither core runs (per a video I dont reset the system after the 2nd app is loaded and they both load at distinct dram addresses also per the video).  However if I only try to use CPU0 things work OK.

 

The original XApp1079 also required a custom FSBL to create a boot.bin that would run on both cores.

 

Any way, is there any example of something that does ANYTHING with both cores, both cores running bare metal that works?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Scholar hbucher
Scholar
4,019 Views
Registered: ‎03-22-2016

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

@jsara 

 There are several ways but the one you described is simpler. The FSBL is the same.

 

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xil_io.h"

#define CPU1STARTADR 0xfffffff0
#define sev() __asm__("sev")

int main()
{
    // Disable cache on OCM
    Xil_SetTlbAttributes(0xFFFF0000,0x14de2);
    init_platform();

    print("Hello World from CPU #0\n\r");

    // Start CPU1
    print("CPU0: writing startaddress for cpu1\n\r");
    Xil_Out32(CPU1STARTADR, 0x2000000);
    dmb(); //waits until write has finished
    print("CPU0: sending the SEV to wake up CPU1\n\r");
sev();
// application logic continues here
cleanup_platform(); return 0; }

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
8 Replies
Scholar hbucher
Scholar
2,570 Views
Registered: ‎03-22-2016

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

@jsara This question comes up often so we made a couple of videos

http://www.vitorian.com/x1/archives/587

http://www.vitorian.com/x1/archives/616

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Participant jsara
Participant
2,568 Views
Registered: ‎08-14-2015

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

More info:

 

The attached is a screen capture of the error that happens when launching the debugger with 2 applications (one for each CPU).  It says:

 

Error while launching program: no targets found with "name =~ "ARM*#1" & jtag_calbe_name =~ "Platform Cable USB II 0000153a82c501"".  available targets:

 

1 APU

  2* ARM Cortex -A9 MPCore #0 (Suspended)

3 xc7z020

 

 

Capture.JPG
0 Kudos
Participant jsara
Participant
2,547 Views
Registered: ‎08-14-2015

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

Those are helpful videos.  BUT THEY ARE WHAT I REVIEWED BEFORE TRYING AMP.  I followed exactly what they said and it did not work.

 

See my previous post for the error that appears when I try to run with both cores.

 

Any other ideas.  Does the video example only work with a Zybo board?  I am using a Pico Zed.

 

Running on CPU0 only works.  Running on CPU1 only does not work.  Running on both CPUs does not work.

0 Kudos
Scholar hbucher
Scholar
2,542 Views
Registered: ‎03-22-2016

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

@jsara Not sure what is wrong. My board shows two cores right away right away after power-on in JTAG mode. 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
zynq_cores.png
0 Kudos
Participant jsara
Participant
2,531 Views
Registered: ‎08-14-2015

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

WOW, that solved PART of the problem.  I swapped to another pico-zed card and the amp demo now works.  The first card I had must be broken.

 

Here is part two: I would like to now run these two bare metal apps by booting from flash.  Do I need a customized FSBL to get this to work?  The XAPP1079 had a way to add an AMPFSBL to the repository, but that was years ago and does not seem happy here.

 

I followed the XAPP1079 example (specifying different load values for each .elf file, but did not add their kludge terminating (3rd) dummy .elf file.

 

Any way, the boot.bin ran the CPU0 app but not the CPU1 app.  In the XAPP1079, they had CPU enable CPU1 by writing the start address somewhere and then firing an event.

 

Do I need to do something like that in this newer release of the SDK (2017.4)?

 

Is there an example of getting these 2 elfs to run from a boot.bin file so that I can actually deploy my application from flash?

 

0 Kudos
Highlighted
Scholar hbucher
Scholar
4,020 Views
Registered: ‎03-22-2016

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

@jsara 

 There are several ways but the one you described is simpler. The FSBL is the same.

 

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xil_io.h"

#define CPU1STARTADR 0xfffffff0
#define sev() __asm__("sev")

int main()
{
    // Disable cache on OCM
    Xil_SetTlbAttributes(0xFFFF0000,0x14de2);
    init_platform();

    print("Hello World from CPU #0\n\r");

    // Start CPU1
    print("CPU0: writing startaddress for cpu1\n\r");
    Xil_Out32(CPU1STARTADR, 0x2000000);
    dmb(); //waits until write has finished
    print("CPU0: sending the SEV to wake up CPU1\n\r");
sev();
// application logic continues here
cleanup_platform(); return 0; }

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
Participant jsara
Participant
2,518 Views
Registered: ‎08-14-2015

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

OK, now everything fits together and works.  It works from the SDK debugger, and also from boot.bin.

 

Would have been nice if they had a revised app note that said you did not need to follow most of the XAPP1079 example - its very obsolete.  The new versions of the SDK streamline the process.

 

I have all I need (with both videos) and your comments to put in some useful code now.

 

Thanks.

Scholar hbucher
Scholar
2,463 Views
Registered: ‎03-22-2016

Re: Are there any examples that work for very basic AMP (Use Both Zynq CPUS)

Jump to solution

@jsara I added a page to my blog

http://md.vitorian.com/boot-image-zynq.html

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.