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: 
Visitor koziotis
Visitor
490 Views
Registered: ‎06-07-2018

SDSoC Program (zcu102 board) crashes with "Bus error" message, when using the sds_alloc_non_cacheable() and -O3 optimization level

Find following a very simple C program that crashes with the message "Bus error" when compiled with -O3 for

target platform zcu102 and target OS linux.
The program allocates a single array of bytes using the sds_alloc_non_cacheable() function.
It exhibits a very strange behavior and seems to be dependent on the initial value of the memory buffer.
In fact when changing initial value from 0 to 1 the problem disappears.

//----------------------------------------------------------
main.cpp:

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

#define BYTESIZE 1024

int main(int argc, char** argv) {

  char * buf1 = (char *) sds_alloc_non_cacheable(BYTESIZE * sizeof(char) );
  printf("buf1 = %p\n", buf1);
  for (int i=0; i<BYTESIZE; i++) buf1[i] = 0; // not working
//for (int i=0; i<BYTESIZE; i++) buf1[i] = 1; //     working
}

//----------------------------------------------------------

//----------------------------------------------------------
Makefile:

APPSOURCES = main.cpp
EXECUTABLE = buggy.elf

PLATFORM = zcu102
OS = -target-os linux

SDSCC_FLAGS = -sds-pf ${PLATFORM}

CC = sds++ ${SDSCC_FLAGS}

IDIRS =
LDIRS =
LLIBS =
OLEVEL = -O3

CFLAGS = -Wall ${OLEVEL} -c ${IDIRS} ${OS}
LFLAGS = ${OLEVEL} ${LDIRS} ${LLIBS} ${OS}

SOURCES := $(patsubst %,./%,$(APPSOURCES))   
OBJECTS := $(APPSOURCES:.cpp=.o)
DEPS := $(OBJECTS:.o=.d)

.PHONY: all

all: ${EXECUTABLE}

${EXECUTABLE}: ${OBJECTS}
    ${CC} ${OBJECTS} ${LFLAGS} -o $@  

-include ${DEPS}

%.o: %.cpp
    ${CC} ${CFLAGS} $< -o $@

clean:
    ${RM} ${EXECUTABLE} ${OBJECTS}

ultraclean: clean
    ${RM} -rf _sds sd_card ${EXECUTABLE}.bit
    ${RM} -rf vivado* .Xil

//----------------------------------------------------------

 
When changing -O3 to -O0 the problem also disappears.


I would kindly request Xilinx, to get this solved in the upcoming SDSoC versions.

Thank you,

Michael Koziotis

0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
400 Views
Registered: ‎03-31-2011

Re: SDSoC Program (zcu102 board) crashes with "Bus error" message, when using the sds_alloc_non_cacheable() and -O3 optimization level

I grabbed your code, used the delivered zcu102 platform, set the sds++ opt to level -03 and was able to build this w/o issue in 2018.2.  What version of the tools are you running this on?

0 Kudos
Visitor sat1903
Visitor
145 Views
Registered: ‎11-23-2018

Re: SDSoC Program (zcu102 board) crashes with "Bus error" message, when using the sds_alloc_non_cacheable() and -O3 optimization level

I am facing the same issue on ZCU102 Board. There is no issue when building the code. But, when I am running the code, I find the bus error. Also, I am not facing the issue when I run it on emulation mode.

Issue is specific when the run the code on ZCU102 Board.

SDX Version - 2018.2

0 Kudos