cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hokim
Scholar
Scholar
2,326 Views
Registered: ‎10-21-2015

Vitis platform for ultra96v2 is not working

Jump to solution

Hi

I built platform for ultra96v2

For that, I started with zcu104 at https://github.com/Xilinx/XRT/tree/master/src/platform/zcu104_base

It worked well. I tested it with  https://github.com/Xilinx/Vitis_Accel_Examples/tree/master/hello_world

root@zcu104_base:/media/card$ ./init.sh 
.
Found Platform
Platform Name: Xilinx
INFO: Reading ./build_dir.hw.zcu104_base/vadd.xclbin
Loading: './build_dir.hw.zcu104_base/vadd.xclbin'
Trying to program device[0]: zcu104_base
Device[0]: program successful!
TEST PASSED

Then, I did minimum modification for ultra96v2

The scripts are attatched

There is no problem buiding platform.

After building hello_world, vivado project is same as zcu104_base.

The following is device tree

  amba {
        zyxclmm_drm {
            compatible = "xlnx,zocl";
            status = "okay";
            interrupt-parent = <0x20>;
            interrupts = <0x0 0x4 0x1 0x4 0x2 0x4 0x3 0x4 0x4 0x4 0x5 0x4 0x6 0x4 0x7 0x4 0x8 0x4 0x9 0x4 0xa 0x4 0xb 0x4 0xc 0x4 0xd 0x4 0xe 0x4 0xf 0x4 0x10 0x4 0x11 0x4 0x12 0x4 0x13 0x4 0x14 0x4 0x15 0x4 0x16 0x4 0x17 0x4 0x18 0x4 0x19 0x4 0x1a 0x4 0x1b 0x4 0x1c 0x4 0x1d 0x4 0x1e 0x4 0x1f 0x4>;
        };
  };
   amba_pl@0 {
        #address-cells = <0x2>;
        #size-cells = <0x2>;
        compatible = "simple-bus";
        ranges;

        interrupt-controller@80020000 {
            #interrupt-cells = <0x2>;
            clock-names = "s_axi_aclk";
            clocks = <0x21>;
            compatible = "xlnx,axi-intc-4.1", "xlnx,xps-intc-1.00.a";
            interrupt-controller;
            reg = <0x0 0x80020000 0x0 0x1000>;
            xlnx,kind-of-intr = <0x0>;
            xlnx,num-intr-inputs = <0x20>;
            interrupt-parent = <0x4>;
            interrupts = <0x0 0x59 0x4>;
            phandle = <0x20>;
        };

        misc_clk_0 {
            #clock-cells = <0x0>;
            clock-frequency = <0x47868c0>;
            compatible = "fixed-clock";
            phandle = <0x21>;
        };

        PERIPHERAL@ff380000 {
            compatible = "xlnx,PERIPHERAL-1.0";
            reg = <0x0 0xff380000 0x0 0x80000>;
        };

        PERIPHERAL@ff990000 {
            compatible = "xlnx,PERIPHERAL-1.0";
            reg = <0x0 0xff990000 0x0 0x10000>;
        };
    };

But hello_world project is stucked at kernel running 

root@ultra96v2_base:/media/card$ ./init.sh 
.
Found Platform
Platform Name: Xilinx
INFO: Reading ./build_dir.hw.ultra96v2_base/vadd.xclbin
Loading: './build_dir.hw.ultra96v2_base/vadd.xclbin'
Trying to program device[0]: ultra96v2_base
Device[0]: program successful!

This is kernel message

