cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tni
Visitor
Visitor
4,098 Views
Registered: ‎11-04-2014

SDSOC sample application illegal memory access

Jump to solution

Hello,

 

I ran into some memory access issue trying ot execute SDSOC generated .elf.

 

I'm trying to test the ability to use C-callable functions in SDSOC on a ZEDboard

I built a block design using Vivado that's very similar to the zc702_axis_io example. Here's a picture of my block design:

q.jpg

I'm trying to use some button information as input streaming to the PS using the axis stream data fifo. From here, I followed ug1146/ug1027 and built my custom platform, static library and Linux image(using petalinux).

 

I then created a SDSOC sample project using my custom platform and template "Unpacketized AXI4-Stream to DDR".

The source of the template can be found under the SDSOC install directory:

C:\Xilinx\SDx\2016.4\samples\platforms\zc702_axis_io\samples\aximm\main.cpp

 

I was able to compile the design, generate SDcard image and boot up linux on my ZEDboard, after executing the .elf file,

I got the following error message:

 

Error: application performed illegal memory access and is being terminated

 

Please advise.

Thanks,

Tian

 

 

0 Kudos
1 Solution

Accepted Solutions
tni
Visitor
Visitor
5,756 Views
Registered: ‎11-04-2014

I fixed this issue by rebuilding linux image with Petalinux 2016.3.

There are incompatibilities between PetaLinux 2016.4 and the Xilinx-v2016.4_sdx tag.

 

tni

View solution in original post

0 Kudos
5 Replies
tni
Visitor
Visitor
4,094 Views
Registered: ‎11-04-2014

I forgot to mention that I'm using SDSOC 2016.4 and petalinux 2016.4.

0 Kudos
sskalick
Xilinx Employee
Xilinx Employee
3,707 Views
Registered: ‎06-29-2015

Hi tni,

 

The message "Error: application performed illegal memory access and is being terminated" is coming from Linux, which is terminating your program for illegally accessing memory not allocated to your process. This is probably due to some problem in your application code regarding to back pointers/allocation/etc. 

 

If you need help debugging, please upload your source code.

 

Sam

0 Kudos
supanhappy
Visitor
Visitor
3,626 Views
Registered: ‎03-16-2017

Hi,dear      Have you fixed this problem ?      I occur the same problem。

0 Kudos
tni
Visitor
Visitor
3,614 Views
Registered: ‎11-04-2014

Here's my source.

 

/*
(c) Copyright 2013 - 2016 Xilinx, Inc. All rights reserved.

This file contains confidential and proprietary information of Xilinx, Inc. and
is protected under U.S. and international copyright and other intellectual
property laws.

DISCLAIMER
This disclaimer is not a license and does not grant any rights to the materials
distributed herewith. Except as otherwise provided in a valid license issued to
you by Xilinx, and to the maximum extent permitted by applicable law: (1) THESE
MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL FAULTS, AND XILINX HEREBY
DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR
FITNESS FOR ANY PARTICULAR PURPOSE; and (2) Xilinx shall not be liable (whether
in contract or tort, including negligence, or under any other theory of
liability) for any loss or damage of any kind or nature related to, arising
under or in connection with these materials, including for any direct, or any
indirect, special, incidental, or consequential loss or damage (including loss
of data, profits, goodwill, or any type of loss or damage suffered as a result
of any action brought by a third party) even if such damage or loss was
reasonably foreseeable or Xilinx had been advised of the possibility of the
same.

CRITICAL APPLICATIONS
Xilinx products are not designed or intended to be fail-safe, or for use in any
application requiring fail-safe performance, such as life-support or safety
devices or systems, Class III medical devices, nuclear facilities, applications
related to the deployment of airbags, or any other applications that could lead
to death, personal injury, or severe property or environmental damage
(individually and collectively, "Critical Applications"). Customer assumes the
sole risk and liability of any use of Xilinx products in Critical Applications,
subject only to applicable laws and regulations governing limitations on product
liability.

THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE AT
ALL TIMES.
*/

#include <stdio.h>
#include "sds_lib.h"
#include "testzed.h"

#define BUF_SIZE 16
#define NUM_BUFFERS 4

// s2mm "DMA" accelerator
#pragma SDS data mem_attribute (buf:CACHEABLE|PHYSICAL_CONTIGUOUS)
#pragma SDS data zero_copy(buf)
int s2mm_data_copy(unsigned *fifo, unsigned buf[BUF_SIZE])
{
#pragma HLS interface axis port=fifo
     for(int i=0; i<BUF_SIZE; i++) {
#pragma HLS pipeline
          buf[i] = *fifo;
     }
     return 0;
}

// This function's data flow defines the accelerator network
void s2mm_data_copy_wrapper(unsigned *buf)
{
     unsigned rbuf0[1];
     btn_read_stream(rbuf0);
     s2mm_data_copy(rbuf0,buf);
}


// Check data buffers for dropped samples due to platform FIFO overrun
bool check(unsigned *bufs[])
{
     bool error = false;
     for(int i=0; i<NUM_BUFFERS; i++) {
          if(bufs[i][0] != (bufs[i][BUF_SIZE-1] - BUF_SIZE + 1)) {
               printf("ERROR: dropped %u elements in buffer %u\n\r",
                      bufs[i][BUF_SIZE-1]-bufs[i][0], i);
               error = true;
          }
     }
     for(int i=0; i<NUM_BUFFERS-1; i++) {
          if(bufs[i][BUF_SIZE-1] != (bufs[i+1][0] - 1)) {
               printf("ERROR: dropped %u elements between buffers %u and %u\n\r",
                      bufs[i+1][0]-bufs[i][BUF_SIZE-1], i,i+1);
               error = true;
          }
     }
     return error;
}

int main()
{
     unsigned *bufs[NUM_BUFFERS];
     bool error = false;

     for(int i=0; i<NUM_BUFFERS; i++) {
          bufs[i] = (unsigned*) sds_alloc(BUF_SIZE * sizeof(unsigned));
     }

     // Flush the platform FIFO of start-up garbage
     s2mm_data_copy_wrapper(bufs[0]);


     for(int i=0; i<NUM_BUFFERS; i++) {
          s2mm_data_copy_wrapper(bufs[i]);
     }

     error = check(bufs);

     printf("TEST %s\n\r", (error ? "FAILED" : "PASSED"));

     for(int i=0; i<NUM_BUFFERS; i++) {
          sds_free(bufs[i]);
     }
     return 0;
}

It is the S2mm example for zc702 platform, but it should work for zedboard.

 

0 Kudos
tni
Visitor
Visitor
5,757 Views
Registered: ‎11-04-2014

I fixed this issue by rebuilding linux image with Petalinux 2016.3.

There are incompatibilities between PetaLinux 2016.4 and the Xilinx-v2016.4_sdx tag.

 

tni

View solution in original post

0 Kudos