pulp-platform / pulp-sdk

Apache License 2.0
99 stars 74 forks source link

Hello World on Virtual Platform: Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"... #92

Open bbo49 opened 3 years ago

bbo49 commented 3 years ago

When I run the Hello World example from https://github.com/GreenWaves-Technologies/pmsis_tests/tree/master/quick/hello on the virtual platform in Centos 7.9, I get a segmentation fault. I'm using the latest commit of version 2 of the SDK: 877b0a29091af9c800e7739e3d604d7e3e5d5290

[root@00b83d36f93a hello]# make run
gapy --target=pulp --platform=gvsoc --work-dir=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV/ --config-opt=cluster/nb_pe=8    run --exec-prepare --exec --binary=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV//test/test
Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"...
make: *** [run] Aborted

I get the same issue when running any test from the tests directory inside pulp-sdk. To reproduce, build the Dockerfile:

FROM centos:centos7

##############################
# System packages
##############################
# Enable extra repositories
RUN yum install -y centos-release-scl epel-release
# Compiler dependencies
RUN yum install -y autoconf automake libmpc-devel mpfr-devel gmp-devel gawk  bison flex texinfo patchutils gcc gcc-c++ zlib-devel wget tar
# SDK dependencies
# V1
RUN yum install -y git python python-pip python36-pip python36-devel gawk texinfo gmp-devel mpfr-devel libmpc-devel swig libjpeg-turbo-devel redhat-lsb-core doxygen python-sphinx sox GraphicsMagick-devel ImageMagick-devel SDL2-devel perl-Switch libftdi-devel cmake cmake3 scons ImageMagick-c++-devel GraphicsMagick-c++-devel
# V2
RUN yum install -y devtoolset-7
RUN yum install -y libftdi-devel doxygen curl cmake cmake3 libusb-devel scons gtkwave libsndfile-devel rsync libtool pkgconfig SDL2-devel
RUN yum install -y python-virtualenv

###############################
## Install GCC Toolchain
###############################
run yum install -y wget tar bzip2
## Download stable version
RUN wget https://github.com/pulp-platform/pulp-riscv-gnu-toolchain/releases/download/v1.0.16/v1.0.16-pulp-riscv-gcc-centos-7.tar.bz2 && tar -xjvf ./v1.0.16-pulp-riscv-gcc-centos-7.tar.bz2 && mv ./v1.0.16-pulp-riscv-gcc-centos-7 /opt/riscv && rm -rf v1.0.16-pulp-riscv-gcc-centos-7.tar.bz2
## Update environment variables
ENV PULP_RISCV_GCC_TOOLCHAIN=/opt/riscv
ENV PATH=/opt/riscv/bin:${PATH}

###############################
## Install SDK
###############################
RUN python3 -m pip install argcomplete artifactory twisted prettytable sqlalchemy pyelftools openpyxl xlsxwriter pyyaml numpy configparser pyvcd
RUN python2 -m pip install configparser==4.0.2

# Create folders to store sdk
#RUN mkdir -p /pulp/sdk

# Clone SDK, V2
RUN git clone https://github.com/pulp-platform/pulp-sdk /pulp/sdk/v2
RUN /bin/bash -c "cd /pulp/sdk/v2 && source /opt/rh/devtoolset-7/enable && source ./configs/pulp-open.sh && make all"

# Clone SDK, V1
RUN git clone https://github.com/pulp-platform/pulp-sdk /pulp/sdk/v1
RUN /bin/bash -c "cd /pulp/sdk/v1 && git checkout tags/2019.12.06 && source /opt/rh/devtoolset-7/enable && source ./configs/pulpissimo.sh && source ./configs/platform-gvsoc.sh && make all"

##############################
# Install pulpissimo Sources
##############################
# Clone Pulpissimo
RUN git clone https://github.com/pulp-platform/pulpissimo /pulp/pulpissimo
# Download all source files
RUN cd /pulp/pulpissimo && make checkout

##############################
# Install examples
##############################
RUN mkdir -p /pulp/examples
#Clone V1 examples
RUN git clone https://github.com/pulp-platform/pulp-rt-examples /pulp/examples/v1
# Clone V2 examples
RUN git clone https://github.com/GreenWaves-Technologies/pmsis_tests /pulp/examples/v2

Put this file as a file named Dockerfile in a directory and open a terminal in that folder.

docker build -t pulp-sdk-image .
docker create -it --name pulp-sdk pulp-sdk-image bash
docker start pulp-sdk
docker exec -it pulp-sdk bash

cd pulp/sdk/v2/
source configs/pulp-open.sh
cd /pulp/examples/v2/quick/hello/
make clean all
#>RM  /pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV/
#>CC  test.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/fll-v1.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/freq-domains.c
#>CC  /pulp/sdk/v2/rtos/pulpos/pulp/kernel/chips/pulp/soc.c
#>CC  /pulp/sdk/v2/rtos/pmsis/pmsis_bsp/fs/read_fs/read_fs.c
#>CC  /pulp/sdk/v2/rtos/pmsis/pmsis_bsp/fs/host_fs/semihost.c
#>CC  /pulp/sdk/v2/rtos/pmsis/pmsis_bsp/fs/host_fs/host_fs.c
#>CC  /pulp/sdk/v2/rtos/pmsis/pmsis_bsp/fs/fs.c
#>CC  /pulp/sdk/v2/rtos/pmsis/pmsis_bsp/bsp/pulp.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/lib/libc/minimal/io.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/lib/libc/minimal/fprintf.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/lib/libc/minimal/prf.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/lib/libc/minimal/sprintf.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/lib/libc/minimal/semihost.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/init.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/kernel.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/device.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/task.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/alloc.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/alloc_pool.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/irq.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/soc_event.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/log.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/time.c
#>CC  /pulp/sdk/v2/rtos/pulpos/pulp/drivers/uart/uart-v1.c
#>CC  /pulp/sdk/v2/rtos/pulpos/pulp/drivers/udma/udma-v3.c
#>CC  /pulp/sdk/v2/rtos/pulpos/pulp/drivers/cluster/cluster.c
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/crt0.S
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/irq_asm.S
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/task_asm.S
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/time_asm.S
#>CC  /pulp/sdk/v2/rtos/pulpos/common/kernel/soc_event_v2_itc.S
#>CC  /pulp/sdk/v2/rtos/pulpos/pulp/drivers/cluster/pe-eu-v3.S
#>LD  /pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV//test/test
#>gapy --target=pulp --platform=gvsoc --work-dir=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV/ --config-opt=cluster/nb_pe=8    run --image --binary=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV//test/test
#>gapy --target=pulp --platform=gvsoc --work-dir=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV/ --config-opt=cluster/nb_pe=8    run --flash --binary=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV//test/test
make run
#>gapy --target=pulp --platform=gvsoc --work-dir=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV/ --config-opt=cluster/nb_pe=8    run --exec-prepare --exec --binary=/pulp/examples/v2/quick/hello/BUILD/PULP/GCC_RISCV//test/test
#>Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"...
#make: *** [run] Aborted
Miskina commented 3 years ago

Have you found the answer to this issue? I am running into the same thing

bbo49 commented 3 years ago

No I haven't found a solution to this problem in centos/redhat 7.9 yet. It works fine in an ubuntu 18.04 docker container, but I couldn't dive into differences between these platforms/distros to locate the issue yet.

Yingxiu-Chang commented 2 years ago

Have you found the answer? I got the same problem as well. @bbo49

bbo49 commented 2 years ago

No I'm sorry, I didn't debug any further on this issue.