root@ultra96v2_base:~$ [   41.561829] [drm] Pid 2349 opened device
[   41.565792] [drm] Pid 2349 closed device
[   41.580669] [drm] Pid 2349 opened device
[   41.871211] [drm] Finding IP_LAYOUT section header
[   41.871221] [drm] Section IP_LAYOUT details:
[   41.876034] [drm]   offset = 0x54fcf8
[   41.880310] [drm]   size = 0x58
[   41.884008] [drm] Finding DEBUG_IP_LAYOUT section header
[   41.887143] [drm] AXLF section DEBUG_IP_LAYOUT header not found
[   41.892456] [drm] Finding CONNECTIVITY section header
[   41.898369] [drm] Section CONNECTIVITY details:
[   41.903414] [drm]   offset = 0x54fd50
[   41.907935] [drm]   size = 0x28
[   41.911595] [drm] Finding MEM_TOPOLOGY section header
[   41.914732] [drm] Section MEM_TOPOLOGY details:
[   41.919775] [drm]   offset = 0x54fc00
[   41.924296] [drm]   size = 0xf8
[   41.929407] [drm] No ERT scheduler on MPSoC, using KDS
[   41.938079] [drm] scheduler config ert(0)
[   41.938082] [drm]   cus(1)
[   41.942084] [drm]   slots(16)
[   41.944775] [drm]   num_cu_masks(1)
[   41.947733] [drm]   cu_shift(16)
[   41.951215] [drm]   cu_base(0x80000000)
[   41.954433] [drm]   polling(0)
[   41.967185] [drm] User buffer is not physical contiguous
[   41.975560] [drm] zocl_free_userptr_bo: obj 0x000000003b7f7466
[   41.976776] [drm] User buffer is not physical contiguous
[   41.987937] [drm] zocl_free_userptr_bo: obj 0x00000000c6e13d0b
[   41.988169] [drm] User buffer is not physical contiguous

This is the message of xbutil query

root@ultra96v2_base:~$ xbutil query
INFO: Found total 1 card(s), 1 are usable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
System Configuration
OS name:	Linux
Release:	4.19.0-xilinx-v2019.2
Version:	#1 SMP Tue Nov 5 12:14:36 UTC 2019
Machine:	aarch64
Glibc:		2.28
Distribution:	N/A
Now:		Wed Nov  6 14:33:36 2019
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XRT Information
Version:	2.3.0
Git Hash:	7e3540d2707443d8c824669ef4272b33ce2f9ba4
Git Branch:	2019.2
Build Date:	2019-10-22 07:31:35
ZOCL:		2018.2.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shell                           FPGA                            IDCode
ultra96v2_base                  N/A                             N/A
Vendor          Device          SubDevice       SubVendor       
0x10ee          N/A             N/A             N/A             
DDR size        DDR count       Clock0          Clock1          Clock2          
4 GB            1               100             0               0               
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Memory Status
     Tag         Type        Temp(C)  Size    Mem Usage       BO count
[ 0] HP3         **UNUSED**           2 GB    0 Byte          0       
[ 1] HPC0        **UNUSED**           0 Byte  0 Byte          0       
[ 2] HPC1        **UNUSED**           0 Byte  0 Byte          0       
[ 3] HP0         MEM_DRAM             2 GB    20480 Byte      2       
[ 4] HP1         **UNUSED**           0 Byte  0 Byte          0       
[ 5] HP2         **UNUSED**           0 Byte  0 Byte          0       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Streams
     Tag         Flow ID  Route ID Status   Total (B/#)     Pending (B/#)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xclbin UUID
5dc4348d
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compute Unit Status
CU[ 0]: vadd:vadd_1                     @0x80000000        (DONE|IDLE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO: xbutil query succeeded.

I also tested it using xrt_core library with attached code

root@ultra96v2_base:~/vadd.xrt/build$ ./host -k /media/card/build_dir.hw.ultra96v2_base/vadd.xclbin 
Host buffer alignment = 128 bytes
Compiled kernel = /media/card/build_dir.hw.ultra96v2_base/vadd.xclbin
XRT build version: 2.3.0
Build hash: 7e3540d2707443d8c824669ef4272b33ce2f9ba4
Build date: 2019-10-22 07:31:35
Git branch: 2019.2
PID: 2363
UID: 0
[Wed Nov  6 14:37:24 2019]
HOST: ultra96v2_base
EXE: /home/root/vadd.xrt/build/host
[XRT] WARNING: ZYNQShim: logfileName is no longer supported
Shell = ultra96v2_base
Index = 0
PCIe = GEN0 x 0
OCL Frequency = 100 MHz
DDR Bank = 1
Device Temp = 0 C
MIG Calibration = false
Finished downloading bitstream /media/card/build_dir.hw.ultra96v2_base/vadd.xclbin
base_address 80000000
Construct the exe buf cmd to confire FPGA
Send the exec command and configure FPGA (ERT)
Wait until the command finish
Construct the exec command to run the kernel on FPGA
Kernel start command issued through xclExecBuf : start_kernel
Now wait until the kernel finish
reentering wait...
reentering wait...
reentering wait...
reentering wait...
reentering wait...
reentering wait...
reentering wait...
reentering wait...

 

Could you help me to fix the problem? 

0 Kudos
1 Solution

Accepted Solutions
hokim
Scholar
Scholar
2,055 Views
Registered: ‎10-21-2015

Finally, I figured out the solution.

ultra96-radio-leds package of root file system was preventing  axi_intc working correctly.

But I don't understand why it happens: ultra96-radio-leds set gpio emio pin 94, 95

Anyway, vadd kernel is working well after the package is removed

root@ultra96v2_base:/media/card$ ./init.sh 
.
Found Platform
Platform Name: Xilinx
INFO: Reading ./build_dir.hw.ultra96v2_base/vadd.xclbin
Loading: './build_dir.hw.ultra96v2_base/vadd.xclbin'
Trying to program device[0]: ultra96v2_base
Device[0]: program successful!
TEST PASSED

 

View solution in original post

0 Kudos
6 Replies
hokim
Scholar
Scholar
2,233 Views
Registered: ‎10-21-2015

xclbin looks ok

I checked it with host code(vadd.cpp) using zocl ioctl like this

#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <cstring>
#include <thread>
#include <chrono>
#include <time.h>
#include <unistd.h>
#include <zocl/zynq_ioctl.h>

#define XVADD_VADD_CONTROL_ADDR_AP_CTRL    0x00
#define XVADD_VADD_CONTROL_ADDR_GIE        0x04
#define XVADD_VADD_CONTROL_ADDR_IER        0x08
#define XVADD_VADD_CONTROL_ADDR_ISR        0x0c
#define XVADD_VADD_CONTROL_ADDR_IN1_DATA   0x10
#define XVADD_VADD_CONTROL_BITS_IN1_DATA   64
#define XVADD_VADD_CONTROL_ADDR_IN2_DATA   0x1c
#define XVADD_VADD_CONTROL_BITS_IN2_DATA   64
#define XVADD_VADD_CONTROL_ADDR_OUT_R_DATA 0x28
#define XVADD_VADD_CONTROL_BITS_OUT_R_DATA 64
#define XVADD_VADD_CONTROL_ADDR_SIZE_DATA  0x34
#define XVADD_VADD_CONTROL_BITS_SIZE_DATA  32


bool is_ready(uint32_t *addptr) {
  return !((*(addptr + XVADD_VADD_CONTROL_ADDR_AP_CTRL) >> 0) & 0x1);
}

bool is_done(uint32_t *addptr) {
  return ((*(addptr + XVADD_VADD_CONTROL_ADDR_AP_CTRL) >> 1) & 0x1);
}

bool is_idle(uint32_t *addptr) {
  return ((*(addptr + XVADD_VADD_CONTROL_ADDR_AP_CTRL) >> 2) & 0x1);
}

void start_kernel(uint32_t *addptr) {
  *(addptr + XVADD_VADD_CONTROL_ADDR_AP_CTRL) |= 0x1;
}

void print_kernel_status(uint32_t *add1ptr){

  uint32_t isDone, isIdle, isReady;
  isDone = is_done(add1ptr);
  isIdle = is_idle(add1ptr);
  isReady = is_ready(add1ptr);
  printf("---current kernel status done:%d, idle:%d, Ready:%d ---\n\r", isDone, isIdle, isReady);

}

int main(int argc, char *argv[])
{
    if (argc > 2) {
        std::cerr << "Usage: " << argv[0] << " [freq]\n";
        return 1;
    }

    int fd = open("/dev/dri/renderD128",  O_RDWR);
    if (fd < 0) {
        return -1;
    }

    std::cout << "============================================================" << std::endl;
    std::cout << "CREATE" << std::endl;
    drm_zocl_create_bo info1 = {4096*4, 0xffffffff, DRM_ZOCL_BO_FLAGS_COHERENT | DRM_ZOCL_BO_FLAGS_CMA};
    int result = ioctl(fd, DRM_IOCTL_ZOCL_CREATE_BO, &info1);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info1.handle << std::endl;

    drm_zocl_create_bo info2 = {4096*4, 0xffffffff, DRM_ZOCL_BO_FLAGS_COHERENT | DRM_ZOCL_BO_FLAGS_CMA};
    result = ioctl(fd, DRM_IOCTL_ZOCL_CREATE_BO, &info2);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info2.handle << std::endl;

    drm_zocl_create_bo info3 = {4096*4, 0xffffffff, DRM_ZOCL_BO_FLAGS_COHERENT | DRM_ZOCL_BO_FLAGS_CMA};
    result = ioctl(fd, DRM_IOCTL_ZOCL_CREATE_BO, &info3);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info3.handle << std::endl;


    std::cout << "============================================================" << std::endl;
    std::cout << "INFO" << std::endl;
    drm_zocl_info_bo infoInfo1 = {info1.handle, 0, 0};
    result = ioctl(fd, DRM_IOCTL_ZOCL_INFO_BO, &infoInfo1);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info1.handle << std::endl;
    std::cout << "Size " << infoInfo1.size << std::endl;
    std::cout << "Physical " << std::hex << infoInfo1.paddr << std::dec << std::endl;

    std::cout << "============================================================" << std::endl;
    drm_zocl_info_bo infoInfo2 = {info2.handle, 0, 0};
    result = ioctl(fd, DRM_IOCTL_ZOCL_INFO_BO, &infoInfo2);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info2.handle << std::endl;
    std::cout << "Size " << infoInfo2.size << std::endl;
    std::cout << "Physical " << std::hex << infoInfo2.paddr << std::dec << std::endl;

    std::cout << "============================================================" << std::endl;
    drm_zocl_info_bo infoInfo3 = {info3.handle, 0, 0};
    result = ioctl(fd, DRM_IOCTL_ZOCL_INFO_BO, &infoInfo3);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info3.handle << std::endl;
    std::cout << "Size " << infoInfo3.size << std::endl;
    std::cout << "Physical " << std::hex << infoInfo3.paddr << std::dec << std::endl;

    std::cout << "============================================================" << std::endl;
    std::cout << "MMAP" << std::endl;
    drm_zocl_map_bo mapInfo1 = {info1.handle, 0, 0};
    result = ioctl(fd, DRM_IOCTL_ZOCL_MAP_BO, &mapInfo1);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info1.handle << std::endl;
    void *ptr1 = mmap(0, info1.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mapInfo1.offset);
    std::cout << "Offset "  << std::hex << mapInfo1.offset << std::dec << std::endl;
    std::cout << "Pointer " << ptr1 << std::endl;

    drm_zocl_map_bo mapInfo2 = {info2.handle, 0, 0};
    result = ioctl(fd, DRM_IOCTL_ZOCL_MAP_BO, &mapInfo2);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info2.handle << std::endl;
    void *ptr2 = mmap(0, info2.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mapInfo2.offset);
    std::cout << "Offset "  << std::hex << mapInfo2.offset << std::dec << std::endl;
    std::cout << "Pointer " << ptr2 << std::endl;

    drm_zocl_map_bo mapInfo3 = {info3.handle, 0, 0};
    result = ioctl(fd, DRM_IOCTL_ZOCL_MAP_BO, &mapInfo3);
    std::cout << "result = " << result << std::endl;
    std::cout << "Handle " << info3.handle << std::endl;
    void *ptr3 = mmap(0, info3.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mapInfo3.offset);
    std::cout << "Offset "  << std::hex << mapInfo3.offset << std::dec << std::endl;
    std::cout << "Pointer " << ptr3 << std::endl;

    std::cout << "============================================================" << std::endl;
    uint32_t *p1 = (uint32_t*) ptr1;
    uint32_t *p2 = (uint32_t*) ptr2;
    
    for (int i=0; i<4096; i++) {
        p1[i] = i;
        p2[i] = i;
    }
    
    std::cout << "============================================================" << std::endl;
    std::cout << "Compute Unit Status: " << std::endl;
    uint32_t *add1ptr = (uint32_t*)mmap(0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
    printf("Compute Unit addr: %p\n", add1ptr);

    //Print the registers again before starting the kernel
    for (int i = 0; i < 13; ++i) {
      printf("Addr: %p, Data 0x%x\n", add1ptr + i, (uint32_t)(*(add1ptr + i)));
    }
    std::cout << "=================Writing values===========================================" << std::endl;
    try {
//Set the address of in1 *(add1ptr + (XVADD_VADD_CONTROL_ADDR_IN1_DATA/4) ) = infoInfo1.paddr; //*(add1ptr + (XVADD_VADD_CONTROL_ADDR_IN1_DATA/4) + 1) = infoInfo1.paddr >> 32; //Set the address of in2 *(add1ptr + (XVADD_VADD_CONTROL_ADDR_IN2_DATA/4) ) = infoInfo2.paddr; //*(add1ptr + (XVADD_VADD_CONTROL_ADDR_IN2_DATA/4) + 1) = infoInfo2.paddr >> 32; //Set the address of out_r *(add1ptr + (XVADD_VADD_CONTROL_ADDR_OUT_R_DATA/4) ) = infoInfo3.paddr; //*(add1ptr + (XVADD_VADD_CONTROL_ADDR_OUT_R_DATA/4) + 1) = infoInfo3.paddr >> 32; //Set #of elements *(add1ptr + (XVADD_VADD_CONTROL_ADDR_SIZE_DATA/4) ) = 4096; std::cout << "=================Reading back values===========================================" << std::endl; unsigned i = XVADD_VADD_CONTROL_ADDR_IN1_DATA/4; printf("Addr: %p, Offset: %d, Data 0x%x\n", add1ptr + i, i, (uint32_t)(*(add1ptr + i))); i = XVADD_VADD_CONTROL_ADDR_IN2_DATA/4; printf("Addr: %p, Offset: %d, Data 0x%x\n", add1ptr + i, i, (uint32_t)(*(add1ptr + i))); i = XVADD_VADD_CONTROL_ADDR_OUT_R_DATA/4; printf("Addr: %p, Offset: %d, Data 0x%x\n", add1ptr + i, i, (uint32_t)(*(add1ptr + i))); i = XVADD_VADD_CONTROL_ADDR_SIZE_DATA/4; printf("Addr: %p, Offset: %d, Data 0x%x\n", add1ptr + i, i, (uint32_t)(*(add1ptr + i))); uint32_t isDone, isIdle, isReady; isDone = is_done(add1ptr); isIdle = is_idle(add1ptr); isReady = is_ready(add1ptr); printf("---current kernel status done:%d, idle:%d, Ready:%d ---\n\r", isDone, isIdle, isReady); printf (">>>>Now starting kernel...\n\r"); start_kernel(add1ptr ); while (1){ isDone = is_done(add1ptr); isIdle = is_idle(add1ptr); isReady = is_ready(add1ptr); printf("---current kernel status done:%d, idle:%d, Ready:%d ---\n\r", isDone, isIdle, isReady); if (isDone && isIdle) { printf("Exiting while 1 loop ---\n\r"); break; } usleep(100); } /* printf("====Quit test built-in kernel---\n\r"); printf("====Printing 100 elements of in1---\n\r"); p1 = (uint32_t*) ptr1; for (int i = 0; i < 100; ++i) { printf("Mem addr: 0x%x, Data: 0x%x\n\r", p1 + i, p1[i]); } printf("====Printing 100 elements of in2---\n\r"); p2 = (uint32_t*) ptr2; for (int i = 0; i < 100; ++i) { printf("Mem addr: 0x%x, Data: 0x%x\n\r", p2 + i, p2[i]); } printf("====Printing 100 elements of out_r---\n\r"); uint32_t *p3 = (uint32_t*) ptr3; for (int i = 0; i < 100; ++i) { printf("Mem addr: 0x%x, Data: 0x%x\n\r", p3 + i, p3[i]); } */ uint32_t *p3 = (uint32_t*) ptr3; bool match = true; for (int i=0; i<4096; i++) { if (p1[i]+p2[i] != p3[i]) { match = false; break; } } std::cout << "TEST " << (match ? "PASSED" : "FAILED") << std::endl; print_kernel_status(add1ptr); std::cout << "============================================================" << std::endl; } catch (...) { std::cout << "CLOSE" << std::endl; drm_gem_close closeInfo = {info1.handle, 0}; result = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &closeInfo); std::cout << "result = " << result << std::endl; closeInfo.handle = info2.handle; result = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &closeInfo); std::cout << "result = " << result << std::endl; closeInfo.handle = info3.handle; result = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &closeInfo); std::cout << "result = " << result << std::endl; result = close(fd); std::cout << "result = " << result << std::endl; return result; } std::cout << "CLOSE" << std::endl; drm_gem_close closeInfo = {info1.handle, 0}; result = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &closeInfo); std::cout << "result = " << result << std::endl; closeInfo.handle = info2.handle; result = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &closeInfo); std::cout << "result = " << result << std::endl; closeInfo.handle = info3.handle; result = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &closeInfo); std::cout << "result = " << result << std::endl; result = close(fd); std::cout << "result = " << result << std::endl; return result; }

 

This is test result

root@ultra96v2_base:~$ xbutil program -d 0 -p /media/card/build_dir.hw.ultra96v2_base/vadd.xclbin 
INFO: Found total 1 card(s), 1 are usable
INFO: xbutil program succeeded.

root@ultra96v2_base:~$ g++ -std=c++11 -o vadd vadd.cpp

root@ultra96v2_base:~$ ./vadd
============================================================
CREATE
result = 0
Handle 1
result = 0
Handle 2
result = 0
Handle 3
============================================================
INFO
result = 0
Handle 1
Size 16384
Physical 6fc8c000
============================================================
result = 0
Handle 2
Size 16384
Physical 6fc90000
============================================================
result = 0
Handle 3
Size 16384
Physical 6fc94000
============================================================
MMAP
result = 0
Handle 1
Offset 100000000
Pointer 0x7f8d730000
result = 0
Handle 2
Offset 100004000
Pointer 0x7f8d72c000
result = 0
Handle 3
Offset 100008000
Pointer 0x7f8d728000
============================================================
============================================================
Compute Unit Status: 
Compute Unit addr: 0x7f8d32a000
Addr: 0x7f8d32a000, Data 0x4
Addr: 0x7f8d32a004, Data 0x1
Addr: 0x7f8d32a008, Data 0x1
Addr: 0x7f8d32a00c, Data 0x0
Addr: 0x7f8d32a010, Data 0x0
Addr: 0x7f8d32a014, Data 0x0
Addr: 0x7f8d32a018, Data 0x0
Addr: 0x7f8d32a01c, Data 0x0
Addr: 0x7f8d32a020, Data 0x0
Addr: 0x7f8d32a024, Data 0x0
Addr: 0x7f8d32a028, Data 0x0
Addr: 0x7f8d32a02c, Data 0x0
Addr: 0x7f8d32a030, Data 0x0
=================Writing values===========================================
=================Reading back values===========================================
Addr: 0x7f8d32a010, Offset: 4, Data 0x6fc8c000
Addr: 0x7f8d32a01c, Offset: 7, Data 0x6fc90000
Addr: 0x7f8d32a028, Offset: 10, Data 0x6fc94000
Addr: 0x7f8d32a034, Offset: 13, Data 0x1000
---current kernel status done:0, idle:1, Ready:1 ---
>>>>Now starting kernel...
---current kernel status done:0, idle:0, Ready:0 ---
---current kernel status done:1, idle:1, Ready:1 ---
Exiting while 1 loop ---
TEST PASSED
---current kernel status done:0, idle:1, Ready:1 ---
============================================================
CLOSE
result = 0
result = 0
result = 0
result = 0

To compile test program, I added the following to petalinux project

#<project>/project-spec/meta-user/recipes-xrt/zocl/zocl_%.bbappend
FILES_${PN}-dev += "${includedir}/zocl/*"

do_install_append () {
    install -d ${D}${includedir}/zocl
    install -m 0644 ${S}/../../include/drm.h ${D}${includedir}/zocl
    install -m 0644 ${S}/../../include/drm_mode.h ${D}${includedir}/zocl
    install -m 0644 ${S}/../../include/zynq_ioctl.h ${D}${includedir}/zocl
}
#<project>/project-spec/meta-user/recipes-core/images/petalinux-user-image.bbappend
IMAGE_INSTALL_append = " zocl-dev"

I think this is xrt library problem.

Could you check it?

0 Kudos
hokim
Scholar
Scholar
2,171 Views
Registered: ‎10-21-2015

Sorry about confusing you

The cause of problem is not xrt but hw.

I'm checking it by changing hw logic(bitstream) from built xclbin using xclbinutil command with --remove-section/--add-section BITSTREAM and vivado project with linked kernel(vadd_1).

The problem is because the interrupt from kernel is not delivered through axi intc while the direct connection from kernel to ps without axi intc works well

But I'm not figuring out why axi intc doesn't work probably in ultra96v2 board.(It is ok in the other boards; zcu104, zybo z7 20)

0 Kudos
hokim
Scholar
Scholar
2,130 Views
Registered: ‎10-21-2015

axi_intc.png

I checked axi_intc  with the above simplified project

The devicetree is

amba {

        irqtest {
            compatible = "inipro,irqtest";
            interrupt-parent = <0x20>;
            interrupts = <0x0 0x4>;
        };
};

amba_pl {

        interrupt-controller@80000000 {
            #interrupt-cells = <0x2>;
            clock-names = "s_axi_aclk";
            clocks = <0x3 0x47>;
            compatible = "xlnx,axi-intc-4.1", "xlnx,xps-intc-1.00.a";
            interrupt-controller;
            reg = <0x0 0x80000000 0x0 0x10000>;
            xlnx,kind-of-intr = <0x0>;
            xlnx,num-intr-inputs = <0x1>;
            interrupt-parent = <0x4>;
            interrupts = <0x0 0x59 0x4>;
            phandle = <0x20>;
        };
};

 

The irqtest code is

#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>

struct irqtest {
	struct device *dev;
	int irq;
};

static irqreturn_t irqtest_handler(int irq, void *data)
{
	struct irqtest *test = data;

	//dev_warn(test->dev, "interrupt fired\n");
	
	return IRQ_HANDLED;
}

static int irqtest_probe(struct platform_device *pdev)
{
	struct irqtest *test;
	int ret;

	test = devm_kzalloc(&pdev->dev, sizeof(*test), GFP_KERNEL);
	if (!test)
		return -ENOMEM;

	test->dev = &pdev->dev;

	dev_warn(test->dev, "probe\n");
	
	test->irq = platform_get_irq(pdev, 0);
	if (IS_ERR(test->irq)) {
		ret = PTR_ERR(test->irq);
		if (ret != -EPROBE_DEFER)
			dev_err(test->dev, "Failed to get irq: %d\n", ret);
		return ret;
	}

	dev_warn(test->dev, "irq no = %d\n", test->irq);
	
	ret = devm_request_irq(&pdev->dev, test->irq, irqtest_handler,
					IRQF_SHARED, "irqtest", test);

	if (ret) {
		dev_warn(test->dev, "failed to request_irq()\n");
		return ERR_PTR(ret);
	}

	platform_set_drvdata(pdev, test);

	return 0;
}

static int irqtest_remove(struct platform_device *pdev)
{
	struct irqtest *test = platform_get_drvdata(pdev);

	dev_warn(test->dev, "remove\n");

	return 0;
}

#ifdef CONFIG_OF

static const struct of_device_id irqtest_id[] = {
	{ .compatible = "inipro,irqtest" },
	{ }
};
MODULE_DEVICE_TABLE(of, irqtest_id);

#endif

static struct platform_driver irqtest_driver = {
	.probe = irqtest_probe,
	.remove = irqtest_remove,
	.driver = {
		.name = "irqtest",
		.of_match_table = of_match_ptr(irqtest_id),
	},
};
module_platform_driver(irqtest_driver);

MODULE_AUTHOR("Hyunok Kim");
MODULE_DESCRIPTION("irq test module");
MODULE_LICENSE("GPL");

Test result is

root@ultra96v2_test:~$ cat /proc/interrupts

48:          1          0          0          0  interrupt-controller@80000000   0 Level   -level     irqtest

Because fit_timer_0 fires interrupt signal every second, the interrupt count of CPU should be increased every second

But the count is stuck at '1' 

When I use the same project in zcu104, it works correctly

hokim
Scholar
Scholar
2,056 Views
Registered: ‎10-21-2015

Finally, I figured out the solution.

ultra96-radio-leds package of root file system was preventing  axi_intc working correctly.

But I don't understand why it happens: ultra96-radio-leds set gpio emio pin 94, 95

Anyway, vadd kernel is working well after the package is removed

root@ultra96v2_base:/media/card$ ./init.sh 
.
Found Platform
Platform Name: Xilinx
INFO: Reading ./build_dir.hw.ultra96v2_base/vadd.xclbin
Loading: './build_dir.hw.ultra96v2_base/vadd.xclbin'
Trying to program device[0]: ultra96v2_base
Device[0]: program successful!
TEST PASSED

 

View solution in original post

0 Kudos
hlppm
Visitor
Visitor
1,781 Views
Registered: ‎08-05-2019
Hi hokim,

Thanks for your reply.
Could you please let me know where I can find ultra96-radio-leds package and how I can remove that?

Thanks
hlppm

0 Kudos
hokim
Scholar
Scholar
1,768 Views
Registered: ‎10-21-2015

Hi

I refered to http://downloads.element14.com/downloads/zedboard/ultra96/ultra96v2_oob_2018_3.zip for petalinux build

It has  ultra96-radio-leds recipe

The recipe is for pl leds but my pl design has no such leds

So I removed the recipe from petalinux-user-image.bbappend

0 Kudos